Title: [249536] trunk
Revision
249536
Author
[email protected]
Date
2019-09-05 11:03:17 -0700 (Thu, 05 Sep 2019)

Log Message

Generate event region for both the main graphics layer and the scrolled contents layer
https://bugs.webkit.org/show_bug.cgi?id=201487

Reviewed by Simon Fraser.

Source/WebCore:

We currently generate region for one of them only. With borders both need it.

Also share more code with painting paths.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateEventRegion):

Generate region for both layers.

(WebCore::RenderLayerBacking::paintIntoLayer):

Add event region context parameter so we can use this function for event region update too.

* rendering/RenderLayerBacking.h:

LayoutTests:

* pointerevents/ios/touch-action-region-backing-sharing-expected.txt:
* pointerevents/ios/touch-action-region-overflow-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (249535 => 249536)


--- trunk/LayoutTests/ChangeLog	2019-09-05 17:44:38 UTC (rev 249535)
+++ trunk/LayoutTests/ChangeLog	2019-09-05 18:03:17 UTC (rev 249536)
@@ -1,3 +1,13 @@
+2019-09-05  Antti Koivisto  <[email protected]>
+
+        Generate event region for both the main graphics layer and the scrolled contents layer
+        https://bugs.webkit.org/show_bug.cgi?id=201487
+
+        Reviewed by Simon Fraser.
+
+        * pointerevents/ios/touch-action-region-backing-sharing-expected.txt:
+        * pointerevents/ios/touch-action-region-overflow-expected.txt:
+
 2019-09-05  Ryosuke Niwa  <[email protected]>
 
         REGRESSION (iOS 13): Bulleted list copied from Notes to Mail results in Times New Roman

Modified: trunk/LayoutTests/pointerevents/ios/touch-action-region-backing-sharing-expected.txt (249535 => 249536)


