Title: [91285] trunk
Revision
91285
Author
[email protected]
Date
2011-07-19 12:25:30 -0700 (Tue, 19 Jul 2011)

Log Message

hover then un-hover makes state change
https://bugs.webkit.org/show_bug.cgi?id=56401

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.

Patch by Mihnea Ovidenie <[email protected]> on 2011-07-19
Reviewed by David Hyatt.

Test: fast/dynamic/hover-before-position-after-style-change.html

* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::updateBeforeAfterContent):

LayoutTests:

Patch by Mihnea Ovidenie <[email protected]> on 2011-07-19
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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91284 => 91285)


--- trunk/LayoutTests/ChangeLog	2011-07-19 19:16:28 UTC (rev 91284)
+++ trunk/LayoutTests/ChangeLog	2011-07-19 19:25:30 UTC (rev 91285)
@@ -1,3 +1,13 @@
+2011-07-19  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.
+
 2011-07-19  Gavin Barraclough  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=64677

Added: trunk/LayoutTests/fast/dynamic/hover-before-position-after-style-change-expected.txt (0 => 91285)


--- 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-07-19 19:25:30 UTC (rev 91285)
@@ -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 => 91285)


--- 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-07-19 19:25:30 UTC (rev 91285)
@@ -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>

Modified: trunk/Source/WebCore/ChangeLog (91284 => 91285)


--- trunk/Source/WebCore/ChangeLog	2011-07-19 19:16:28 UTC (rev 91284)
+++ trunk/Source/WebCore/ChangeLog	2011-07-19 19:25:30 UTC (rev 91285)
@@ -1,3 +1,19 @@
+2011-07-19  Mihnea Ovidenie  <[email protected]>
+
+        hover then un-hover makes state change
+        https://bugs.webkit.org/show_bug.cgi?id=56401
+
+        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.
+
+        Reviewed by David Hyatt.
+
+        Test: fast/dynamic/hover-before-position-after-style-change.html
+
+        * rendering/RenderObjectChildList.cpp:
+        (WebCore::RenderObjectChildList::updateBeforeAfterContent):
+
 2011-07-19  Luke Macpherson   <[email protected]>
 
         Implement CSSPropertyWebkitPerspectiveOrigin in CSSStyleApplyProperty.

Modified: trunk/Source/WebCore/rendering/RenderObjectChildList.cpp (91284 => 91285)


--- trunk/Source/WebCore/rendering/RenderObjectChildList.cpp	2011-07-19 19:16:28 UTC (rev 91284)
+++ trunk/Source/WebCore/rendering/RenderObjectChildList.cpp	2011-07-19 19:25:30 UTC (rev 91285)
@@ -410,6 +410,13 @@
     }
     
     RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->firstChild() : 0;
+    if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childrenInline()) {
+        // 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.
+        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

Reply via email to