[webkit-changes] cvs commit: WebCore/layout-tests/fast/css-generated-content 013-expected.txt 013.html

David hyatt at opensource.apple.com
Thu Jun 9 23:47:37 PDT 2005


hyatt       05/06/09 23:47:36

  Modified:    .        ChangeLog
               khtml/css cssstyleselector.cpp
  Added:       layout-tests/fast/css-generated-content 013-expected.txt
                        013.html
  Log:
  	Fix from Carston Guenther for bugzilla bug 3236.
  
  	attr(x) should work even if x is not present on the element.
  
  	This is Radar bug #3584466
  
          Reviewed by hyatt
  
          Test cases added: fast/css-generated-content/013.html
  
          * khtml/css/cssstyleselector.cpp:
          (khtml::CSSStyleSelector::applyProperty):
          * layout-tests/fast/css-generated-content/013-expected.txt: Added.
          * layout-tests/fast/css-generated-content/013.html: Added.
  
  Revision  Changes    Path
  1.4253    +17 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4252
  retrieving revision 1.4253
  diff -u -r1.4252 -r1.4253
  --- ChangeLog	10 Jun 2005 04:27:20 -0000	1.4252
  +++ ChangeLog	10 Jun 2005 06:47:32 -0000	1.4253
  @@ -1,3 +1,20 @@
  +2005-06-09  David Hyatt  <hyatt at apple.com>
  +
  +	Fix from Carston Guenther for bugzilla bug 3236.
  +
  +	attr(x) should work even if x is not present on the element.
  +
  +	This is Radar bug #3584466
  +	
  +        Reviewed by hyatt
  +
  +        Test cases added: fast/css-generated-content/013.html
  +
  +        * khtml/css/cssstyleselector.cpp:
  +        (khtml::CSSStyleSelector::applyProperty):
  +        * layout-tests/fast/css-generated-content/013-expected.txt: Added.
  +        * layout-tests/fast/css-generated-content/013.html: Added.
  +
   2005-06-09  Darin Adler  <darin at apple.com>
   
           Tested by Mark Rowe.
  
  
  
  1.184     +6 -2      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- cssstyleselector.cpp	11 May 2005 05:49:34 -0000	1.183
  +++ cssstyleselector.cpp	10 Jun 2005 06:47:36 -0000	1.184
  @@ -3042,8 +3042,12 @@
                   // just the hardcoded HTML set.  Can a namespace be specified for
                   // an attr(foo)?
                   int attrID = element->getDocument()->attrId(0, val->getStringValue().implementation(), false);
  -                if (attrID)
  -                    style->setContent(element->getAttribute(attrID).implementation(), i != 0);
  +                if (attrID) {
  +                    DOMStringImpl* v = element->getAttribute(attrID).implementation();
  +                    if (!v)
  +                        v = DOMStringImpl::empty(); // Don't allow v to be null, since we want to concatenate this string even if it's empty.
  +                    style->setContent(v, i != 0);
  +                }  
               }
               else if (val->primitiveType()==CSSPrimitiveValue::CSS_URI)
               {
  
  
  
  1.1                  WebCore/layout-tests/fast/css-generated-content/013-expected.txt
  
  Index: 013-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (8,8) size 784x584
        RenderBlock {H1} at (0,0) size 784x37
          RenderInline (generated) at (0,0) size 207x37
            RenderText at (0,0) size 207x37
              text run at (0,0) width 207: "First Chapter: "
          RenderText {TEXT} at (207,0) size 105x37
            text run at (207,0) width 105: "TEST 1"
        RenderBlock (anonymous) at (0,58) size 784x18
          RenderText {TEXT} at (0,0) size 239x18
            text run at (0,0) width 239: "Should read: \"First Chapter: TEST 1\""
        RenderBlock {H2} at (0,95) size 784x28
          RenderInline (generated) at (0,0) size 99x28
            RenderText at (0,0) size 99x28
              text run at (0,0) width 99: "Chapter: "
          RenderText {TEXT} at (99,0) size 79x28
            text run at (99,0) width 79: "TEST 2"
        RenderBlock (anonymous) at (0,142) size 784x18
          RenderText {TEXT} at (0,0) size 207x18
            text run at (0,0) width 207: "Should read: \"Chapter: TEST 2\""
        RenderBlock {H3} at (0,178) size 784x22
          RenderInline (generated) at (0,0) size 118x22
            RenderText at (0,0) size 118x22
              text run at (0,0) width 118: "Chapter One: "
          RenderText {TEXT} at (118,0) size 65x22
            text run at (118,0) width 65: "TEST 3"
        RenderBlock (anonymous) at (0,218) size 784x18
          RenderText {TEXT} at (0,0) size 238x18
            text run at (0,0) width 238: "Should read: \"Chapter One: TEST 3\""
        RenderBlock {H4} at (0,257) size 784x18
          RenderInline (generated) at (0,0) size 66x18
            RenderText at (0,0) size 66x18
              text run at (0,0) width 66: "Chapter: "
          RenderText {TEXT} at (66,0) size 54x18
            text run at (66,0) width 54: "TEST 4"
        RenderBlock (anonymous) at (0,296) size 784x18
          RenderText {TEXT} at (0,0) size 207x18
            text run at (0,0) width 207: "Should read: \"Chapter: TEST 4\""
  
  
  
  1.1                  WebCore/layout-tests/fast/css-generated-content/013.html
  
  Index: 013.html
  ===================================================================
  <html>
  <head>
  <title>CSS content test</title>
  <style>
  H1:before {
    content: attr(myAttr) " Chapter: "
  }
  H2:before {
    content: attr(myAttr) "Chapter: "
  }
  H3:before {
    content: "Chapter " attr(myAttr) ": "
  }
  H4:before {
    content: "Chapter: " attr(myAttr)
  }
  </style>
  </head>
  <body>
  <h1 myAttr="First">TEST 1</h1>
  Should read: "First Chapter: TEST 1"
  <h2>TEST 2</h2>
  Should read: "Chapter: TEST 2"
  <h3 myAttr="One">TEST 3</h3>
  Should read: "Chapter One: TEST 3"
  <h4>TEST 4</h4>
  Should read: "Chapter: TEST 4"
  </body>
  
  
  



More information about the webkit-changes mailing list