--- trunk/LayoutTests/pointerevents/ios/touch-action-region-backing-sharing-expected.txt	2019-09-05 17:44:38 UTC (rev 249535)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-backing-sharing-expected.txt	2019-09-05 18:03:17 UTC (rev 249536)
@@ -12,6 +12,9 @@
         (GraphicsLayer
           (position 8.00 13.00)
           (bounds 200.00 200.00)
+          (event region
+            (rect (0,0) width=500 height=500)
+          )
           (children 1
             (GraphicsLayer
               (bounds 200.00 200.00)

Modified: trunk/LayoutTests/pointerevents/ios/touch-action-region-overflow-expected.txt (249535 => 249536)


--- trunk/LayoutTests/pointerevents/ios/touch-action-region-overflow-expected.txt	2019-09-05 17:44:38 UTC (rev 249535)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-overflow-expected.txt	2019-09-05 18:03:17 UTC (rev 249536)
@@ -12,6 +12,9 @@
         (GraphicsLayer
           (position 8.00 8.00)
           (bounds 200.00 200.00)
+          (event region
+            (rect (0,0) width=200 height=200)
+          )
           (children 1
             (GraphicsLayer
               (bounds 200.00 200.00)
@@ -36,6 +39,9 @@
         (GraphicsLayer
           (position 8.00 208.00)
           (bounds 200.00 200.00)
+          (event region
+            (rect (0,0) width=200 height=200)
+          )
           (children 1
             (GraphicsLayer
               (bounds origin 150.00 150.00)
@@ -63,6 +69,9 @@
           (position 8.00 408.00)
           (bounds 250.00 250.00)
           (drawsContent 1)
+          (event region
+            (rect (0,0) width=250 height=250)
+          )
           (children 1
             (GraphicsLayer
               (offsetFromRenderer width=25 height=25)

Modified: trunk/Source/WebCore/ChangeLog (249535 => 249536)


--- trunk/Source/WebCore/ChangeLog	2019-09-05 17:44:38 UTC (rev 249535)
+++ trunk/Source/WebCore/ChangeLog	2019-09-05 18:03:17 UTC (rev 249536)
@@ -1,3 +1,25 @@
+2019-09-05  Antti Koivisto  <[email protected]>
+
+        Generate event region for both the main graphics layer and the scrolled contents layer
+        https://bugs.webkit.org/show_bug.cgi?id=201487
+
+        Reviewed by Simon Fraser.
+
+        We currently generate region for one of them only. With borders both need it.
+        
+        Also share more code with painting paths.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateEventRegion):
+
+        Generate region for both layers.
+
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+
+        Add event region context parameter so we can use this function for event region update too.
+
+        * rendering/RenderLayerBacking.h:
+
 2019-09-05  Ryosuke Niwa  <[email protected]>
 
         REGRESSION (iOS 13): Bulleted list copied from Notes to Mail results in Times New Roman

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (249535 => 249536)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-09-05 17:44:38 UTC (rev 249535)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-09-05 18:03:17 UTC (rev 249536)
@@ -1592,25 +1592,24 @@
     if (m_owningLayer.isRenderViewLayer() && !hasTouchActionElements)
         return;
 
-    GraphicsContext nullContext(nullptr);
-    RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, compositedBounds(), { }, LayoutSize());
+    auto updateEventRegionForLayer = [&](GraphicsLayer& graphicsLayer) {
+        GraphicsContext nullContext(nullptr);
+        EventRegion eventRegion;
+        auto eventRegionContext = eventRegion.makeContext();
+        auto dirtyRect = enclosingIntRect(FloatRect(FloatPoint(graphicsLayer.offsetFromRenderer()), graphicsLayer.size()));
 
-    EventRegion eventRegion;
-    auto eventRegionContext = eventRegion.makeContext();
-    paintingInfo.eventRegionContext = &eventRegionContext;
+        paintIntoLayer(&graphicsLayer, nullContext, dirtyRect, { }, &eventRegionContext);
 
-    auto paintFlags = RenderLayer::paintLayerPaintingCompositingAllPhasesFlags() | RenderLayer::PaintLayerCollectingEventRegion;
-    m_owningLayer.paintLayerContents(nullContext, paintingInfo, paintFlags);
+        auto layerOffset = toIntSize(graphicsLayer.scrollOffset()) - roundedIntSize(graphicsLayer.offsetFromRenderer());
+        eventRegion.translate(layerOffset);
 
-    for (auto& layer : m_backingSharingLayers)
-        layer->paintLayerWithEffects(nullContext, paintingInfo, paintFlags);
+        graphicsLayer.setEventRegion(WTFMove(eventRegion));
+    };
 
-    GraphicsLayer& layerForEventRegion = m_scrolledContentsLayer ? *m_scrolledContentsLayer : *m_graphicsLayer;
+    updateEventRegionForLayer(*m_graphicsLayer);
 
-    auto layerOffset = toIntSize(layerForEventRegion.scrollOffset()) - roundedIntSize(layerForEventRegion.offsetFromRenderer());
-    eventRegion.translate(layerOffset);
-
-    layerForEventRegion.setEventRegion(WTFMove(eventRegion));
+    if (m_scrolledContentsLayer)
+        updateEventRegionForLayer(*m_scrolledContentsLayer);
 #endif
 }
 
@@ -2776,7 +2775,7 @@
 
 void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, GraphicsContext& context,
     const IntRect& paintDirtyRect, // In the coords of rootLayer.
-    OptionSet<PaintBehavior> paintBehavior)
+    OptionSet<PaintBehavior> paintBehavior, EventRegionContext* eventRegionContext)
 {
     if ((paintsIntoWindow() || paintsIntoCompositedAncestor()) && graphicsLayer->paintingPhase() != OptionSet<GraphicsLayerPaintingPhase>(GraphicsLayerPaintingPhase::ChildClippingMask)) {
 #if !PLATFORM(IOS_FAMILY) && !OS(WINDOWS)
@@ -2790,33 +2789,41 @@
 
     auto paintFlags = paintFlagsForLayer(*graphicsLayer);
 
+    if (eventRegionContext)
+        paintFlags.add(RenderLayer::PaintLayerCollectingEventRegion);
+
 #ifndef NDEBUG
     RenderElement::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(&renderer());
 #endif
 
     auto paintOneLayer = [&](RenderLayer& layer, OptionSet<RenderLayer::PaintLayerFlag> paintFlags) {
-        InspectorInstrumentation::willPaint(layer.renderer());
-
         FrameView::PaintingState paintingState;
-        if (layer.isRenderViewLayer())
-            renderer().view().frameView().willPaintContents(context, paintDirtyRect, paintingState);
+        if (!eventRegionContext) {
+            InspectorInstrumentation::willPaint(layer.renderer());
 
+            if (layer.isRenderViewLayer())
+                renderer().view().frameView().willPaintContents(context, paintDirtyRect, paintingState);
+        }
+
         RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, -m_subpixelOffsetFromRenderer);
+        paintingInfo.eventRegionContext = eventRegionContext;
 
         if (&layer == &m_owningLayer) {
             layer.paintLayerContents(context, paintingInfo, paintFlags);
 
-            if (layer.containsDirtyOverlayScrollbars())
+            if (layer.containsDirtyOverlayScrollbars() && !eventRegionContext)
                 layer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
         } else
             layer.paintLayerWithEffects(context, paintingInfo, paintFlags);
 
-        if (layer.isRenderViewLayer())
-            renderer().view().frameView().didPaintContents(context, paintDirtyRect, paintingState);
+        if (!eventRegionContext) {
+            if (layer.isRenderViewLayer())
+                renderer().view().frameView().didPaintContents(context, paintDirtyRect, paintingState);
 
+            InspectorInstrumentation::didPaint(layer.renderer(), paintDirtyRect);
+        }
+
         ASSERT(!m_owningLayer.m_usedTransparency);
-
-        InspectorInstrumentation::didPaint(layer.renderer(), paintDirtyRect);
     };
 
     paintOneLayer(m_owningLayer, paintFlags);
@@ -2831,12 +2838,15 @@
 
         if (graphicsLayer->paintingPhase().contains(GraphicsLayerPaintingPhase::OverflowContents))
             sharingLayerPaintFlags.add(RenderLayer::PaintLayerPaintingOverflowContents);
+        if (eventRegionContext)
+            sharingLayerPaintFlags.add(RenderLayer::PaintLayerCollectingEventRegion);
 
         for (auto& layerWeakPtr : m_backingSharingLayers)
             paintOneLayer(*layerWeakPtr, sharingLayerPaintFlags);
     }
 
-    compositor().didPaintBacking(this);
+    if (!eventRegionContext)
+        compositor().didPaintBacking(this);
 }
 
 OptionSet<RenderLayer::PaintLayerFlag> RenderLayerBacking::paintFlagsForLayer(const GraphicsLayer& graphicsLayer) const

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (249535 => 249536)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-09-05 17:44:38 UTC (rev 249535)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-09-05 18:03:17 UTC (rev 249536)
@@ -35,6 +35,7 @@
 
 namespace WebCore {
 
+class EventRegionContext;
 class KeyframeList;
 class PaintedContentsInfo;
 class RenderLayerCompositor;
@@ -376,7 +377,7 @@
     bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_isFrameLayerWithTiledBacking); }
     GraphicsLayer* tileCacheFlatteningLayer() const { return m_isFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
 
-    void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, OptionSet<PaintBehavior>);
+    void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, OptionSet<PaintBehavior>, EventRegionContext* = nullptr);
     OptionSet<RenderLayer::PaintLayerFlag> paintFlagsForLayer(const GraphicsLayer&) const;
     
     void paintDebugOverlays(const GraphicsLayer*, GraphicsContext&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to