Element appears correctly but does not receive event with a large translation.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jan 2015 06:13:45 +0000 (06:13 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jan 2015 06:13:45 +0000 (06:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139815

Reviewed by Simon Fraser.

When the hit point gets translated beyond the min/max value of LayoutRect (infiniteRect()),
we fail to find the corresponding layer.
When there's no clipping on a layer, we use min/max values to represent infiniteness.
However it does not work well across types. With IntPoint(hittest) we can address a point that's outside
of LayoutRect's boundary(clipping).
This patch addresses the immediate issue of not being able to hittest transformed layers properly.
Fixing the representation of infiniteness is tracked here: webkit.org/b/140533
Source/WebCore:

Test: transforms/hittest-translated-content-off-to-infinity-and-back.html

* rendering/ClipRect.cpp:
(WebCore::ClipRect::intersects):

LayoutTests:

* transforms/hittest-translated-content-off-to-infinity-and-back-expected.html: Added.
* transforms/hittest-translated-content-off-to-infinity-and-back.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/transforms/hittest-translated-content-off-to-infinity-and-back-expected.html [new file with mode: 0644]
LayoutTests/transforms/hittest-translated-content-off-to-infinity-and-back.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/ClipRect.cpp

index 0e79625..810d19f 100644 (file)
@@ -1,3 +1,21 @@
+2015-01-15  Zalan Bujtas  <zalan@apple.com>
+
+        Element appears correctly but does not receive event with a large translation.
+        https://bugs.webkit.org/show_bug.cgi?id=139815
+
+        Reviewed by Simon Fraser.
+
+        When the hit point gets translated beyond the min/max value of LayoutRect (infiniteRect()),
+        we fail to find the corresponding layer.
+        When there's no clipping on a layer, we use min/max values to represent infiniteness.
+        However it does not work well across types. With IntPoint(hittest) we can address a point that's outside
+        of LayoutRect's boundary(clipping).
+        This patch addresses the immediate issue of not being able to hittest transformed layers properly. 
+        Fixing the representation of infiniteness is tracked here: webkit.org/b/140533
+        
+        * transforms/hittest-translated-content-off-to-infinity-and-back-expected.html: Added.
+        * transforms/hittest-translated-content-off-to-infinity-and-back.html: Added.
+
 2015-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
 
         tables/mozilla/bugs/bug10633.html is flakey on Yosemite
diff --git a/LayoutTests/transforms/hittest-translated-content-off-to-infinity-and-back-expected.html b/LayoutTests/transforms/hittest-translated-content-off-to-infinity-and-back-expected.html
new file mode 100644 (file)
index 0000000..5e7a041
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head>
+<title>This test that hittest finds the box that is translated beyond min/max layout unit and back.</title>
+<style>
+  div { 
+    position: absolute;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+</style>
+</head>
+<body>
+    <div style="left: 0px; top: 0px;"></div>
+    <div style="left: 100px; top: 100px;"></div>
+</body>
+</html>
diff --git a/LayoutTests/transforms/hittest-translated-content-off-to-infinity-and-back.html b/LayoutTests/transforms/hittest-translated-content-off-to-infinity-and-back.html
new file mode 100644 (file)
index 0000000..93e970a
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<head>
+<title>This test that hittest finds the box that is translated beyond min/max layout unit and back.</title>
+<style>
+  div { 
+    position: absolute;
+    width: 100px;
+    height: 100px;
+    background-color: red;
+    top: 0px;
+    left: 0px;
+  }
+  
+</style>
+</head>
+<body>
+  <div style="-webkit-transform: translate3d(-41946743px, -41946743px, 0px);">
+    <div style="-webkit-transform: translate3d(41946743px, 41946743px, 0px); top: 0px; left: 0px;"></div>
+  </div>
+  <div style="-webkit-transform: translate3d(41946743px, 41946743px, 0px);">
+    <div id=second style="-webkit-transform: translate3d(-41946743px, -41946743px, 0px); top: 100px; left: 100px;"></div>
+  </div>
+  <script>
+       document.elementFromPoint(0, 0).style.backgroundColor = "green";
+       document.elementFromPoint(100, 100).style.backgroundColor = "green";
+  </script>
+</body>
+</html>
index 8f105b0..4c6e6f3 100644 (file)
@@ -1,3 +1,23 @@
+2015-01-15  Zalan Bujtas  <zalan@apple.com>
+
+        Element appears correctly but does not receive event with a large translation.
+        https://bugs.webkit.org/show_bug.cgi?id=139815
+
+        Reviewed by Simon Fraser.
+
+        When the hit point gets translated beyond the min/max value of LayoutRect (infiniteRect()),
+        we fail to find the corresponding layer.
+        When there's no clipping on a layer, we use min/max values to represent infiniteness.
+        However it does not work well across types. With IntPoint(hittest) we can address a point that's outside
+        of LayoutRect's boundary(clipping).
+        This patch addresses the immediate issue of not being able to hittest transformed layers properly. 
+        Fixing the representation of infiniteness is tracked here: webkit.org/b/140533
+
+        Test: transforms/hittest-translated-content-off-to-infinity-and-back.html
+
+        * rendering/ClipRect.cpp:
+        (WebCore::ClipRect::intersects):
+
 2015-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
 
         tables/mozilla/bugs/bug10633.html is flakey on Yosemite
index 65b93a2..b4db563 100644 (file)
@@ -32,6 +32,9 @@ namespace WebCore {
 
 bool ClipRect::intersects(const HitTestLocation& hitTestLocation) const
 {
+    if (isInfinite())
+        return true;
+
     return hitTestLocation.intersects(m_rect);
 }