Title: [92200] trunk
- Revision
- 92200
- Author
- [email protected]
- Date
- 2011-08-02 10:08:18 -0700 (Tue, 02 Aug 2011)
Log Message
hover then un-hover makes state change
https://bugs.webkit.org/show_bug.cgi?id=56401
Patch by Mihnea Ovidenie <[email protected]> on 2011-08-02
Reviewed by David Hyatt.
Source/WebCore:
When a 'before' pseudo-element is re-added, we should check whether the insertion point is an anonymous
block with inline children. If it is, then we should change the insertion point to the first child of the
anonymous block, otherwise the 'before' pseudo-element ends up in a different block. We choose the insertion
point to be the first child only if the anonymous block has children, otherwise the before element ends up
in a wrong block.
Tests: fast/dynamic/hover-before-position-after-style-change.html
fast/dynamic/hover-before-position-after-style-change2.html
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::updateBeforeAfterContent):
LayoutTests:
* fast/dynamic/hover-before-position-after-style-change-expected.txt: Added.
* fast/dynamic/hover-before-position-after-style-change.html: Added.
* fast/dynamic/hover-before-position-after-style-change2-expected.txt: Added.
* fast/dynamic/hover-before-position-after-style-change2.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (92199 => 92200)
--- trunk/LayoutTests/ChangeLog 2011-08-02 17:00:28 UTC (rev 92199)
+++ trunk/LayoutTests/ChangeLog 2011-08-02 17:08:18 UTC (rev 92200)
@@ -1,3 +1,15 @@
+2011-08-02 Mihnea Ovidenie <[email protected]>
+
+ hover then un-hover makes state change
+ https://bugs.webkit.org/show_bug.cgi?id=56401
+
+ Reviewed by David Hyatt.
+
+ * fast/dynamic/hover-before-position-after-style-change-expected.txt: Added.
+ * fast/dynamic/hover-before-position-after-style-change.html: Added.
+ * fast/dynamic/hover-before-position-after-style-change2-expected.txt: Added.
+ * fast/dynamic/hover-before-position-after-style-change2.html: Added.
+
2011-07-30 Pavel Podivilov <[email protected]>
Web Inspector: merge FormattedSourceFile into SourceFile.
Added: trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change-expected.txt (0 => 92200)
--- trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change-expected.txt 2011-08-02 17:08:18 UTC (rev 92200)
@@ -0,0 +1,4 @@
+Test for https://bugs.webkit.org/show_bug.cgi?id=56401 Hover the mouse over the "Inline" text. The test passes if "Inline" is not placed on a new line.
+
+PASS
+
Added: trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change.html (0 => 92200)
--- trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change.html 2011-08-02 17:08:18 UTC (rev 92200)
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <style>
+ div { width:100px; height:100px;}
+ div#outsideDiv:before { content:"> "; }
+ div#outsideDiv:hover:before { content:"< "; }
+ </style>
+ <p>
+ Test for <a href=""
+ Hover the mouse over the "Inline" text. The test passes if "Inline" is not placed on a new line.
+ </p>
+ </head>
+ <body>
+ <div id="console"></div>
+ <div id="outsideDiv" _onmouseover_="checkTestResult()">
+ <span>Inline</span>
+ <div id="insideDiv">Block</p>
+ </div>
+ <script>
+ function getElementTop(elementId)
+ {
+ var elem = document.getElementById(elementId);
+ return elem.getBoundingClientRect().top;
+ }
+
+ function simulateMouseMove()
+ {
+ var outsideDivTop = getElementTop("outsideDiv");
+ if (window.eventSender)
+ eventSender.mouseMoveTo(50, outsideDivTop);
+ }
+
+ function checkTestResult()
+ {
+ var outsideDivTop = getElementTop("outsideDiv");
+ var insideDivTop = getElementTop("insideDiv");
+ document.getElementById("console").innerText = (insideDivOriginalTop != insideDivTop) ? "FAIL" : "PASS";
+ if (window.layoutTestController)
+ document.getElementById("outsideDiv").style.visibility = 'hidden';
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ document.body.offsetTop;
+ // Capture the initial values for inside div top
+ var insideDivOriginalTop = getElementTop("insideDiv");
+
+ if (window.layoutTestController) {
+ simulateMouseMove();
+ checkTestResult();
+ }
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change2-expected.txt (0 => 92200)
--- trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change2-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change2-expected.txt 2011-08-02 17:08:18 UTC (rev 92200)
@@ -0,0 +1,4 @@
+Test for https://bugs.webkit.org/show_bug.cgi?id=56401 Hover the mouse over the "Block" text. The test passes if the "Block" text is not moved above ">". This test ensures that the "before" element after hover is inserted in the same position.
+
+PASS
+
Added: trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change2.html (0 => 92200)
--- trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change2.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change2.html 2011-08-02 17:08:18 UTC (rev 92200)
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <style>
+ div { width:100px; height:100px;}
+ div#outsideDiv:before { content:"> "; }
+ div#outsideDiv:hover:before { display: block; content:"< "; }
+ </style>
+ <p>
+ Test for <a href=""
+ Hover the mouse over the "Block" text. The test passes if the "Block" text is not moved above ">". This test ensures
+ that the "before" element after hover is inserted in the same position.
+ </p>
+ </head>
+ <body>
+ <div id="console"></div>
+ <div id="outsideDiv" _onmouseover_="checkTestResult()"><span id="span">Inline</span><div id="insideDiv">Block</p></div>
+ <script>
+ function getElementTop(elementId)
+ {
+ var elem = document.getElementById(elementId);
+ return elem.getBoundingClientRect().top;
+ }
+
+ function simulateMouseMove()
+ {
+ var outsideDivTop = getElementTop("outsideDiv");
+ if (window.eventSender)
+ eventSender.mouseMoveTo(50, outsideDivTop);
+ }
+
+ function checkTestResult()
+ {
+ var outsideDivTop = getElementTop("outsideDiv");
+ var insideDivTop = getElementTop("insideDiv");
+ document.getElementById("console").innerText = (insideDivOriginalTop != insideDivTop) ? "FAIL" : "PASS";
+ if (window.layoutTestController)
+ document.getElementById("outsideDiv").style.visibility = 'hidden';
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ document.body.offsetTop;
+ // Capture the initial values for inside div top
+ var insideDivOriginalTop = getElementTop("insideDiv");
+
+ // Remove the span so that the "before" element is the only remaining child of the anonymous block
+ // that initially contained "before" and span.
+ var span = document.getElementById("span");
+ var outsideDiv = document.getElementById("outsideDiv");
+ outsideDiv.removeChild(span);
+
+ if (window.layoutTestController) {
+ simulateMouseMove();
+ checkTestResult();
+ }
+ </script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (92199 => 92200)
--- trunk/Source/WebCore/ChangeLog 2011-08-02 17:00:28 UTC (rev 92199)
+++ trunk/Source/WebCore/ChangeLog 2011-08-02 17:08:18 UTC (rev 92200)
@@ -1,3 +1,22 @@
+2011-08-02 Mihnea Ovidenie <[email protected]>
+
+ hover then un-hover makes state change
+ https://bugs.webkit.org/show_bug.cgi?id=56401
+
+ Reviewed by David Hyatt.
+
+ When a 'before' pseudo-element is re-added, we should check whether the insertion point is an anonymous
+ block with inline children. If it is, then we should change the insertion point to the first child of the
+ anonymous block, otherwise the 'before' pseudo-element ends up in a different block. We choose the insertion
+ point to be the first child only if the anonymous block has children, otherwise the before element ends up
+ in a wrong block.
+
+ Tests: fast/dynamic/hover-before-position-after-style-change.html
+ fast/dynamic/hover-before-position-after-style-change2.html
+
+ * rendering/RenderObjectChildList.cpp:
+ (WebCore::RenderObjectChildList::updateBeforeAfterContent):
+
2011-08-02 Andreas Kling <[email protected]>
[Qt] Simplify Path::translate() implementation.
Modified: trunk/Source/WebCore/rendering/RenderObjectChildList.cpp (92199 => 92200)
--- trunk/Source/WebCore/rendering/RenderObjectChildList.cpp 2011-08-02 17:00:28 UTC (rev 92199)
+++ trunk/Source/WebCore/rendering/RenderObjectChildList.cpp 2011-08-02 17:08:18 UTC (rev 92200)
@@ -410,6 +410,14 @@
}
RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->firstChild() : 0;
+ if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childrenInline() && !insertBefore->isEmpty()) {
+ // We are going to add the "before" element. We have to check whether the "insertBefore" element
+ // is an anonymous block with inline children. If it is, then we should insert the "before" element
+ // before the first inline child of the anonymous block, otherwise we will end up with the "before"
+ // element in a different block. We do this only when the anonymous block has children, otherwise
+ // we end up with the before element in a wrong block.
+ insertBefore = insertBefore->firstChild();
+ }
// Generated content consists of a single container that houses multiple children (specified
// by the content property). This generated content container gets the pseudo-element style set on it.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes