[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

eric at webkit.org eric at webkit.org
Thu Feb 4 21:20:46 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 4deeabdeb15cc1bdaf67ac4b69515df3b6f2b5c4
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 20 00:09:18 2010 +0000

    2010-01-19  Carol Szabo  <carol.szabo at nokia.com>
    
            Reviewed by Darin Adler.
    
            Another crazy counters bug
            https://bugs.webkit.org/show_bug.cgi?id=11031
            Added tests for dynamic DOM changes affecting counters.
    
            * fast/css/counters/counter-increment-002.html: Added.
            * fast/css/counters/counter-reset-000.html: Added.
            * fast/css/counters/counter-reset-002.html: Added.
            * fast/css/counters/counter-increment-002-expected.txt: Added.
            * fast/css/counters/counter-reset-000-expected.txt: Added.
            * fast/css/counters/counter-reset-002-expected.txt: Added.
    2010-01-19  Carol Szabo  <carol.szabo at nokia.com>
    
            Reviewed by Darin Adler.
    
            Another crazy counters bug
            https://bugs.webkit.org/show_bug.cgi?id=11031
    
            This patch actually provides for counter updating when the style
            of a renderer changes.
    
            Tests: fast/css/counters/counter-increment-002.html
                   fast/css/counters/counter-reset-000.html
                   fast/css/counters/counter-reset-002.html
    
            * rendering/RenderCounter.cpp:
            (WebCore::RenderCounter::rendererStyleChanged):
            This function is added to update the counter hierarchy in
            response to changes to the style of a renderer.
            * rendering/RenderCounter.h:
            * rendering/RenderObject.cpp:
            (WebCore::RenderObject::styleDidChange):
            For changes that may include the counter directives added a
            call to RenderCounter::rendererStyleChanged.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53506 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index daa87df..f219086 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-19  Carol Szabo  <carol.szabo at nokia.com>
+
+        Reviewed by Darin Adler.
+
+        Another crazy counters bug
+        https://bugs.webkit.org/show_bug.cgi?id=11031
+        Added tests for dynamic DOM changes affecting counters.
+
+        * fast/css/counters/counter-increment-002.html: Added.
+        * fast/css/counters/counter-reset-000.html: Added.
+        * fast/css/counters/counter-reset-002.html: Added.
+        * fast/css/counters/counter-increment-002-expected.txt: Added.
+        * fast/css/counters/counter-reset-000-expected.txt: Added.
+        * fast/css/counters/counter-reset-002-expected.txt: Added.
+
 2010-01-19  Alexey Proskuryakov  <ap at apple.com>
 
         Land correct expected results - forgot to update them after changing test output.
diff --git a/LayoutTests/fast/css/counters/counter-increment-002-expected.txt b/LayoutTests/fast/css/counters/counter-increment-002-expected.txt
new file mode 100644
index 0000000..f2a3c60
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-increment-002-expected.txt
@@ -0,0 +1,4 @@
+The following two lines should have the same content:
+
+0.1-0.2-1-2-
+0.1-0.2-1-2-
diff --git a/LayoutTests/fast/css/counters/counter-increment-002.html b/LayoutTests/fast/css/counters/counter-increment-002.html
new file mode 100644
index 0000000..e83d54c
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-increment-002.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html><head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>CSS Test: dynamic changes to 'counter-increment'</title>
+    <link rel="author" href="http://dbaron.org/" title="L. David Baron">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
+    <meta content="dom" name="flags">
+    <meta http-equiv="Content-Style-Type" content="text/css">
+    <meta http-equiv="Content-Script-Type" content="text/javascript">
+    <style type="text/css">
+        body { white-space: nowrap; }
+        #test, .reset { counter-reset: c; }
+        .increment:before, .use:before { content: counters(c, ".") "-"; }
+        .increment { counter-increment: c; }
+    </style>
+    <script type="text/javascript">
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText();
+            layoutTestController.waitUntilDone();
+        }
+
+        function run() {
+            document.getElementById("one").removeAttribute("class");
+            document.getElementById("two").setAttribute("class", "increment");
+            document.getElementById("three").setAttribute("style", "counter-increment: c");
+            if (window.layoutTestController) {
+                testElement = document.getElementById("test");
+                console = document.getElementById("console");
+                spanList = testElement.getElementsByTagName("span")
+                for (i = 0; i < spanList.length; ++i ) {
+                    newSpanElement = document.createElement("span");
+                    newSpanElement.innerText =
+                    layoutTestController.counterValueForElementById(spanList.item(i).getAttribute("id"));
+                    if (newSpanElement.innerText.length)
+                        newSpanElement.innerText = newSpanElement.innerText + "-";
+                    console.appendChild(newSpanElement);
+                }
+                layoutTestController.notifyDone();
+            }
+        }
+    </script>
+</head><body onload="setTimeout('run()', 0)">
+    <p>The following two lines should have the same content:</p>
+    <div id="test"><span id="one"></span><span id="parent"><span id="reset" class="reset"><span id="resetchild" class="increment"></span><span class="increment" id="two"></span></span></span><span style="counter-increment: c;" class="use" id="three"></span><span id="upperincrement" class="increment"></span></div>
+    <div id="reference">0.1-0.2-1-2-</div>
+    <hr>
+    <div id="console"></div>
+</body></html>
diff --git a/LayoutTests/fast/css/counters/counter-reset-000-expected.txt b/LayoutTests/fast/css/counters/counter-reset-000-expected.txt
new file mode 100644
index 0000000..0b07441
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-reset-000-expected.txt
@@ -0,0 +1,4 @@
+The following two lines should be the same:
+
+1-1.1-1.2-
+1-1.1-1.2-
diff --git a/LayoutTests/fast/css/counters/counter-reset-000.html b/LayoutTests/fast/css/counters/counter-reset-000.html
new file mode 100644
index 0000000..d875a30
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-reset-000.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html><head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>CSS Test: dynamic changes to 'counter-increment'</title>
+    <link rel="author" href="http://dbaron.org/" title="L. David Baron">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
+    <meta content="dom" name="flags">
+    <meta http-equiv="Content-Script-Type" content="text/javascript">
+    <style type="text/css">
+        body { white-space: nowrap; }
+        #test, .reset { counter-reset: c; }
+        .increment:before { content: counters(c, ".") "-"; }
+        .increment { counter-increment: c; }
+    </style>
+    <script type="text/javascript">
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText();   
+            layoutTestController.waitUntilDone();
+        }
+
+        function run() {
+            var t = document.getElementById("test");
+            var s = document.createElement("span");
+            s.setAttribute("class", "reset");
+            s.setAttribute("id", "newSpan");
+            t.insertBefore(s, t.childNodes.item(1));
+            if (window.layoutTestController) {
+                testElement = document.getElementById("test");
+                console = document.getElementById("console");
+                spanList = testElement.getElementsByTagName("span")
+                for (i = 0; i < spanList.length; ++i ) {
+                    newSpanElement = document.createElement("span");
+                    newSpanElement.innerText =
+                    layoutTestController.counterValueForElementById(spanList.item(i).getAttribute("id"));
+                    if (newSpanElement.innerText.length)
+                        newSpanElement.innerText = newSpanElement.innerText + "-"
+                    console.appendChild(newSpanElement);
+                }
+                layoutTestController.notifyDone();
+            }
+          }
+    </script>
+</head><body onload="setTimeout('run()', 0)">
+    <p>The following two lines should be the same:</p>
+    <div id="test"><span id="span1" class="increment"></span><span id="span2" class="reset"></span><span id="span3" class="increment"></span><span id="span4" class="increment"></span></div>
+    <div id="reference">1-1.1-1.2-</div>
+    <hr>
+    <div id="console"/>
+</body></html>
diff --git a/LayoutTests/fast/css/counters/counter-reset-002-expected.txt b/LayoutTests/fast/css/counters/counter-reset-002-expected.txt
new file mode 100644
index 0000000..3e2072e
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-reset-002-expected.txt
@@ -0,0 +1,4 @@
+The following two lines should be the same:
+
+1-1.1-2-3-4-
+1-1.1-2-3-4-
diff --git a/LayoutTests/fast/css/counters/counter-reset-002.html b/LayoutTests/fast/css/counters/counter-reset-002.html
new file mode 100644
index 0000000..b7ca3f4
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-reset-002.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html><head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>CSS Test: dynamic changes to 'counter-increment'</title>
+    <link rel="author" href="http://dbaron.org/" title="L. David Baron">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
+    <meta content="dom" name="flags">
+    <meta http-equiv="Content-Script-Type" content="text/javascript">
+    <style type="text/css">
+        body { white-space: nowrap; }
+        #test, .reset { counter-reset: c; }
+        .increment:before { content: counters(c, ".") "-"; }
+        .increment { counter-increment: c; }
+    </style>
+    <script type="text/javascript">
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText();   
+            layoutTestController.waitUntilDone();
+        }
+
+        function run() {
+            document.getElementById("one").setAttribute("class", "reset");
+            document.getElementById("two").removeAttribute("class");
+            if (window.layoutTestController) {
+                testElement = document.getElementById("test");
+                console = document.getElementById("console");
+                spanList = testElement.getElementsByTagName("span")
+                for (i = 0; i < spanList.length; ++i ) {
+                    newSpanElement = document.createElement("span");
+                    newSpanElement.innerText =
+                    layoutTestController.counterValueForElementById(spanList.item(i).getAttribute("id"));
+                    if (newSpanElement.innerText.length)
+                        newSpanElement.innerText = newSpanElement.innerText + "-";
+                    console.appendChild(newSpanElement);
+                }
+                layoutTestController.notifyDone();
+            }
+        }
+    </script>
+</head><body onload="setTimeout('run()', 0)">
+    <p>The following two lines should be the same:</p>
+    <div id="test"><span id="span1" class="increment"></span><span id="span2"><span class="reset" id="one"><span id="span4" class="increment"></span></span></span><span id="span5" class="increment"></span><span id="span6"><span id="two"><span id="span7"  class="increment"></span></span></span><span id="span8" class="increment"></span></div>
+    <div id="reference">1-1.1-2-3-4-</div>
+    <div id="console" />
+</body></html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9230907..de96a9b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-01-19  Carol Szabo  <carol.szabo at nokia.com>
+
+        Reviewed by Darin Adler.
+
+        Another crazy counters bug
+        https://bugs.webkit.org/show_bug.cgi?id=11031
+
+        This patch actually provides for counter updating when the style
+        of a renderer changes.
+
+        Tests: fast/css/counters/counter-increment-002.html
+               fast/css/counters/counter-reset-000.html
+               fast/css/counters/counter-reset-002.html
+
+        * rendering/RenderCounter.cpp:
+        (WebCore::RenderCounter::rendererStyleChanged):
+        This function is added to update the counter hierarchy in 
+        response to changes to the style of a renderer.
+        * rendering/RenderCounter.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::styleDidChange):
+        For changes that may include the counter directives added a
+        call to RenderCounter::rendererStyleChanged.
+
 2010-01-19  Gustavo Noronha Silva  <gns at gnome.org>
 
         Unreviewed. Build fixes for make distcheck - missing files.
diff --git a/WebCore/rendering/RenderCounter.cpp b/WebCore/rendering/RenderCounter.cpp
index ebf5314..46bf9f4 100644
--- a/WebCore/rendering/RenderCounter.cpp
+++ b/WebCore/rendering/RenderCounter.cpp
@@ -440,4 +440,44 @@ void RenderCounter::rendererSubtreeAttached(RenderObject* renderer)
         updateCounters(descendant);
 }
 
+void RenderCounter::rendererStyleChanged(RenderObject* renderer, const RenderStyle* oldStyle, const RenderStyle* newStyle)
+{
+    const CounterDirectiveMap* newCounterDirectives;
+    const CounterDirectiveMap* oldCounterDirectives;
+    if (oldStyle && (oldCounterDirectives = oldStyle->counterDirectives())) {
+        if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) {
+            CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end();
+            CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives->end();
+            for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) {
+                CounterDirectiveMap::const_iterator oldMapIt = oldCounterDirectives->find(it->first);
+                if (oldMapIt != oldMapEnd) {
+                    if (oldMapIt->second == it->second)
+                        continue;
+                    RenderCounter::destroyCounterNode(renderer, it->first.get());
+                }
+                // We must create this node here, because the changed node may be a node with no display such as
+                // as those created by the increment or reset directives and the re-layout that will happen will
+                // not catch the change if the node had no children.
+                makeCounterNode(renderer, it->first.get(), false);
+            }
+            // Destroying old counters that do not exist in the new counterDirective map.
+            for (CounterDirectiveMap::const_iterator it = oldCounterDirectives->begin(); it !=oldMapEnd; ++it) {
+                if (!newCounterDirectives->contains(it->first))
+                    RenderCounter::destroyCounterNode(renderer, it->first.get());
+            }
+        } else {
+            if (renderer->m_hasCounterNodeMap)
+                RenderCounter::destroyCounterNodes(renderer);
+        }
+    } else if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) {
+        CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end();
+        for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) {
+            // We must create this node here, because the added node may be a node with no display such as
+            // as those created by the increment or reset directives and the re-layout that will happen will
+            // not catch the change if the node had no children.
+            makeCounterNode(renderer, it->first.get(), false);
+        }
+    }
+}
+
 } // namespace WebCore
