Title: [247909] trunk
Revision
247909
Author
[email protected]
Date
2019-07-29 11:31:04 -0700 (Mon, 29 Jul 2019)

Log Message

The touch-action property was ignored on replaced elements (canvas, img etc)
https://bugs.webkit.org/show_bug.cgi?id=200205
rdar://problem/53331224

Reviewed by Antti Koivisto.

Source/WebCore:

The event region painting code didn't handle replaced elements correctly,
causing touch-action to get ignored for <canvas>, <img> etc. Fix by handling
region painting in RenderReplaced.

This still doesn't fix <iframe> but I'm not sure what the correct behavior is there
(webkit.org/b/200204).

Test: pointerevents/ios/touch-action-region-replaced-elements.html

* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
(WebCore::RenderReplaced::shouldPaint):

LayoutTests:

* pointerevents/ios/touch-action-region-replaced-elements-expected.txt: Added.
* pointerevents/ios/touch-action-region-replaced-elements.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247908 => 247909)


--- trunk/LayoutTests/ChangeLog	2019-07-29 18:28:04 UTC (rev 247908)
+++ trunk/LayoutTests/ChangeLog	2019-07-29 18:31:04 UTC (rev 247909)
@@ -1,3 +1,14 @@
+2019-07-29  Simon Fraser  <[email protected]>
+
+        The touch-action property was ignored on replaced elements (canvas, img etc)
+        https://bugs.webkit.org/show_bug.cgi?id=200205
+        rdar://problem/53331224
+
+        Reviewed by Antti Koivisto.
+
+        * pointerevents/ios/touch-action-region-replaced-elements-expected.txt: Added.
+        * pointerevents/ios/touch-action-region-replaced-elements.html: Added.
+
 2019-07-29  Tim Horton  <[email protected]>
 
         REGRESSION (r247898): Multiple Layout Tests in http/tests/contentdispositionattachmentsandbox/* are timing out on iOS

Added: trunk/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements-expected.txt (0 => 247909)


--- trunk/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements-expected.txt	2019-07-29 18:31:04 UTC (rev 247909)
@@ -0,0 +1,26 @@
+ 
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (drawsContent 1)
+      (backgroundColor #FFFFFF)
+      (event region
+        (rect (0,0) width=800 height=600)
+        (touch-action
+          (none          
+            (rect (32,21) width=207 height=3)
+            (rect (29,24) width=210 height=107)
+            (rect (32,305) width=207 height=3)
+            (rect (29,308) width=210 height=107)
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements.html (0 => 247909)


--- trunk/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements.html	2019-07-29 18:31:04 UTC (rev 247909)
@@ -0,0 +1,38 @@
+<html>
+<style>
+    .test {
+        width: 300px;
+        margin: 10px;
+        padding: 10px;
+        border: 1px solid black;
+    }
+
+    canvas, iframe, img {
+        width: 200px;
+        height: 100px;
+        border: 5px solid gray;
+        border-top-left-radius: 10px;
+        touch-action: none;
+    }
+</style>
+<script>
+    window._onload_ = function () {
+        if (window.testRunner)
+            testRunner.dumpAsText();
+        if (window.internals)
+            results.innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_EVENT_REGION | internals.LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES);
+    }
+</script>
+<body>
+<div class="test">
+    <canvas></canvas>
+</div>
+<div class="test">
+    <iframe></iframe>
+</div>
+<div class="test">
+    <img>
+</div>
+<pre id="results"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (247908 => 247909)


--- trunk/Source/WebCore/ChangeLog	2019-07-29 18:28:04 UTC (rev 247908)
+++ trunk/Source/WebCore/ChangeLog	2019-07-29 18:31:04 UTC (rev 247909)
@@ -1,3 +1,24 @@
+2019-07-29  Simon Fraser  <[email protected]>
+
+        The touch-action property was ignored on replaced elements (canvas, img etc)
+        https://bugs.webkit.org/show_bug.cgi?id=200205
+        rdar://problem/53331224
+
+        Reviewed by Antti Koivisto.
+
+        The event region painting code didn't handle replaced elements correctly,
+        causing touch-action to get ignored for <canvas>, <img> etc. Fix by handling
+        region painting in RenderReplaced.
+
+        This still doesn't fix <iframe> but I'm not sure what the correct behavior is there
+        (webkit.org/b/200204).
+
+        Test: pointerevents/ios/touch-action-region-replaced-elements.html
+
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::paint):
+        (WebCore::RenderReplaced::shouldPaint):
+
 2019-07-29  Philippe Normand  <[email protected]>
 
         REGRESSION(r243058): [GStreamer] WebKitWebSrc's internal queue can exhaust the WebProcess memory

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (247908 => 247909)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2019-07-29 18:28:04 UTC (rev 247908)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2019-07-29 18:31:04 UTC (rev 247909)
@@ -155,6 +155,17 @@
     if (!shouldPaint(paintInfo, paintOffset))
         return;
 
+    LayoutPoint adjustedPaintOffset = paintOffset + location();
+
+    if (paintInfo.phase == PaintPhase::EventRegion) {
+        if (visibleToHitTesting()) {
+            auto borderRect = LayoutRect(adjustedPaintOffset, size());
+            auto borderRegion = approximateAsRegion(style().getRoundedBorderFor(borderRect));
+            paintInfo.eventRegionContext->unite(borderRegion, style());
+        }
+        return;
+    }
+
 #ifndef NDEBUG
     SetLayoutNeededForbiddenScope scope(this);
 #endif
@@ -169,8 +180,6 @@
         }
     }
 
-    LayoutPoint adjustedPaintOffset = paintOffset + location();
-    
     if (hasVisibleBoxDecorations() && paintInfo.phase == PaintPhase::Foreground)
         paintBoxDecorations(paintInfo, adjustedPaintOffset);
     
@@ -239,7 +248,8 @@
         && paintInfo.phase != PaintPhase::Outline
         && paintInfo.phase != PaintPhase::SelfOutline
         && paintInfo.phase != PaintPhase::Selection
-        && paintInfo.phase != PaintPhase::Mask)
+        && paintInfo.phase != PaintPhase::Mask
+        && paintInfo.phase != PaintPhase::EventRegion)
         return false;
 
     if (!paintInfo.shouldPaintWithinRoot(*this))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to