Combine event and touch action regions into a single class
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Apr 2019 16:48:58 +0000 (16:48 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Apr 2019 16:48:58 +0000 (16:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196644
<rdar://problem/49643614>

Reviewed by Darin Adler.

Source/WebCore:

This patch replaces the existing TouchActionRegion class with the more general EventRegion class.
It collects both the overall event region and the touch action regions. This avoids duplication
and simplifies the code.

The patch also adds serialization support for EventRegion, so touch-action regions gets passed
to the UI process too.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setEventRegion):
(WebCore::GraphicsLayer::dumpProperties const):
(WebCore::GraphicsLayer::setTouchActionRegion): Deleted.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::eventRegion const):
(WebCore::GraphicsLayer::touchActionRegion const): Deleted.
* platform/graphics/Region.cpp:
(WebCore::operator<<):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setEventRegion):
(WebCore::GraphicsLayerCA::setTouchActionRegion): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* rendering/EventRegion.cpp: Copied from Source/WebCore/rendering/TouchActionRegion.cpp.
(WebCore::EventRegion::operator== const):
(WebCore::EventRegion::unite):
(WebCore::EventRegion::translate):
(WebCore::EventRegion::uniteTouchActions):
(WebCore::EventRegion::touchActionsForPoint const):
(WebCore::operator<<):
(WebCore::TouchActionRegion::unite): Deleted.
(WebCore::TouchActionRegion::actionsForPoint const): Deleted.
(WebCore::TouchActionRegion::translate): Deleted.
* rendering/EventRegion.h: Copied from Source/WebCore/rendering/TouchActionRegion.h.
(WebCore::EventRegion::isEmpty const):
(WebCore::EventRegion::contains const):
(WebCore::EventRegion::hasTouchActions const):
(WebCore::EventRegion::encode const):
(WebCore::EventRegion::decode):
(WebCore::TouchActionRegion::isEmpty const): Deleted.
(WebCore::TouchActionRegion::operator== const): Deleted.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/PaintInfo.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::collectEventRegionForFragments):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateEventRegion):
* rendering/RenderLayerModelObject.cpp:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/TouchActionRegion.cpp: Removed.
* rendering/TouchActionRegion.h: Removed.

Source/WebKit:

* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
(WebKit::RemoteLayerTreeNode::eventRegion const):
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(WebKit::RemoteLayerTreeNode::setEventRegion):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setEventRegion):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:

LayoutTests:

* pointerevents/ios/touch-action-region-basic-expected.txt:
* pointerevents/ios/touch-action-region-layers-expected.txt:
* pointerevents/ios/touch-action-region-pan-x-y-expected.txt:

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

33 files changed:
LayoutTests/ChangeLog
LayoutTests/pointerevents/ios/touch-action-region-basic-expected.txt
LayoutTests/pointerevents/ios/touch-action-region-layers-expected.txt
LayoutTests/pointerevents/ios/touch-action-region-pan-x-y-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/Region.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
Source/WebCore/rendering/EventRegion.cpp [moved from Source/WebCore/rendering/TouchActionRegion.cpp with 64% similarity]
Source/WebCore/rendering/EventRegion.h [new file with mode: 0644]
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/PaintInfo.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerModelObject.cpp
Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
Source/WebCore/rendering/TouchActionRegion.h [deleted file]
Source/WebKit/ChangeLog
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h

index dc00e28..7bd0a2c 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-06  Antti Koivisto  <antti@apple.com>
+
+        Combine event and touch action regions into a single class
+        https://bugs.webkit.org/show_bug.cgi?id=196644
+        <rdar://problem/49643614>
+
+        Reviewed by Darin Adler.
+
+        * pointerevents/ios/touch-action-region-basic-expected.txt:
+        * pointerevents/ios/touch-action-region-layers-expected.txt:
+        * pointerevents/ios/touch-action-region-pan-x-y-expected.txt:
+
 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
