Title: [152907] trunk
Revision
152907
Author
[email protected]
Date
2013-07-19 10:47:36 -0700 (Fri, 19 Jul 2013)

Log Message

Hover doesn't work for block elements inside a href element
https://bugs.webkit.org/show_bug.cgi?id=118907

Patch by Radu Stavila <[email protected]> on 2013-07-19
Reviewed by David Hyatt.

Source/WebCore:

Added test for hovering block elements inside a href element.

Test: fast/css/hover-display-block.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::hoverAncestor):

LayoutTests:

Don't skip all anonymous objects when searching for the hover ancestor, only the ones
directly flowed into a region.

* fast/css/hover-display-block-expected.txt: Added.
* fast/css/hover-display-block.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152906 => 152907)


--- trunk/LayoutTests/ChangeLog	2013-07-19 17:46:08 UTC (rev 152906)
+++ trunk/LayoutTests/ChangeLog	2013-07-19 17:47:36 UTC (rev 152907)
@@ -1,3 +1,16 @@
+2013-07-19  Radu Stavila  <[email protected]>
+
+        Hover doesn't work for block elements inside a href element
+        https://bugs.webkit.org/show_bug.cgi?id=118907
+
+        Reviewed by David Hyatt.
+
+        Don't skip all anonymous objects when searching for the hover ancestor, only the ones
+        directly flowed into a region.
+
+        * fast/css/hover-display-block-expected.txt: Added.
+        * fast/css/hover-display-block.html: Added.
+
 2013-07-19  Zoltan Horvath  <[email protected]>
 
         [CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox

Added: trunk/LayoutTests/fast/css/hover-display-block-expected.txt (0 => 152907)


--- trunk/LayoutTests/fast/css/hover-display-block-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/hover-display-block-expected.txt	2013-07-19 17:47:36 UTC (rev 152907)
@@ -0,0 +1,10 @@
+Hover should work for :display block elements
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(test, null).color is "rgb(0, 255, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/hover-display-block.html (0 => 152907)


--- trunk/LayoutTests/fast/css/hover-display-block.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/hover-display-block.html	2013-07-19 17:47:36 UTC (rev 152907)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+  #test {
+    font: "ahem";
+    font-size: 50px;
+    display: block;
+    color: red;
+  }
+  a:hover #test {
+    color: rgb(0, 255, 0);
+  }
+  </style>
+</head>
+<body>
+  <div id="container">
+  <a href=""
+    <span id="test">This text should be green when hovered.</span>
+  </a>
+</div>
+</body>
+
+<script src=""
+<script>
+  if (window.testRunner) {
+    description("Hover should work for :display block elements")
+    var test = document.getElementById('test');
+    var container = document.getElementById('container');
+    test.offsetTop;
+    eventSender.mouseMoveTo(50, container.offsetTop + 25)
+    test.offsetTop;
+    shouldBeEqualToString("getComputedStyle(test, null).color", 'rgb(0, 255, 0)')
+    container.parentNode.removeChild(container); // clean up after ourselves.
+  }
+  successfullyParsed = true;
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (152906 => 152907)


--- trunk/Source/WebCore/ChangeLog	2013-07-19 17:46:08 UTC (rev 152906)
+++ trunk/Source/WebCore/ChangeLog	2013-07-19 17:47:36 UTC (rev 152907)
@@ -1,3 +1,17 @@
+2013-07-19  Radu Stavila  <[email protected]>
+
+        Hover doesn't work for block elements inside a href element
+        https://bugs.webkit.org/show_bug.cgi?id=118907
+
+        Reviewed by David Hyatt.
+
+        Added test for hovering block elements inside a href element.
+
+        Test: fast/css/hover-display-block.html
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::hoverAncestor):
+
 2013-07-19  Zoltan Horvath  <[email protected]>
 
         [CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (152906 => 152907)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2013-07-19 17:46:08 UTC (rev 152906)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2013-07-19 17:47:36 UTC (rev 152907)
@@ -3050,10 +3050,9 @@
     // See https://bugs.webkit.org/show_bug.cgi?id=111749
     RenderObject* hoverAncestor = parent();
     
-    // Skip anonymous blocks. There's no point in treating them as hover ancestors
-    // and it would also prevent us from continuing the search on the DOM tree
-    // when reaching the named flow thread.
-    if (hoverAncestor && hoverAncestor->isAnonymousBlock())
+    // Skip anonymous blocks directly flowed into flow threads as it would
+    // prevent us from continuing the search on the DOM tree when reaching the named flow thread.
+    if (hoverAncestor && hoverAncestor->isAnonymousBlock() && hoverAncestor->parent() && hoverAncestor->parent()->isRenderNamedFlowThread())
         hoverAncestor = hoverAncestor->parent();
 
     if (hoverAncestor && hoverAncestor->isRenderNamedFlowThread()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to