[webkit-changes] cvs commit: WebCore/layout-tests/fast/dom children-nodes-expected.txt children-nodes.html

Maciej mjs at opensource.apple.com
Sat Jun 11 02:51:02 PDT 2005


mjs         05/06/11 02:51:01

  Modified:    .        ChangeLog
               khtml/html html_miscimpl.cpp
  Added:       layout-tests/fast/dom children-nodes-expected.txt
                        children-nodes.html
  Log:
          Patch from Timothy Hatcher  <timothy at colloquy.info>, reviewed by me.
  
          Test cases added:
          * layout-tests/fast/dom/children-nodes-expected.txt: Added.
          * layout-tests/fast/dom/children-nodes.html: Added.
  
          * khtml/html/html_miscimpl.cpp:
          (DOM::HTMLCollectionImpl::traverseNextItem): For "children"
  	collection, use nextSibling() instead of traverseNextNext() to avoid
  	doing deep traversal.
  
  Revision  Changes    Path
  1.4259    +13 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4258
  retrieving revision 1.4259
  diff -u -r1.4258 -r1.4259
  --- ChangeLog	11 Jun 2005 09:41:06 -0000	1.4258
  +++ ChangeLog	11 Jun 2005 09:50:58 -0000	1.4259
  @@ -1,5 +1,18 @@
   2005-06-11  Maciej Stachowiak  <mjs at apple.com>
   
  +        Patch from Timothy Hatcher  <timothy at colloquy.info>, reviewed by me.
  +
  +        Test cases added:
  +        * layout-tests/fast/dom/children-nodes-expected.txt: Added.
  +        * layout-tests/fast/dom/children-nodes.html: Added.
  +
  +        * khtml/html/html_miscimpl.cpp:
  +        (DOM::HTMLCollectionImpl::traverseNextItem): For "children"
  +	collection, use nextSibling() instead of traverseNextNext() to avoid
  +	doing deep traversal.
  +
  +2005-06-11  Maciej Stachowiak  <mjs at apple.com>
  +
           Added missing expected results from the background image patch.
   
           * layout-tests/fast/backgrounds/001-expected.txt: Added.
  
  
  
  1.26      +4 -1      WebCore/khtml/html/html_miscimpl.cpp
  
  Index: html_miscimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_miscimpl.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- html_miscimpl.cpp	11 May 2005 00:58:28 -0000	1.25
  +++ html_miscimpl.cpp	11 Jun 2005 09:51:01 -0000	1.26
  @@ -129,7 +129,10 @@
   {
       assert(current);
   
  -    current = current->traverseNextNode(m_base.get());
  +    if (type == NODE_CHILDREN && m_base.get() != current)
  +        current = current -> nextSibling();
  +    else
  +        current = current->traverseNextNode(m_base.get());
   
       while (current) {
           if(current->nodeType() == Node::ELEMENT_NODE) {
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/children-nodes-expected.txt
  
  Index: children-nodes-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 {DIV} at (0,0) size 784x70 [border: (1px solid #FF0000)]
          RenderBlock {P} at (1,17) size 782x36
            RenderText {TEXT} at (0,0) size 766x36
              text run at (0,0) width 766: "This test verifies that JavaScript returns only direct descendent element nodes in the 'children' collection (an IE extension)."
              text run at (0,18) width 698: "We also verify that the 'childNodes' collection contains direct descendent nodes of any type (text, element, etc.)"
        RenderBlock {DIV} at (0,70) size 784x90
          RenderBlock {DIV} at (0,0) size 784x18
            RenderInline {B} at (0,0) size 23x18
              RenderText {TEXT} at (0,0) size 23x18
                text run at (0,0) width 23: "test"
            RenderText {TEXT} at (23,0) size 4x18
              text run at (23,0) width 4: " "
            RenderInline {U} at (0,0) size 56x18
              RenderText {TEXT} at (27,0) size 56x18
                text run at (27,0) width 56: "non bold"
            RenderText {TEXT} at (83,0) size 4x18
              text run at (83,0) width 4: " "
            RenderInline {I} at (0,0) size 31x18
              RenderText {TEXT} at (87,0) size 31x18
                text run at (87,0) width 31: "italic"
            RenderText {TEXT} at (118,0) size 25x18
              text run at (118,0) width 25: " test"
          RenderBlock {DIV} at (0,18) size 784x18
            RenderText {TEXT} at (0,0) size 58x18
              text run at (0,0) width 58: "plain text"
          RenderBlock {DIV} at (0,36) size 784x18
            RenderText {TEXT} at (0,0) size 74x18
              text run at (0,0) width 74: "another line"
          RenderBlock {DIV} at (0,54) size 784x18
            RenderText {TEXT} at (0,0) size 97x18
              text run at (0,0) width 97: "yet another line"
          RenderBlock {DIV} at (0,72) size 784x18
            RenderInline {SPAN} at (0,0) size 54x18
              RenderText {TEXT} at (0,0) size 30x18
                text run at (0,0) width 30: "fifth "
              RenderInline {B} at (0,0) size 24x18
                RenderText {TEXT} at (30,0) size 24x18
                  text run at (30,0) width 24: "line"
        RenderBlock {DIV} at (0,160) size 784x360
          RenderBR {BR} at (0,0) size 0x18
          RenderText {TEXT} at (0,18) size 377x18
            text run at (0,18) width 377: "Results: children.length = 5 (should be 5 DIV nodes below)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,36) size 113x18
            text run at (0,36) width 113: "  node: DIV (one)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,54) size 114x18
            text run at (0,54) width 114: "  node: DIV (two)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,72) size 121x18
            text run at (0,72) width 121: "  node: DIV (three)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,90) size 116x18
            text run at (0,90) width 116: "  node: DIV (four)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,108) size 114x18
            text run at (0,108) width 114: "  node: DIV (five)"
          RenderBR {BR} at (0,0) size 0x0
          RenderBR {BR} at (0,126) size 0x18
          RenderText {TEXT} at (0,144) size 327x18
            text run at (0,144) width 327: "childNodes.length = 11 (should be 11 nodes below)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,162) size 155x18
            text run at (0,162) width 155: "  node: #text (undefined)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,180) size 113x18
            text run at (0,180) width 113: "  node: DIV (one)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,198) size 155x18
            text run at (0,198) width 155: "  node: #text (undefined)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,216) size 114x18
            text run at (0,216) width 114: "  node: DIV (two)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,234) size 155x18
            text run at (0,234) width 155: "  node: #text (undefined)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,252) size 121x18
            text run at (0,252) width 121: "  node: DIV (three)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,270) size 155x18
            text run at (0,270) width 155: "  node: #text (undefined)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,288) size 116x18
            text run at (0,288) width 116: "  node: DIV (four)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,306) size 155x18
            text run at (0,306) width 155: "  node: #text (undefined)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,324) size 114x18
            text run at (0,324) width 114: "  node: DIV (five)"
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,342) size 155x18
            text run at (0,342) width 155: "  node: #text (undefined)"
          RenderBR {BR} at (0,0) size 0x0
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/children-nodes.html
  
  Index: children-nodes.html
  ===================================================================
  <html>
  <head>
  <script>
  function doit()
  {
  	var ele = document.getElementById( 'test' );
      var output= document.getElementById( 'output' );
  
  	output.innerHTML += 'children.length = ' + ele.children.length + ' (should be 5 DIV nodes below)<br>';
  
  	for( i = 0; i < ele.children.length; i++ ) {
  		output.innerHTML += '&nbsp;&nbsp;node: ' + ele.children[i].nodeName + ' (' + ele.children[i].id + ')<br>';
  	}
  
  	output.innerHTML += '<br>childNodes.length = ' + ele.childNodes.length + ' (should be 11 nodes below)<br>';
  
  	for( i = 0; i < ele.childNodes.length; i++ ) {
  		output.innerHTML += '&nbsp;&nbsp;node: ' + ele.childNodes[i].nodeName + ' (' + ele.childNodes[i].id + ')<br>';
  	}
  }
  </script>
  </head>
  <body onload="doit()">
  <div style="border: 1px solid red">
  <p>
  This test verifies that JavaScript returns only direct descendent element nodes in the 'children' collection (an IE extension). 
  We also verify that the 'childNodes' collection contains direct descendent nodes of any type (text, element, etc.)
  </p>
  </div>
  <div id="test">
  	<div id="one"><b>test</b> <u>non bold</u> <i>italic</i> test</div>
  	<div id="two">plain text</div>
  	<div id="three">another line</div>
  	<div id="four">yet another line</div>
  	<div id="five"><span>fifth <b>line</b></span></div>
  </div>
  <div id="output">
  <br>Results:
  </div>
  </body>
  </html>
  
  



More information about the webkit-changes mailing list