index 42af6c3..cd6050f 100644 (file)
@@ -9,14 +9,14 @@
       (backgroundColor #FFFFFF)
       (event region
         (rect (0,0) width=800 height=621)
-      )
-      (touch-action region
-        (none        
-          (rect (8,8) width=100 height=100)
-          (rect (8,208) width=200 height=25)
-          (rect (8,233) width=100 height=75)
-          (rect (8,408) width=100 height=50)
-          (rect (8,458) width=50 height=50)
+        (touch-action
+          (none          
+            (rect (8,8) width=100 height=100)
+            (rect (8,208) width=200 height=25)
+            (rect (8,233) width=100 height=75)
+            (rect (8,408) width=100 height=50)
+            (rect (8,458) width=50 height=50)
+          )
         )
       )
     )
index 55fef70..0c0c71f 100644 (file)
           (contentsOpaque 1)
           (event region
             (rect (0,0) width=100 height=100)
-          )
-          (touch-action region
-            (none            
-              (rect (0,0) width=100 height=100)
+            (touch-action
+              (none              
+                (rect (0,0) width=100 height=100)
+              )
             )
           )
         )
           (event region
             (rect (0,0) width=200 height=25)
             (rect (0,25) width=100 height=75)
-          )
-          (touch-action region
-            (none            
-              (rect (0,0) width=200 height=25)
-              (rect (0,25) width=100 height=75)
+            (touch-action
+              (none              
+                (rect (0,0) width=200 height=25)
+                (rect (0,25) width=100 height=75)
+              )
             )
           )
         )
           (contentsOpaque 1)
           (event region
             (rect (0,0) width=100 height=100)
-          )
-          (touch-action region
-            (none            
-              (rect (0,0) width=100 height=100)
+            (touch-action
+              (none              
+                (rect (0,0) width=100 height=100)
+              )
             )
           )
         )
             (rect (0,0) width=100 height=50)
             (rect (0,50) width=150 height=50)
             (rect (50,100) width=100 height=50)
-          )
-          (touch-action region
-            (none            
-              (rect (0,0) width=100 height=50)
-              (rect (0,50) width=150 height=50)
-              (rect (50,100) width=100 height=50)
+            (touch-action
+              (none              
+                (rect (0,0) width=100 height=50)
+                (rect (0,50) width=150 height=50)
+                (rect (50,100) width=100 height=50)
+              )
             )
           )
           (children 2
               (contentsOpaque 1)
               (event region
                 (rect (0,0) width=100 height=100)
-              )
-              (touch-action region
-                (none                
-                  (rect (0,0) width=100 height=100)
+                (touch-action
+                  (none                  
+                    (rect (0,0) width=100 height=100)
+                  )
                 )
               )
             )
index fad2c56..65b44fa 100644 (file)
@@ -9,23 +9,23 @@
       (backgroundColor #FFFFFF)
       (event region
         (rect (0,0) width=800 height=1021)
-      )
-      (touch-action region
-        (none        
-          (rect (8,808) width=100 height=100)
-        )
-        (pan-x        
-          (rect (8,8) width=100 height=100)
-          (rect (8,208) width=200 height=25)
-          (rect (8,233) width=100 height=75)
-          (rect (108,408) width=100 height=25)
-          (rect (8,608) width=200 height=25)
-          (rect (8,633) width=100 height=75)
-          (rect (108,808) width=100 height=25)
-        )
-        (pan-y        
-          (rect (8,408) width=200 height=25)
-          (rect (8,433) width=100 height=75)
+        (touch-action
+          (none          
+            (rect (8,808) width=100 height=100)
+          )
+          (pan-x          
+            (rect (8,8) width=100 height=100)
+            (rect (8,208) width=200 height=25)
+            (rect (8,233) width=100 height=75)
+            (rect (108,408) width=100 height=25)
+            (rect (8,608) width=200 height=25)
+            (rect (8,633) width=100 height=75)
+            (rect (108,808) width=100 height=25)
+          )
+          (pan-y          
+            (rect (8,408) width=200 height=25)
+            (rect (8,433) width=100 height=75)
+          )
         )
       )
     )
index 6e79c4c..bc8bbb2 100644 (file)
@@ -1,3 +1,69 @@
+2019-04-06  Antti Koivisto  <antti@apple.com>
+
+        Combine event and touch action regions into a single class
+        https://bugs.webkit.org/show_bug.cgi?id=196644
+        <rdar://problem/49643614>
+
+        Reviewed by Darin Adler.
+
+        This patch replaces the existing TouchActionRegion class with the more general EventRegion class.
+        It collects both the overall event region and the touch action regions. This avoids duplication
+        and simplifies the code.
+
+        The patch also adds serialization support for EventRegion, so touch-action regions gets passed
+        to the UI process too.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::setEventRegion):
+        (WebCore::GraphicsLayer::dumpProperties const):
+        (WebCore::GraphicsLayer::setTouchActionRegion): Deleted.
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::eventRegion const):
+        (WebCore::GraphicsLayer::touchActionRegion const): Deleted.
+        * platform/graphics/Region.cpp:
+        (WebCore::operator<<):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::setEventRegion):
+        (WebCore::GraphicsLayerCA::setTouchActionRegion): Deleted.
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
+        * rendering/EventRegion.cpp: Copied from Source/WebCore/rendering/TouchActionRegion.cpp.
+        (WebCore::EventRegion::operator== const):
+        (WebCore::EventRegion::unite):
+        (WebCore::EventRegion::translate):
+        (WebCore::EventRegion::uniteTouchActions):
+        (WebCore::EventRegion::touchActionsForPoint const):
+        (WebCore::operator<<):
+        (WebCore::TouchActionRegion::unite): Deleted.
+        (WebCore::TouchActionRegion::actionsForPoint const): Deleted.
+        (WebCore::TouchActionRegion::translate): Deleted.
+        * rendering/EventRegion.h: Copied from Source/WebCore/rendering/TouchActionRegion.h.
+        (WebCore::EventRegion::isEmpty const):
+        (WebCore::EventRegion::contains const):
+        (WebCore::EventRegion::hasTouchActions const):
+        (WebCore::EventRegion::encode const):
+        (WebCore::EventRegion::decode):
+        (WebCore::TouchActionRegion::isEmpty const): Deleted.
+        (WebCore::TouchActionRegion::operator== const): Deleted.
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        * rendering/PaintInfo.h:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintObject):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::collectEventRegionForFragments):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateEventRegion):
+        * rendering/RenderLayerModelObject.cpp:
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::paintFlow):
+        * rendering/TouchActionRegion.cpp: Removed.
+        * rendering/TouchActionRegion.h: Removed.
+
 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
index 3334e4a..d844df1 100644 (file)
@@ -1950,6 +1950,7 @@ rendering/CSSFilter.cpp
 rendering/ClipRect.cpp
 rendering/CounterNode.cpp
 rendering/EllipsisBox.cpp
