Title: [97927] trunk
- Revision
- 97927
- Author
- [email protected]
- Date
- 2011-10-19 20:16:29 -0700 (Wed, 19 Oct 2011)
Log Message
CSS Counters have wrong values
https://bugs.webkit.org/show_bug.cgi?id=69605
Reviewed by Darin Adler.
Source/WebCore:
Test: fast/css/counters/after-continuation.html
Added a new method for getting the renderer of the "after"
pseudo-element that handles continuations.
Hooked up the new method with the CSS counter code.
* rendering/RenderCounter.cpp:
(WebCore::rendererOfAfterPseudoElement):
(WebCore::previousInPreOrder):
(WebCore::nextInPreOrder):
* rendering/RenderObject.h:
LayoutTests:
This test highlights the ability of the CSS counter handling code to
find a counter attached to a continuation of a renderer.
* fast/css/counters/after-continuation-expected.txt: Added.
* fast/css/counters/after-continuation.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (97926 => 97927)
--- trunk/LayoutTests/ChangeLog 2011-10-20 02:53:38 UTC (rev 97926)
+++ trunk/LayoutTests/ChangeLog 2011-10-20 03:16:29 UTC (rev 97927)
@@ -1,3 +1,16 @@
+2011-10-19 Carol Szabo <[email protected]>
+
+ CSS Counters have wrong values
+ https://bugs.webkit.org/show_bug.cgi?id=69605
+
+ Reviewed by Darin Adler.
+
+ This test highlights the ability of the CSS counter handling code to
+ find a counter attached to a continuation of a renderer.
+
+ * fast/css/counters/after-continuation-expected.txt: Added.
+ * fast/css/counters/after-continuation.html: Added.
+
2011-10-19 Erik Arvidsson <[email protected]>
Clean up tests to not depend on js-test-style.css
Added: trunk/LayoutTests/fast/css/counters/after-continuation-expected.txt (0 => 97927)
--- trunk/LayoutTests/fast/css/counters/after-continuation-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/counters/after-continuation-expected.txt 2011-10-20 03:16:29 UTC (rev 97927)
@@ -0,0 +1,6 @@
+This test passes if the numbers displayed below are 1 and 2 in this order.
+
+PASS layoutTestController.counterValueForElementById('c2') is '2'
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/counters/after-continuation.html (0 => 97927)
--- trunk/LayoutTests/fast/css/counters/after-continuation.html (rev 0)
+++ trunk/LayoutTests/fast/css/counters/after-continuation.html 2011-10-20 03:16:29 UTC (rev 97927)
@@ -0,0 +1,30 @@
+<html><head>
+ <style>
+ .c0:after { counter-increment:section; content: counter(section); }
+ </style>
+ <script src=""
+ <script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+ function run()
+ {
+ shouldBe("layoutTestController.counterValueForElementById('c2')", "'2'");
+
+ debug('');
+ debug('TEST COMPLETE');
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ </script>
+</head><body _onload_="setTimeout('run()', 0);">
+ <p>This test passes if the numbers displayed below are 1 and 2 in this order.</p>
+ <div>
+ <div style="counter-reset: section;"></div>
+ <div><span id="c1" class=c0><div></div></span></div>
+ <div id="c2" class=c0></div>
+ </div>
+ <div id="console"></div>
+</body></html>
+
Modified: trunk/Source/WebCore/ChangeLog (97926 => 97927)
--- trunk/Source/WebCore/ChangeLog 2011-10-20 02:53:38 UTC (rev 97926)
+++ trunk/Source/WebCore/ChangeLog 2011-10-20 03:16:29 UTC (rev 97927)
@@ -1,3 +1,22 @@
+2011-10-19 Carol Szabo <[email protected]>
+
+ CSS Counters have wrong values
+ https://bugs.webkit.org/show_bug.cgi?id=69605
+
+ Reviewed by Darin Adler.
+
+ Test: fast/css/counters/after-continuation.html
+
+ Added a new method for getting the renderer of the "after"
+ pseudo-element that handles continuations.
+ Hooked up the new method with the CSS counter code.
+
+ * rendering/RenderCounter.cpp:
+ (WebCore::rendererOfAfterPseudoElement):
+ (WebCore::previousInPreOrder):
+ (WebCore::nextInPreOrder):
+ * rendering/RenderObject.h:
+
2011-10-19 Anna Cavender <[email protected]>
Adding some IDL files for <track>.
Modified: trunk/Source/WebCore/rendering/RenderCounter.cpp (97926 => 97927)
--- trunk/Source/WebCore/rendering/RenderCounter.cpp 2011-10-20 02:53:38 UTC (rev 97926)
+++ trunk/Source/WebCore/rendering/RenderCounter.cpp 2011-10-20 03:16:29 UTC (rev 97927)
@@ -51,6 +51,14 @@
return staticCounterMaps;
}
+static RenderObject* rendererOfAfterPseudoElement(RenderObject* renderer)
+{
+ RenderObject* lastContinuation = renderer;
+ while (RenderObject* continuation = lastContinuation->virtualContinuation())
+ lastContinuation = continuation;
+ return lastContinuation->afterPseudoElementRenderer();
+}
+
// This function processes the renderer tree in the order of the DOM tree
// including pseudo elements as defined in CSS 2.1.
// Anonymous renderers are skipped except for those representing pseudo elements.
@@ -77,7 +85,7 @@
}
while (sibling) {
if (RenderObject* renderer = sibling->renderer()) {
- if (RenderObject* after = renderer->afterPseudoElementRenderer())
+ if (RenderObject* after = rendererOfAfterPseudoElement(renderer))
return after;
parent = sibling;
sibling = sibling->lastElementChild();
@@ -189,7 +197,7 @@
return result;
child = child->nextElementSibling();
}
- result = self->renderer()->afterPseudoElementRenderer();
+ result = rendererOfAfterPseudoElement(self->renderer());
if (result)
return result;
nextsibling:
Modified: trunk/Source/WebCore/rendering/RenderObject.h (97926 => 97927)
--- trunk/Source/WebCore/rendering/RenderObject.h 2011-10-20 02:53:38 UTC (rev 97926)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2011-10-20 03:16:29 UTC (rev 97927)
@@ -161,12 +161,17 @@
return children->beforePseudoElementRenderer(this);
return 0;
}
+
+ // This function only returns the renderer of the "after" pseudoElement if it is a child of
+ // this renderer. If "continuations" exist, the function returns 0 even if the element that
+ // generated this renderer has an "after" pseudo-element.
RenderObject* afterPseudoElementRenderer() const
{
if (const RenderObjectChildList* children = virtualChildren())
return children->afterPseudoElementRenderer(this);
return 0;
}
+
virtual RenderObjectChildList* virtualChildren() { return 0; }
virtual const RenderObjectChildList* virtualChildren() const { return 0; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes