[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

hamaji at chromium.org hamaji at chromium.org
Thu Oct 29 20:40:48 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 5b0b14eceffebb5e4dae2e5bda694d0ed91116fa
Author: hamaji at chromium.org <hamaji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 7 06:20:02 2009 +0000

    2009-10-07  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Dual lines in css2.1 layout tests do not match:
            https://bugs.webkit.org/show_bug.cgi?id=23262
    
            Now we can put a counter node as the next sibling of a reset node.
            Re-layout the counter content when the count is updated.
    
            Tests: fast/css/counters/t1204-increment-00-c-o.html
                   fast/css/counters/t1204-increment-01-c-o.html
    
            * rendering/CounterNode.cpp:
            (WebCore::CounterNode::recount):
            * rendering/RenderCounter.cpp:
            (WebCore::findPlaceForCounter):
    2009-10-07  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Dual lines in css2.1 layout tests do not match:
            https://bugs.webkit.org/show_bug.cgi?id=23262
    
            Now we can put a counter node as the next sibling of a reset node.
            Re-layout the counter content when the count is updated.
    
            * fast/css/counters/t1204-increment-00-c-o.html: Added.
            * fast/css/counters/t1204-increment-01-c-o.html: Added.
            * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum: Added.
            * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png: Added.
            * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt: Added.
            * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum: Added.
            * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png: Added.
            * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49225 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 995db36..1a36c7a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2009-10-07  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Dual lines in css2.1 layout tests do not match:
+        https://bugs.webkit.org/show_bug.cgi?id=23262
+
+        Now we can put a counter node as the next sibling of a reset node.
+        Re-layout the counter content when the count is updated.
+
+        * fast/css/counters/t1204-increment-00-c-o.html: Added.
+        * fast/css/counters/t1204-increment-01-c-o.html: Added.
+        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum: Added.
+        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png: Added.
+        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt: Added.
+        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum: Added.
+        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png: Added.
+        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt: Added.
+
 2009-10-05  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Gavin Barraclough.
diff --git a/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html b/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html
new file mode 100644
index 0000000..e2cd9a3
--- /dev/null
+++ b/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+  <title>CSS 2.1 Test Suite: dynamic changes to 'counter-increment'</title>
+  <style type="text/css">
+
+  #test, .reset { counter-reset: c; }
+  .increment:before { content: counters(c, ".") "-"; }
+  .increment { counter-increment: c; }
+
+  </style>
+  <script type="text/javascript">
+
+  if (window.layoutTestController)
+      layoutTestController.waitUntilDone();
+
+  function run() {
+      var t = document.getElementById("test");
+      var s = document.createElement("span");
+      s.setAttribute("class", "increment");
+      s.appendChild(document.createTextNode("new-"));
+      t.insertBefore(s, t.childNodes.item(1));
+
+      if (window.layoutTestController)
+          layoutTestController.notifyDone();
+  }
+
+  // We cannot use dumpAsText() because the counters are CSS properties and
+  // they aren't dumped by the function. Let's use render tree...
+  </script>
+ </head>
+
+ <!-- This test checks if the counters work properly when some elements are
+ added/removed *after* the first rendering finishes. If we put the script in
+ <body>, this only checks the results of first rendering and this isn't
+ the purpose of this test. That's why we use timeout for this test. -->
+ <body onload="setTimeout('run()', 0)">
+
+ <p>The following two lines should be the same:</p>
+
+ <div id="test"><span class="increment"></span><span class="increment"></span><span class="increment"></span></div>
+
+ <div id="reference">1-2-new-3-4-</div>
+
+ </body>
+</html>
diff --git a/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html b/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html
new file mode 100644
index 0000000..a05d8d9
--- /dev/null
+++ b/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+  <title>CSS 2.1 Test Suite: dynamic changes to 'counter-increment'</title>
+  <style type="text/css">
+
+  #test, .reset { counter-reset: c; }
+  .increment:before { content: counters(c, ".") "-"; }
+  .increment { counter-increment: c; }
+
+  </style>
+  <script type="text/javascript">
+
+  if (window.layoutTestController)
+      layoutTestController.waitUntilDone();
+
+  function run() {
+      var t = document.getElementById("test");
+      t.removeChild(t.childNodes.item(1));
+
+      if (window.layoutTestController)
+          layoutTestController.notifyDone();
+  }
+
+  // We cannot use dumpAsText() because the counters are CSS properties and
+  // they aren't dumped by the function. Let's use render tree...
+  </script>
+ </head>
+
+ <!-- This test checks if the counters work properly when some elements are
+ added/removed *after* the first rendering finishes. If we put the script in
+ <body>, this only checks the results of first rendering and this isn't
+ the purpose of this test. That's why we use timeout for this test. -->
+ <body onload="setTimeout('run()', 0)">
+
+ <p>The following two lines should be the same:</p>
+
+ <div id="test"><span class="increment"></span><span class="increment">FAIL-</span><span class="increment"></span><span class="increment"></span></div>
+
+ <div id="reference">1-2-3-</div>
+
+ </body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum
new file mode 100644
index 0000000..b0b922a
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum
@@ -0,0 +1 @@
+ec7ee4a896519f9148a52bd4b0513729
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png
new file mode 100644
index 0000000..319ebde
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt
new file mode 100644
index 0000000..1d81a08
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt
@@ -0,0 +1,38 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x94
+  RenderBlock {HTML} at (0,0) size 800x94
+    RenderBody {BODY} at (8,16) size 784x70
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 279x18
+          text run at (0,0) width 279: "The following two lines should be the same:"
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderInline {SPAN} at (0,0) size 13x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (0,0) size 8x18
+              text run at (0,0) width 8: "1"
+            RenderText at (8,0) size 5x18
+              text run at (8,0) width 5: "-"
+        RenderInline {SPAN} at (0,0) size 45x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (13,0) size 8x18
+              text run at (13,0) width 8: "2"
+            RenderText at (21,0) size 5x18
+              text run at (21,0) width 5: "-"
+          RenderText {#text} at (26,0) size 32x18
+            text run at (26,0) width 32: "new-"
+        RenderInline {SPAN} at (0,0) size 13x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (58,0) size 8x18
+              text run at (58,0) width 8: "3"
+            RenderText at (66,0) size 5x18
+              text run at (66,0) width 5: "-"
+        RenderInline {SPAN} at (0,0) size 13x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (71,0) size 8x18
+              text run at (71,0) width 8: "4"
+            RenderText at (79,0) size 5x18
+              text run at (79,0) width 5: "-"
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 84x18
+          text run at (0,0) width 84: "1-2-new-3-4-"
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum
new file mode 100644
index 0000000..170e2e1
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum
@@ -0,0 +1 @@
+487407b6817ccdb167c78e75035f636a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png
new file mode 100644
index 0000000..9f0f4b6
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt
new file mode 100644
index 0000000..bd62a79
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt
@@ -0,0 +1,30 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x94
+  RenderBlock {HTML} at (0,0) size 800x94
+    RenderBody {BODY} at (8,16) size 784x70
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 279x18
+          text run at (0,0) width 279: "The following two lines should be the same:"
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderInline {SPAN} at (0,0) size 13x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (0,0) size 8x18
+              text run at (0,0) width 8: "1"
+            RenderText at (8,0) size 5x18
+              text run at (8,0) width 5: "-"
+        RenderInline {SPAN} at (0,0) size 13x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (13,0) size 8x18
+              text run at (13,0) width 8: "2"
+            RenderText at (21,0) size 5x18
+              text run at (21,0) width 5: "-"
+        RenderInline {SPAN} at (0,0) size 13x18
+          RenderInline (generated) at (0,0) size 13x18
+            RenderCounter at (26,0) size 8x18
+              text run at (26,0) width 8: "3"
+            RenderText at (34,0) size 5x18
+              text run at (34,0) width 5: "-"
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 39x18
+          text run at (0,0) width 39: "1-2-3-"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c7cff71..6b3565e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-10-07  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Dual lines in css2.1 layout tests do not match:
+        https://bugs.webkit.org/show_bug.cgi?id=23262
+
+        Now we can put a counter node as the next sibling of a reset node.
+        Re-layout the counter content when the count is updated.
+
+        Tests: fast/css/counters/t1204-increment-00-c-o.html
+               fast/css/counters/t1204-increment-01-c-o.html
+
+        * rendering/CounterNode.cpp:
+        (WebCore::CounterNode::recount):
+        * rendering/RenderCounter.cpp:
+        (WebCore::findPlaceForCounter):
+
 2009-10-06  Xan Lopez  <xlopez at igalia.com>
 
         Try to fix the GTK+ build.
diff --git a/WebCore/rendering/CounterNode.cpp b/WebCore/rendering/CounterNode.cpp
index 22a11b9..f546abb 100644
--- a/WebCore/rendering/CounterNode.cpp
+++ b/WebCore/rendering/CounterNode.cpp
@@ -63,11 +63,17 @@ void CounterNode::recount()
     for (CounterNode* c = this; c; c = c->m_nextSibling) {
         int oldCount = c->m_countInParent;
         int newCount = c->computeCountInParent();
-        c->m_countInParent = newCount;
         if (oldCount == newCount)
             break;
-        if (c->m_renderer->isCounter())
-            c->m_renderer->setNeedsLayoutAndPrefWidthsRecalc();
+        c->m_countInParent = newCount;
+        // m_renderer contains the parent of the render node
+        // corresponding to a CounterNode. Let's find the counter
+        // child and make this re-layout.
+        for (RenderObject* o = c->m_renderer->firstChild(); o; o = o->nextSibling())
+            if (!o->documentBeingDestroyed() && o->isCounter()) {
+                o->setNeedsLayoutAndPrefWidthsRecalc();
+                break;
+            }
     }
 }
 
diff --git a/WebCore/rendering/RenderCounter.cpp b/WebCore/rendering/RenderCounter.cpp
index 67e5cba..17c6dad 100644
--- a/WebCore/rendering/RenderCounter.cpp
+++ b/WebCore/rendering/RenderCounter.cpp
@@ -143,13 +143,19 @@ static bool findPlaceForCounter(RenderObject* object, const AtomicString& counte
     RenderObject* resetCandidate = isReset ? object->parent() : previousSiblingOrParent(object);
     RenderObject* prevCounterCandidate = object;
     CounterNode* candidateCounter = 0;
+    // When a reset counter is chosen as candidateCounter, we'll
+    // decide the new node should be a child of the reset node or a
+    // sibling or the reset node. This flag controls it.
+    bool createChildForReset = true;
     while ((prevCounterCandidate = prevCounterCandidate->previousInPreOrder())) {
         CounterNode* c = counter(prevCounterCandidate, counterName, false);
         if (prevCounterCandidate == resetCandidate) {
-            if (!candidateCounter)
+            if (!candidateCounter) {
                 candidateCounter = c;
+                createChildForReset = true;
+            }
             if (candidateCounter) {
-                if (candidateCounter->isReset()) {
+                if (createChildForReset && candidateCounter->isReset()) {
                     parent = candidateCounter;
                     previousSibling = 0;
                 } else {
@@ -160,10 +166,19 @@ static bool findPlaceForCounter(RenderObject* object, const AtomicString& counte
             }
             resetCandidate = previousSiblingOrParent(resetCandidate);
         } else if (c) {
-            if (c->isReset())
-                candidateCounter = 0;
-            else if (!candidateCounter)
+            if (c->isReset()) {
+                if (c->parent()) {
+                    // The new node may be the next sibling of this reset node.
+                    createChildForReset = false;
+                    candidateCounter = c;
+                } else {
+                    createChildForReset = true;
+                    candidateCounter = 0;
+                }
+            } else if (!candidateCounter) {
+                createChildForReset = true;
                 candidateCounter = c;
+            }
         }
     }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list