+rendering/EventRegion.cpp
 rendering/FlexibleBoxAlgorithm.cpp
 rendering/FixedTableLayout.cpp
 rendering/FloatingObjects.cpp
@@ -2068,7 +2069,6 @@ rendering/SimpleLineLayoutTextFragmentIterator.cpp
 rendering/TextDecorationPainter.cpp
 rendering/TextPaintStyle.cpp
 rendering/TextPainter.cpp
-rendering/TouchActionRegion.cpp
 rendering/TrailingFloatsRootInlineBox.cpp
 
 rendering/line/LineBreaker.cpp
index 5d7b3de..d010d51 100644 (file)
                E4A814D41C6DEC4000BF85AC /* ClassChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */; };
                E4A814DA1C70E10D00BF85AC /* AttributeChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D91C70E10D00BF85AC /* AttributeChangeInvalidation.h */; };
                E4A814E01C7338EB00BF85AC /* IdChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */; };
-               E4A8D21022538FD200A8463C /* TouchActionRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A8D20F22538FD100A8463C /* TouchActionRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               E4A8D21622578DB700A8463C /* EventRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A8D21422578DA000A8463C /* EventRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; };
                E4A814D91C70E10D00BF85AC /* AttributeChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttributeChangeInvalidation.h; sourceTree = "<group>"; };
                E4A814DD1C7338D100BF85AC /* IdChangeInvalidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdChangeInvalidation.cpp; sourceTree = "<group>"; };
                E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdChangeInvalidation.h; sourceTree = "<group>"; };
-               E4A8D20C22538FC700A8463C /* TouchActionRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchActionRegion.cpp; sourceTree = "<group>"; };
-               E4A8D20F22538FD100A8463C /* TouchActionRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchActionRegion.h; sourceTree = "<group>"; };
+               E4A8D21422578DA000A8463C /* EventRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventRegion.h; sourceTree = "<group>"; };
+               E4A8D21522578DA000A8463C /* EventRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventRegion.cpp; sourceTree = "<group>"; };
                E4AE7C1517D1BB950009FB31 /* ElementIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIterator.h; sourceTree = "<group>"; };
                E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementAncestorIterator.h; sourceTree = "<group>"; };
                E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitBezier.h; sourceTree = "<group>"; };
                                0F53FB83213B1BB800C40D34 /* CSSFilter.h */,
                                A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
                                A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
+                               E4A8D21522578DA000A8463C /* EventRegion.cpp */,
+                               E4A8D21422578DA000A8463C /* EventRegion.h */,
                                A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */,
                                A8CFF04A0A154F09000A4234 /* FixedTableLayout.h */,
                                94DD79721E54E3A20058FB80 /* FlexibleBoxAlgorithm.cpp */,
                                1C18DA57181AF6A500C4EF22 /* TextPainter.h */,
                                E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */,
                                E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
-                               E4A8D20C22538FC700A8463C /* TouchActionRegion.cpp */,
-                               E4A8D20F22538FD100A8463C /* TouchActionRegion.h */,
                                1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */,
                                37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
                                BCA257141293C010007A263D /* VerticalPositionCache.h */,
                                FDA15EA812B03EE1003A583A /* JSAudioDestinationNode.h in Headers */,
                                FDA15EAE12B03EE1003A583A /* JSAudioListener.h in Headers */,
                                FDA15EB012B03EE1003A583A /* JSAudioNode.h in Headers */,
-                               E4A8D21022538FD200A8463C /* TouchActionRegion.h in Headers */,
                                FDA15EB412B03EE1003A583A /* JSAudioParam.h in Headers */,
                                FDA15EB612B03EE1003A583A /* JSAudioProcessingEvent.h in Headers */,
                                BE8EF043171C8FF9009B48C3 /* JSAudioTrack.h in Headers */,
                                E446143A0CD689C800FADA75 /* JSHTMLMediaElement.h in Headers */,
                                1AE2AE5C0A1D26F200B42B25 /* JSHTMLMenuElement.h in Headers */,
                                A80E7A180A19C3D6007FB8C5 /* JSHTMLMetaElement.h in Headers */,
+                               E4A8D21622578DB700A8463C /* EventRegion.h in Headers */,
                                A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */,
                                1AE2AB2A0A1CE63B00B42B25 /* JSHTMLModElement.h in Headers */,
                                BC305C7A0C076BB300CD20F0 /* JSHTMLObjectElement.h in Headers */,
index 1504ea3..2500fd4 100644 (file)
@@ -411,18 +411,11 @@ void GraphicsLayer::setShapeLayerWindRule(WindRule windRule)
 #endif
 }
 
-void GraphicsLayer::setEventRegion(Region&& eventRegion)
+void GraphicsLayer::setEventRegion(EventRegion&& eventRegion)
 {
     m_eventRegion = WTFMove(eventRegion);
 }
 
