Title: [248057] branches/safari-608-branch
Revision
248057
Author
[email protected]
Date
2019-07-31 13:56:14 -0700 (Wed, 31 Jul 2019)

Log Message

Cherry-pick r247909. rdar://problem/53764231

    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.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (248056 => 248057)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-07-31 20:56:11 UTC (rev 248056)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-07-31 20:56:14 UTC (rev 248057)
@@ -1,5 +1,49 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r247909. rdar://problem/53764231
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-31  Alan Coon  <[email protected]>
+
         Cherry-pick r247891. rdar://problem/53764053
 
     Expose the aria-label attribute for <video> elements.

Added: branches/safari-608-branch/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements-expected.txt (0 => 248057)


--- branches/safari-608-branch/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements-expected.txt	2019-07-31 20:56:14 UTC (rev 248057)
@@ -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: branches/safari-608-branch/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements.html (0 => 248057)


--- branches/safari-608-branch/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/pointerevents/ios/touch-action-region-replaced-elements.html	2019-07-31 20:56:14 UTC (rev 248057)
@@ -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: branches/safari-608-branch/Source/WebCore/ChangeLog (248056 => 248057)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-31 20:56:11 UTC (rev 248056)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-31 20:56:14 UTC (rev 248057)
@@ -1,5 +1,59 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r247909. rdar://problem/53764231
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-31  Alan Coon  <[email protected]>
+
         Cherry-pick r247891. rdar://problem/53764053
 
     Expose the aria-label attribute for <video> elements.

Modified: branches/safari-608-branch/Source/WebCore/rendering/RenderReplaced.cpp (248056 => 248057)


--- branches/safari-608-branch/Source/WebCore/rendering/RenderReplaced.cpp	2019-07-31 20:56:11 UTC (rev 248056)
+++ branches/safari-608-branch/Source/WebCore/rendering/RenderReplaced.cpp	2019-07-31 20:56:14 UTC (rev 248057)
@@ -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