diff --git a/WebCore/rendering/RenderCounter.h b/WebCore/rendering/RenderCounter.h
index dec4425..10ba1dc 100644
--- a/WebCore/rendering/RenderCounter.h
+++ b/WebCore/rendering/RenderCounter.h
@@ -42,6 +42,7 @@ public:
     static void destroyCounterNodes(RenderObject*);
     static void destroyCounterNode(RenderObject*, const AtomicString& identifier);
     static void rendererSubtreeAttached(RenderObject*);
+    static void rendererStyleChanged(RenderObject*, const RenderStyle* oldStyle, const RenderStyle* newStyle);
 
 private:
     virtual const char* renderName() const;
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index 4828a26..5ddb882 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -1673,7 +1673,7 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS
     }
 }
 
-void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*)
+void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     if (s_affectsParentBlock)
         handleDynamicFloatPositionChange();
@@ -1681,9 +1681,10 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*)
     if (!m_parent)
         return;
     
-    if (diff == StyleDifferenceLayout)
+    if (diff == StyleDifferenceLayout) {
+        RenderCounter::rendererStyleChanged(this, oldStyle, m_style.get());
         setNeedsLayoutAndPrefWidthsRecalc();
-    else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
+    } else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
         setNeedsPositionedMovementLayout();
 
     // Don't check for repaint here; we need to wait until the layer has been

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list