-#if ENABLE(POINTER_EVENTS)
-void GraphicsLayer::setTouchActionRegion(TouchActionRegion&& touchActionRegion)
-{
-    m_touchActionRegion = WTFMove(touchActionRegion);
-}
-#endif
-
 void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
 {
     deviceOrPageScaleFactorChanged();
@@ -933,13 +926,9 @@ void GraphicsLayer::dumpProperties(TextStream& ts, LayerTreeAsTextBehavior behav
         ts << indent << ")\n";
     }
 
-    if (behavior & LayerTreeAsTextIncludeEventRegion) {
-        if (!m_eventRegion.isEmpty())
-            ts << indent << "(event region" << m_eventRegion << ")\n";
-#if ENABLE(POINTER_EVENTS)
-        if (!m_touchActionRegion.isEmpty())
-            ts << indent << "(touch-action region" << m_touchActionRegion << ")\n";
-#endif
+    if (behavior & LayerTreeAsTextIncludeEventRegion && !m_eventRegion.isEmpty()) {
+        ts << indent << "(event region" << m_eventRegion;
+        ts << indent << ")\n";
     }
 
     if (behavior & LayerTreeAsTextIncludePaintingPhases && paintingPhase()) {
index ba6c7a0..de3cf58 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "Animation.h"
 #include "Color.h"
+#include "EventRegion.h"
 #include "FilterOperations.h"
 #include "FloatPoint.h"
 #include "FloatPoint3D.h"
@@ -37,7 +38,6 @@
 #include "PlatformLayer.h"
 #include "Region.h"
 #include "ScrollableArea.h"
-#include "TouchActionRegion.h"
 #include "TransformOperations.h"
 #include "WindRule.h"
 #include <wtf/Function.h>
@@ -454,12 +454,9 @@ public:
     WindRule shapeLayerWindRule() const;
     virtual void setShapeLayerWindRule(WindRule);
 
-    const Region& eventRegion() const { return m_eventRegion; }
-    virtual void setEventRegion(Region&&);
-#if ENABLE(POINTER_EVENTS)
-    const TouchActionRegion& touchActionRegion() const { return m_touchActionRegion; }
-    virtual void setTouchActionRegion(TouchActionRegion&&);
-#endif
+    const EventRegion& eventRegion() const { return m_eventRegion; }
+    virtual void setEventRegion(EventRegion&&);
+
     // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
     static String animationNameForTransition(AnimatedPropertyID);
 
@@ -734,10 +731,7 @@ protected:
     FloatRoundedRect m_backdropFiltersRect;
     Optional<FloatRect> m_animationExtent;
 
-    Region m_eventRegion;
-#if ENABLE(POINTER_EVENTS)
-    TouchActionRegion m_touchActionRegion;
-#endif
+    EventRegion m_eventRegion;
 #if USE(CA)
     WindRule m_shapeLayerWindRule { WindRule::NonZero };
     Path m_shapeLayerPath;
index 74f5b68..9dcee87 100644 (file)
@@ -659,7 +659,6 @@ TextStream& operator<<(TextStream& ts, const Region& region)
         for (auto& rect : region.rects())
             ts << indent << "(rect " << rect << ")\n";
     }
-    ts << indent;
 
     return ts;
 }
index 670e81e..a939a35 100644 (file)
@@ -984,7 +984,7 @@ void GraphicsLayerCA::setShapeLayerWindRule(WindRule windRule)
     noteLayerPropertyChanged(WindRuleChanged);
 }
 
-void GraphicsLayerCA::setEventRegion(Region&& eventRegion)
+void GraphicsLayerCA::setEventRegion(EventRegion&& eventRegion)
 {
     if (eventRegion == m_eventRegion)
         return;
@@ -993,17 +993,6 @@ void GraphicsLayerCA::setEventRegion(Region&& eventRegion)
     noteLayerPropertyChanged(EventRegionChanged, m_isCommittingChanges ? DontScheduleFlush : ScheduleFlush);
 }
 
-#if ENABLE(POINTER_EVENTS)
-void GraphicsLayerCA::setTouchActionRegion(TouchActionRegion&& touchActionRegion)
-{
-    if (touchActionRegion == m_touchActionRegion)
-        return;
-
-    GraphicsLayer::setTouchActionRegion(WTFMove(touchActionRegion));
-    // FIXME: Invalidate and pass to platform layer.
-}
-#endif
-
 bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
 {
     return drawsContent() && !tiledBacking();
index 3fe5e7e..ebbfb52 100644 (file)
@@ -124,10 +124,8 @@ public:
     WEBCORE_EXPORT void setShapeLayerPath(const Path&) override;
     WEBCORE_EXPORT void setShapeLayerWindRule(WindRule) override;
 
-    WEBCORE_EXPORT void setEventRegion(Region&&) override;
-#if ENABLE(POINTER_EVENTS)
-    WEBCORE_EXPORT void setTouchActionRegion(TouchActionRegion&&) override;
-#endif
+    WEBCORE_EXPORT void setEventRegion(EventRegion&&) override;
+
     WEBCORE_EXPORT void suspendAnimations(MonotonicTime) override;
     WEBCORE_EXPORT void resumeAnimations() override;
 
index 04cb53c..39b9294 100644 (file)
@@ -234,7 +234,7 @@ public:
     virtual WindRule shapeWindRule() const = 0;
     virtual void setShapeWindRule(WindRule) = 0;
 
-    virtual void setEventRegion(const Region&) = 0;
+    virtual void setEventRegion(const EventRegion&) = 0;
     
     virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
index 8fba4c5..198fa99 100644 (file)
@@ -168,7 +168,7 @@ public:
     GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
     void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
 
-    void setEventRegion(const Region&) override { }
+    void setEventRegion(const EventRegion&) override { }
 
     GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
 
index 4b1d426..99bc0ce 100644 (file)
@@ -157,7 +157,7 @@ public:
     GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
     void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
 
-    void setEventRegion(const Region&) override { }
+    void setEventRegion(const EventRegion&) override { }
 
     GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
 
similarity index 64%
rename from Source/WebCore/rendering/TouchActionRegion.cpp
rename to Source/WebCore/rendering/EventRegion.cpp
index c185b58..e9c5a9d 100644 (file)
  */
 
 #include "config.h"
-#include "TouchActionRegion.h"
+#include "EventRegion.h"
 
-#if ENABLE(POINTER_EVENTS)
+#include "RenderStyle.h"
 
 namespace WebCore {
 
+EventRegion::EventRegion() = default;
+
+bool EventRegion::operator==(const EventRegion& other) const
+{
+#if ENABLE(POINTER_EVENTS)
+    if (m_touchActionRegions != other.m_touchActionRegions)
+        return false;
+#endif
+    return m_region == other.m_region;
+}
+
+void EventRegion::unite(const Region& region, const RenderStyle& style)
+{
+    m_region.unite(region);
+
+#if ENABLE(POINTER_EVENTS)
+    uniteTouchActions(region, style.effectiveTouchActions());
+#else
+    UNUSED_PARAM(style);
+#endif
+}
+
+void EventRegion::translate(const IntSize& offset)
+{
+    m_region.translate(offset);
+
+#if ENABLE(POINTER_EVENTS)
+    for (auto& touchActionRegion : m_touchActionRegions)
+        touchActionRegion.translate(offset);
+#endif
+}
+
+#if ENABLE(POINTER_EVENTS)
+
 constexpr unsigned toIndex(TouchAction touchAction)
 {
     switch (touchAction) {
@@ -70,33 +104,31 @@ constexpr TouchAction toTouchAction(unsigned index)
     return TouchAction::Auto;
 }
 
-TouchActionRegion::TouchActionRegion() = default;
-
-void TouchActionRegion::unite(const Region& touchRegion, OptionSet<TouchAction> touchActions)
+void EventRegion::uniteTouchActions(const Region& touchRegion, OptionSet<TouchAction> touchActions)
 {
     for (auto touchAction : touchActions) {
         if (touchAction == TouchAction::Auto)
             break;
         auto index = toIndex(touchAction);
-        if (m_regions.size() < index + 1)
-            m_regions.grow(index + 1);
+        if (m_touchActionRegions.size() < index + 1)
+            m_touchActionRegions.grow(index + 1);
     }
 
-    for (unsigned i = 0; i < m_regions.size(); ++i) {
+    for (unsigned i = 0; i < m_touchActionRegions.size(); ++i) {
         auto regionTouchAction = toTouchAction(i);
         if (touchActions.contains(regionTouchAction))
-            m_regions[i].unite(touchRegion);
+            m_touchActionRegions[i].unite(touchRegion);
         else
-            m_regions[i].subtract(touchRegion);
+            m_touchActionRegions[i].subtract(touchRegion);
     }
 }
 
-OptionSet<TouchAction> TouchActionRegion::actionsForPoint(const IntPoint& point) const
+OptionSet<TouchAction> EventRegion::touchActionsForPoint(const IntPoint& point) const
 {
     OptionSet<TouchAction> actions;
 
-    for (unsigned i = 0; i < m_regions.size(); ++i) {
-        if (m_regions[i].contains(point)) {
+    for (unsigned i = 0; i < m_touchActionRegions.size(); ++i) {
+        if (m_touchActionRegions[i].contains(point)) {
             auto action = toTouchAction(i);
             actions.add(action);
             if (action == TouchAction::None || action == TouchAction::Manipulation)
@@ -107,12 +139,6 @@ OptionSet<TouchAction> TouchActionRegion::actionsForPoint(const IntPoint& point)
     return actions;
 }
 
-void TouchActionRegion::translate(const IntSize& offset)
-{
-    for (auto& region : m_regions)
-        region.translate(offset);
-}
-
 TextStream& operator<<(TextStream& ts, TouchAction touchAction)
 {
     switch (touchAction) {
@@ -133,23 +159,29 @@ TextStream& operator<<(TextStream& ts, TouchAction touchAction)
     return ts;
 }
 
-TextStream& operator<<(TextStream& ts, const TouchActionRegion& touchActionRegion)
+#endif
+
+TextStream& operator<<(TextStream& ts, const EventRegion& eventRegion)
 {
-    ts << "\n";
-    {
-        for (unsigned i = 0; i < touchActionRegion.m_regions.size(); ++i) {
-            if (touchActionRegion.m_regions[i].isEmpty())
+    ts << eventRegion.m_region;
+
+#if ENABLE(POINTER_EVENTS)
+    if (!eventRegion.m_touchActionRegions.isEmpty()) {
+        TextStream::IndentScope indentScope(ts);
+        ts << indent << "(touch-action\n";
+        for (unsigned i = 0; i < eventRegion.m_touchActionRegions.size(); ++i) {
+            if (eventRegion.m_touchActionRegions[i].isEmpty())
                 continue;
             TextStream::IndentScope indentScope(ts);
             ts << indent << "(" << toTouchAction(i);
-            ts << indent << touchActionRegion.m_regions[i] << ")\n";
+            ts << indent << eventRegion.m_touchActionRegions[i];
+            ts << indent << ")\n";
         }
+        ts << indent << ")\n";
     }
-    ts << indent;
+#endif
 
     return ts;
 }
 
 }
-
-#endif
diff --git a/Source/WebCore/rendering/EventRegion.h b/Source/WebCore/rendering/EventRegion.h
new file mode 100644 (file)
index 0000000..2039328
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "Region.h"
+#include "TouchAction.h"
+#include <wtf/OptionSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class RenderStyle;
+
+class EventRegion {
+public:
+    WEBCORE_EXPORT EventRegion();
+
+    bool isEmpty() const { return m_region.isEmpty(); }
+
+    WEBCORE_EXPORT bool operator==(const EventRegion&) const;
+
+    WEBCORE_EXPORT void unite(const Region&, const RenderStyle&);
+    WEBCORE_EXPORT void translate(const IntSize&);
+
+    bool contains(const IntPoint& point) const { return m_region.contains(point); }
+    bool contains(const IntRect& rect) const { return m_region.contains(rect); }
+
+#if ENABLE(POINTER_EVENTS)
+    bool hasTouchActions() const { return !m_touchActionRegions.isEmpty(); }
+    WEBCORE_EXPORT OptionSet<TouchAction> touchActionsForPoint(const IntPoint&) const;
+#endif
+
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static Optional<EventRegion> decode(Decoder&);
+    // FIXME: Remove legacy decode.
+    template<class Decoder> static bool decode(Decoder&, EventRegion&);
+
+private:
+#if ENABLE(POINTER_EVENTS)
+    void uniteTouchActions(const Region&, OptionSet<TouchAction>);
+#endif
+    friend TextStream& operator<<(TextStream&, const EventRegion&);
+
+    Region m_region;
+#if ENABLE(POINTER_EVENTS)
+    Vector<Region> m_touchActionRegions;
+#endif
+};
+
+TextStream& operator<<(TextStream&, const EventRegion&);
+
+template<class Encoder>
+void EventRegion::encode(Encoder& encoder) const
+{
+    encoder << m_region;
+#if ENABLE(POINTER_EVENTS)
+    encoder << m_touchActionRegions;
+#endif
+}
+
+template<class Decoder>
+Optional<EventRegion> EventRegion::decode(Decoder& decoder)
+{
+    Optional<Region> region;
+    decoder >> region;
+    if (!region)
+        return WTF::nullopt;
+
+    EventRegion eventRegion;
+    eventRegion.m_region = WTFMove(*region);
+
+#if ENABLE(POINTER_EVENTS)
+    Optional<Vector<Region>> touchActionRegions;
+    decoder >> touchActionRegions;
+    if (!touchActionRegions)
+        return WTF::nullopt;
+
+    eventRegion.m_touchActionRegions = WTFMove(*touchActionRegions);
+#endif
+
+    return eventRegion;
+}
+
+template<class Decoder>
+bool EventRegion::decode(Decoder& decoder, EventRegion& eventRegion)
+{
+    Optional<EventRegion> decodedEventRegion;
+    decoder >> decodedEventRegion;
+    if (!decodedEventRegion)
+        return false;
+    eventRegion = WTFMove(*decodedEventRegion);
+    return true;
+}
+
+}
index 1302c5b..c734dbc 100644 (file)
@@ -29,6 +29,7 @@
 #include "DocumentMarkerController.h"
 #include "Editor.h"
 #include "EllipsisBox.h"
+#include "EventRegion.h"
 #include "Frame.h"
 #include "GraphicsContext.h"
 #include "HitTestResult.h"
@@ -504,7 +505,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
 
     if (paintInfo.phase == PaintPhase::EventRegion) {
         if (visibleToHitTesting())
-            paintInfo.eventRegion->unite(enclosingIntRect(boxRect));
+            paintInfo.eventRegion->unite(enclosingIntRect(boxRect), renderer().style());
         return;
     }
 
index 81e3868..02bf93c 100644 (file)
 
 namespace WebCore {
 
+class EventRegion;
 class OverlapTestRequestClient;
-class Region;
 class RenderInline;
 class RenderLayer;
 class RenderLayerModelObject;
 class RenderObject;
 
-#if ENABLE(POINTER_EVENTS)
-class TouchActionRegion;
-#endif
-    
 typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
 
 /*
@@ -134,10 +130,7 @@ struct PaintInfo {
     const RenderLayerModelObject* paintContainer; // the layer object that originates the current painting
     bool requireSecurityOriginAccessForWidgets { false };
     const RenderLayer* m_enclosingSelfPaintingLayer { nullptr };
-    Region* eventRegion { nullptr }; // For PaintPhase::EventRegion.
-#if ENABLE(POINTER_EVENTS)
-    TouchActionRegion* touchActionRegion { nullptr };
-#endif
+    EventRegion* eventRegion { nullptr }; // For PaintPhase::EventRegion.
 private:
     GraphicsContext* m_context;
 };
index ca3048f..4496296 100644 (file)
@@ -28,6 +28,7 @@
 #include "Document.h"
 #include "Editor.h"
 #include "Element.h"
+#include "EventRegion.h"
 #include "FloatQuad.h"
 #include "Frame.h"
 #include "FrameSelection.h"
@@ -70,7 +71,6 @@
 #include "Settings.h"
 #include "ShadowRoot.h"
 #include "ShapeOutsideInfo.h"
-#include "TouchActionRegion.h"
 #include "TransformState.h"
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/NeverDestroyed.h>
@@ -1246,17 +1246,13 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
 
         if (visibleToHitTesting()) {
             auto borderRegion = approximateAsRegion(style().getRoundedBorderFor(borderRect));
-            paintInfo.eventRegion->unite(borderRegion);
-#if ENABLE(POINTER_EVENTS)
-            if (paintInfo.touchActionRegion)
-                paintInfo.touchActionRegion->unite(borderRegion, style().effectiveTouchActions());
-#endif
+            paintInfo.eventRegion->unite(borderRegion, style());
         }
 
         // No need to check descendants if we don't have overflow and the area is already covered.
         bool needsTraverseDescendants = hasVisualOverflow() || !paintInfo.eventRegion->contains(enclosingIntRect(borderRect));
-#if ENABLE(POINTER_EVENTS)
-        needsTraverseDescendants = needsTraverseDescendants || paintInfo.touchActionRegion;
+#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
+        needsTraverseDescendants = needsTraverseDescendants || document().touchActionElements();
 #endif
         if (!needsTraverseDescendants)
             return;
index 06e50db..b2eb23e 100644 (file)
@@ -4891,9 +4891,6 @@ void RenderLayer::collectEventRegionForFragments(const LayerFragments& layerFrag
     for (const auto& fragment : layerFragments) {
         PaintInfo paintInfo(context, fragment.foregroundRect.rect(), PaintPhase::EventRegion, { });
         paintInfo.eventRegion = localPaintingInfo.eventRegion;
-#if ENABLE(POINTER_EVENTS)
-        paintInfo.touchActionRegion = localPaintingInfo.touchActionRegion;
-#endif
         renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
     }
 }
index 8cb856e..f0e3e5e 100644 (file)
@@ -63,6 +63,7 @@ namespace WebCore {
 class CSSFilter;
 class ClipRects;
 class ClipRectsCache;
+class EventRegion;
 class HitTestRequest;
 class HitTestResult;
 class HitTestingTransformState;
@@ -80,10 +81,6 @@ class RenderView;
 class Scrollbar;
 class TransformationMatrix;
 
-#if ENABLE(POINTER_EVENTS)
-class TouchActionRegion;
-#endif
-
 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
 enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf };
 
@@ -916,10 +913,7 @@ private:
         OptionSet<PaintBehavior> paintBehavior;
         bool requireSecurityOriginAccessForWidgets;
         bool clipToDirtyRect { true };
-        Region* eventRegion { nullptr };
-#if ENABLE(POINTER_EVENTS)
-        TouchActionRegion* touchActionRegion { nullptr };
-#endif
+        EventRegion* eventRegion { nullptr };
     };
 
     // Compute, cache and return clip rects computed with the given layer as the root.
index e7469d5..f9c5f6e 100644 (file)
@@ -34,6 +34,7 @@
 #include "CachedImage.h"
 #include "Chrome.h"
 #include "DocumentTimeline.h"
+#include "EventRegion.h"
 #include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
@@ -51,7 +52,6 @@
 #include "PerformanceLoggingClient.h"
 #include "PluginViewBase.h"
 #include "ProgressTracker.h"
-#include "Region.h"
 #include "RenderFragmentContainer.h"
 #include "RenderFragmentedFlow.h"
 #include "RenderHTMLCanvas.h"
@@ -1449,15 +1449,9 @@ void RenderLayerBacking::updateEventRegion()
     GraphicsContext nullContext(nullptr);
     RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, compositedBounds(), { }, LayoutSize());
 
-    Region eventRegion;
+    EventRegion eventRegion;
     paintingInfo.eventRegion = &eventRegion;
 
-#if ENABLE(POINTER_EVENTS)
-    TouchActionRegion touchActionRegion;
-    if (hasTouchActionElements)
-        paintingInfo.touchActionRegion = &touchActionRegion;
-#endif
-
     auto paintFlags = RenderLayer::paintLayerPaintingCompositingAllPhasesFlags() | RenderLayer::PaintLayerCollectingEventRegion;
     m_owningLayer.paintLayerContents(nullContext, paintingInfo, paintFlags);
 
@@ -1465,10 +1459,6 @@ void RenderLayerBacking::updateEventRegion()
     eventRegion.translate(contentOffset);
     m_graphicsLayer->setEventRegion(WTFMove(eventRegion));
 
-#if ENABLE(POINTER_EVENTS)
-    touchActionRegion.translate(contentOffset);
-    m_graphicsLayer->setTouchActionRegion(WTFMove(touchActionRegion));
-#endif
 #endif
 }
 
index 725a47d..4b86fe2 100644 (file)
@@ -26,6 +26,7 @@
 #include "RenderLayerModelObject.h"
 
 #include "RenderLayer.h"
+#include "RenderLayerBacking.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "Settings.h"
index 1848e58..8b7082a 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "BidiRun.h"
 #include "BidiRunList.h"
+#include "EventRegion.h"
 #include "FontCache.h"
 #include "Frame.h"
 #include "GraphicsContext.h"
@@ -83,7 +84,7 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai
         paintRect.moveBy(-paintOffset);
         for (auto run : layout.runResolver().rangeForRect(paintRect)) {
             FloatRect visualOverflowRect = computeOverflow(flow, run.rect());
-            paintInfo.eventRegion->unite(enclosingIntRect(visualOverflowRect));
+            paintInfo.eventRegion->unite(enclosingIntRect(visualOverflowRect), flow.style());
         }
         return;
     }
diff --git a/Source/WebCore/rendering/TouchActionRegion.h b/Source/WebCore/rendering/TouchActionRegion.h
deleted file mode 100644 (file)
index 537e981..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(POINTER_EVENTS)
-
-#include "Region.h"
-#include "TouchAction.h"
-#include <wtf/OptionSet.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class TouchActionRegion {
-public:
-    WEBCORE_EXPORT TouchActionRegion();
-
-    bool isEmpty() const { return m_regions.isEmpty(); }
-
-    bool operator==(const TouchActionRegion& other) const { return m_regions == other.m_regions; }
-
-    WEBCORE_EXPORT void unite(const Region&, OptionSet<TouchAction>);
-    WEBCORE_EXPORT OptionSet<TouchAction> actionsForPoint(const IntPoint&) const;
-    WEBCORE_EXPORT void translate(const IntSize&);
-
-private:
-    friend TextStream& operator<<(TextStream&, const TouchActionRegion&);
-
-    Vector<Region> m_regions;
-};
-
-TextStream& operator<<(TextStream&, const TouchActionRegion&);
-
-}
-
-#endif
index 00f25de..93e1233 100644 (file)
@@ -1,3 +1,22 @@
+2019-04-06  Antti Koivisto  <antti@apple.com>
+
+        Combine event and touch action regions into a single class
+        https://bugs.webkit.org/show_bug.cgi?id=196644
+        <rdar://problem/49643614>
+
+        Reviewed by Darin Adler.
+
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
+        (WebKit::RemoteLayerTreeNode::eventRegion const):
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
+        (WebKit::RemoteLayerTreeNode::setEventRegion):
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::setEventRegion):
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
+
 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
index 26e43df..5917aaa 100644 (file)
@@ -170,7 +170,7 @@ public:
         bool opaque;
         bool contentsHidden;
         bool userInteractionEnabled;
-        WebCore::Region eventRegion;
+        WebCore::EventRegion eventRegion;
     };
 
     explicit RemoteLayerTreeTransaction();
index 26c7597..4a03a28 100644 (file)
@@ -31,8 +31,8 @@
 #import "PlatformCALayerRemote.h"
 #import "WebCoreArgumentCoders.h"
 #import <QuartzCore/QuartzCore.h>
+#import <WebCore/EventRegion.h>
 #import <WebCore/LengthFunctions.h>
-#import <WebCore/Region.h>
 #import <WebCore/TimingFunction.h>
 #import <wtf/text/CString.h>
 #import <wtf/text/TextStream.h>
@@ -508,7 +508,7 @@ bool RemoteLayerTreeTransaction::LayerProperties::decode(IPC::Decoder& decoder,
     }
 
     if (result.changedProperties & EventRegionChanged) {
-        Optional<WebCore::Region> eventRegion;
+        Optional<WebCore::EventRegion> eventRegion;
         decoder >> eventRegion;
         if (!eventRegion)
             return false;
index 700aa13..b0ab408 100644 (file)
@@ -56,8 +56,8 @@ public:
 
     WebCore::GraphicsLayer::PlatformLayerID layerID() const { return m_layerID; }
 
-    const WebCore::Region& eventRegion() const { return m_eventRegion; }
-    void setEventRegion(const WebCore::Region&);
+    const WebCore::EventRegion& eventRegion() const { return m_eventRegion; }
+    void setEventRegion(const WebCore::EventRegion&);
 
     // If empty the layer is scrolled normally by an ancestor scroller.
     const auto& relatedScrollContainerIDs() const { return m_relatedScrollContainerIDs; }
@@ -81,7 +81,7 @@ private:
     RetainPtr<UIView> m_uiView;
 #endif
 
-    WebCore::Region m_eventRegion;
+    WebCore::EventRegion m_eventRegion;
 
     Vector<WebCore::GraphicsLayer::PlatformLayerID> m_relatedScrollContainerIDs;
     WebCore::ScrollPositioningBehavior m_relatedScrollContainerPositioningBehavior { WebCore::ScrollPositioningBehavior::None };
index d898fdf..7805208 100644 (file)
@@ -87,7 +87,7 @@ void RemoteLayerTreeNode::detachFromParent()
     [layer() removeFromSuperlayer];
 }
 
-void RemoteLayerTreeNode::setEventRegion(const WebCore::Region& eventRegion)
+void RemoteLayerTreeNode::setEventRegion(const WebCore::EventRegion& eventRegion)
 {
     m_eventRegion = eventRegion;
 }
index 157061d..452f53b 100644 (file)
@@ -32,6 +32,7 @@
 #import "RemoteLayerTreeContext.h"
 #import "RemoteLayerTreePropertyApplier.h"
 #import <WebCore/AnimationUtilities.h>
+#import <WebCore/EventRegion.h>
 #import <WebCore/GraphicsContext.h>
 #import <WebCore/GraphicsLayerCA.h>
 #import <WebCore/LengthFunctions.h>
@@ -871,7 +872,7 @@ void PlatformCALayerRemote::updateCustomAppearance(GraphicsLayer::CustomAppearan
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
 }
 
-void PlatformCALayerRemote::setEventRegion(const WebCore::Region& eventRegion)
+void PlatformCALayerRemote::setEventRegion(const WebCore::EventRegion& eventRegion)
 {
     if (m_properties.eventRegion == eventRegion)
         return;
index d15ab63..c3198a0 100644 (file)
@@ -174,7 +174,7 @@ public:
     WebCore::GraphicsLayer::CustomAppearance customAppearance() const override;
     void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
 
-    void setEventRegion(const WebCore::Region&) override;
+    void setEventRegion(const WebCore::EventRegion&) override;
 
     WebCore::GraphicsLayer::EmbeddedViewID embeddedViewID() const override;