Amazon.com Additional Information links aren't clickable
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Dec 2015 02:53:25 +0000 (02:53 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Dec 2015 02:53:25 +0000 (02:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151401
<rdar://problem/23454261>

Reviewed by Darin Adler.

Source/WebCore:

The cause of this issue is that the painting order is different from the hittest order so we can end up
with visible but unreachable content. To fix this, the executation flow of hittest has been reordered.
According to the paint system, which renders the webpage from the bottom RenderLayer to the top, contents
are rendered before floats. Hence, for the hittest, which determines the hitted location from top RenderLayer
to the bottom, should do it reversedly. Now, hittest will first test floats then contents.

Test: fast/block/float/hit-test-on-overlapping-floats.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeAtPoint):

LayoutTests:

* fast/block/float/hit-test-on-overlapping-floats-expected.txt: Added.
* fast/block/float/hit-test-on-overlapping-floats.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192854 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/block/float/hit-test-on-overlapping-floats-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/float/hit-test-on-overlapping-floats.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp

index 16bcbb9845c4a9068ba913634a20ef0248f2bcb9..4e4c176aa0c887b546d13b83d2a80dbd25b3963f 100644 (file)
@@ -1,3 +1,14 @@
+2015-11-30  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Amazon.com Additional Information links aren't clickable
+        https://bugs.webkit.org/show_bug.cgi?id=151401
+        <rdar://problem/23454261>
+
+        Reviewed by Darin Adler.
+
+        * fast/block/float/hit-test-on-overlapping-floats-expected.txt: Added.
+        * fast/block/float/hit-test-on-overlapping-floats.html: Added.
+
 2015-11-30  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: Iterating index cursors to a specific key is busted.
diff --git a/LayoutTests/fast/block/float/hit-test-on-overlapping-floats-expected.txt b/LayoutTests/fast/block/float/hit-test-on-overlapping-floats-expected.txt
new file mode 100644 (file)
index 0000000..76d564d
--- /dev/null
@@ -0,0 +1,6 @@
+PASS document.elementFromPoint(450, 10) is document.getElementById('rightc')
+PASS successfullyParsed is true
+
+TEST COMPLETE
+foobar
+
diff --git a/LayoutTests/fast/block/float/hit-test-on-overlapping-floats.html b/LayoutTests/fast/block/float/hit-test-on-overlapping-floats.html
new file mode 100644 (file)
index 0000000..f335b2b
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+        #leftc {
+            float: left;
+            width: 500px;
+            background-color: silver;
+            margin-right: -100px;
+        }
+
+        #rightc {
+            float: right;
+            width: 400px;
+            background-color: rgba(0, 128, 0, 0.75);
+            padding-bottom: 1px;
+        }
+        </style>
+    </head>
+    <body>
+        <div style="width:800px">
+            <div id="leftc">foo</div>
+            <div id="rightc">bar</div>
+            <div style="height:0px; width:0px; clear:left;"></div>
+        </div>
+        <script src="../../../resources/js-test-pre.js"></script>
+        <script>
+        shouldBe("document.elementFromPoint(450, 10)", "document.getElementById('rightc')");
+        </script>
+        <script src="../../../resources/js-test-post.js"></script>
+       </body>
+</html>
index e5c4534ea1eedbefaf0b31450d84080cf6f96e43..a755089cbba25681e8aa8b933dba4ee2c292bea6 100644 (file)
@@ -1,3 +1,22 @@
+2015-11-30  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Amazon.com Additional Information links aren't clickable
+        https://bugs.webkit.org/show_bug.cgi?id=151401
+        <rdar://problem/23454261>
+
+        Reviewed by Darin Adler.
+
+        The cause of this issue is that the painting order is different from the hittest order so we can end up
+        with visible but unreachable content. To fix this, the executation flow of hittest has been reordered.
+        According to the paint system, which renders the webpage from the bottom RenderLayer to the top, contents
+        are rendered before floats. Hence, for the hittest, which determines the hitted location from top RenderLayer
+        to the bottom, should do it reversedly. Now, hittest will first test floats then contents.
+
+        Test: fast/block/float/hit-test-on-overlapping-floats.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::nodeAtPoint):
+
 2015-11-30  Simon Fraser  <simon.fraser@apple.com>
 
         Fix possible crash with animated layers in reflections
index c61cc8b67d32eb3f246cbf5f10ca9c976ff8d720..05cd850e6965c62a2432d61ef82df8214e7963ec 100644 (file)
@@ -2474,12 +2474,12 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
         // Hit test descendants first.
         LayoutSize scrolledOffset(localOffset - scrolledContentOffset());
 
+        if (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, toLayoutPoint(scrolledOffset)))
+            return true;
         if (hitTestContents(request, result, locationInContainer, toLayoutPoint(scrolledOffset), hitTestAction)) {
             updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - localOffset));
             return true;
         }
-        if (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, toLayoutPoint(scrolledOffset)))
-            return true;
     }
 
     // Check if the point is outside radii.