Diff
Modified: trunk/LayoutTests/ChangeLog (243961 => 243962)
--- trunk/LayoutTests/ChangeLog 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/LayoutTests/ChangeLog 2019-04-06 16:48:58 UTC (rev 243962)
@@ -1,3 +1,15 @@
+2019-04-06 Antti Koivisto <[email protected]>
+
+ 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 <[email protected]>
We should pass minimumEffectiveDeviceWidth to web process on new page creation.
Modified: trunk/LayoutTests/pointerevents/ios/touch-action-region-basic-expected.txt (243961 => 243962)
--- trunk/LayoutTests/pointerevents/ios/touch-action-region-basic-expected.txt 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-basic-expected.txt 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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)
+ )
)
)
)
Modified: trunk/LayoutTests/pointerevents/ios/touch-action-region-layers-expected.txt (243961 => 243962)
--- trunk/LayoutTests/pointerevents/ios/touch-action-region-layers-expected.txt 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-layers-expected.txt 2019-04-06 16:48:58 UTC (rev 243962)
@@ -17,10 +17,10 @@
(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)
+ )
)
)
)
@@ -31,11 +31,11 @@
(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)
+ )
)
)
)
@@ -45,10 +45,10 @@
(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)
+ )
)
)
)
@@ -69,12 +69,12 @@
(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
@@ -88,10 +88,10 @@
(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)
+ )
)
)
)
Modified: trunk/LayoutTests/pointerevents/ios/touch-action-region-pan-x-y-expected.txt (243961 => 243962)
--- trunk/LayoutTests/pointerevents/ios/touch-action-region-pan-x-y-expected.txt 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-region-pan-x-y-expected.txt 2019-04-06 16:48:58 UTC (rev 243962)
@@ -9,24 +9,24 @@
(backgroundColor #FFFFFF)
(event region
(rect (0,0) width=800 height=1021)
- )
- (touch-action region
- (none
- (rect (8,808) width=100 height=100)
+ (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)
+ )
)
- (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)
- )
)
)
)
Modified: trunk/Source/WebCore/ChangeLog (243961 => 243962)
--- trunk/Source/WebCore/ChangeLog 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/ChangeLog 2019-04-06 16:48:58 UTC (rev 243962)
@@ -1,3 +1,69 @@
+2019-04-06 Antti Koivisto <[email protected]>
+
+ 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 <[email protected]>
We should pass minimumEffectiveDeviceWidth to web process on new page creation.
Modified: trunk/Source/WebCore/Sources.txt (243961 => 243962)
--- trunk/Source/WebCore/Sources.txt 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/Sources.txt 2019-04-06 16:48:58 UTC (rev 243962)
@@ -1950,6 +1950,7 @@
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/TextDecorationPainter.cpp
rendering/TextPaintStyle.cpp
rendering/TextPainter.cpp
-rendering/TouchActionRegion.cpp
rendering/TrailingFloatsRootInlineBox.cpp
rendering/line/LineBreaker.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243961 => 243962)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-04-06 16:48:58 UTC (rev 243962)
@@ -4822,7 +4822,7 @@
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 */; };
@@ -14884,8 +14884,8 @@
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>"; };
@@ -26801,6 +26801,8 @@
0F53FB83213B1BB800C40D34 /* CSSFilter.h */,
A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
+ E4A8D21522578DA000A8463C /* EventRegion.cpp */,
+ E4A8D21422578DA000A8463C /* EventRegion.h */,
A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */,
A8CFF04A0A154F09000A4234 /* FixedTableLayout.h */,
94DD79721E54E3A20058FB80 /* FlexibleBoxAlgorithm.cpp */,
@@ -27057,8 +27059,6 @@
1C18DA57181AF6A500C4EF22 /* TextPainter.h */,
E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */,
E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
- E4A8D20C22538FC700A8463C /* TouchActionRegion.cpp */,
- E4A8D20F22538FD100A8463C /* TouchActionRegion.h */,
1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */,
37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
BCA257141293C010007A263D /* VerticalPositionCache.h */,
@@ -29500,7 +29500,6 @@
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 */,
@@ -29786,6 +29785,7 @@
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 */,
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -411,18 +411,11 @@
#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 @@
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()) {
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
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 @@
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;
Modified: trunk/Source/WebCore/platform/graphics/Region.cpp (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/Region.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/Region.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -659,7 +659,6 @@
for (auto& rect : region.rects())
ts << indent << "(rect " << rect << ")\n";
}
- ts << indent;
return ts;
}
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -984,7 +984,7 @@
noteLayerPropertyChanged(WindRuleChanged);
}
-void GraphicsLayerCA::setEventRegion(Region&& eventRegion)
+void GraphicsLayerCA::setEventRegion(EventRegion&& eventRegion)
{
if (eventRegion == m_eventRegion)
return;
@@ -993,17 +993,6 @@
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();
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -124,10 +124,8 @@
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;
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -234,7 +234,7 @@
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;
Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -168,7 +168,7 @@
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;
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (243961 => 243962)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -157,7 +157,7 @@
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;
Copied: trunk/Source/WebCore/rendering/EventRegion.cpp (from rev 243961, trunk/Source/WebCore/rendering/TouchActionRegion.cpp) (0 => 243962)
--- trunk/Source/WebCore/rendering/EventRegion.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/EventRegion.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -0,0 +1,187 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "EventRegion.h"
+
+#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) {
+ case TouchAction::None:
+ return 0;
+ case TouchAction::Manipulation:
+ return 1;
+ case TouchAction::PanX:
+ return 2;
+ case TouchAction::PanY:
+ return 3;
+ case TouchAction::PinchZoom:
+ return 4;
+ case TouchAction::Auto:
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+constexpr TouchAction toTouchAction(unsigned index)
+{
+ switch (index) {
+ case 0:
+ return TouchAction::None;
+ case 1:
+ return TouchAction::Manipulation;
+ case 2:
+ return TouchAction::PanX;
+ case 3:
+ return TouchAction::PanY;
+ case 4:
+ return TouchAction::PinchZoom;
+ default:
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return TouchAction::Auto;
+}
+
+void EventRegion::uniteTouchActions(const Region& touchRegion, OptionSet<TouchAction> touchActions)
+{
+ for (auto touchAction : touchActions) {
+ if (touchAction == TouchAction::Auto)
+ break;
+ auto index = toIndex(touchAction);
+ if (m_touchActionRegions.size() < index + 1)
+ m_touchActionRegions.grow(index + 1);
+ }
+
+ for (unsigned i = 0; i < m_touchActionRegions.size(); ++i) {
+ auto regionTouchAction = toTouchAction(i);
+ if (touchActions.contains(regionTouchAction))
+ m_touchActionRegions[i].unite(touchRegion);
+ else
+ m_touchActionRegions[i].subtract(touchRegion);
+ }
+}
+
+OptionSet<TouchAction> EventRegion::touchActionsForPoint(const IntPoint& point) const
+{
+ OptionSet<TouchAction> actions;
+
+ for (unsigned i = 0; i < m_touchActionRegions.size(); ++i) {
+ if (m_touchActionRegions[i].contains(point)) {
+ auto action = ""
+ actions.add(action);
+ if (action == TouchAction::None || action == TouchAction::Manipulation)
+ break;
+ }
+ }
+
+ return actions;
+}
+
+TextStream& operator<<(TextStream& ts, TouchAction touchAction)
+{
+ switch (touchAction) {
+ case TouchAction::None:
+ return ts << "none";
+ case TouchAction::Manipulation:
+ return ts << "manipulation";
+ case TouchAction::PanX:
+ return ts << "pan-x";
+ case TouchAction::PanY:
+ return ts << "pan-y";
+ case TouchAction::PinchZoom:
+ return ts << "pinch-zoom";
+ case TouchAction::Auto:
+ return ts << "auto";
+ }
+ ASSERT_NOT_REACHED();
+ return ts;
+}
+
+#endif
+
+TextStream& operator<<(TextStream& ts, const EventRegion& eventRegion)
+{
+ 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 << eventRegion.m_touchActionRegions[i];
+ ts << indent << ")\n";
+ }
+ ts << indent << ")\n";
+ }
+#endif
+
+ return ts;
+}
+
+}
Added: trunk/Source/WebCore/rendering/EventRegion.h (0 => 243962)
--- trunk/Source/WebCore/rendering/EventRegion.h (rev 0)
+++ trunk/Source/WebCore/rendering/EventRegion.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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;
+}
+
+}
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
if (paintInfo.phase == PaintPhase::EventRegion) {
if (visibleToHitTesting())
- paintInfo.eventRegion->unite(enclosingIntRect(boxRect));
+ paintInfo.eventRegion->unite(enclosingIntRect(boxRect), renderer().style());
return;
}
Modified: trunk/Source/WebCore/rendering/PaintInfo.h (243961 => 243962)
--- trunk/Source/WebCore/rendering/PaintInfo.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/PaintInfo.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -37,17 +37,13 @@
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 @@
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;
};
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
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;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -4891,9 +4891,6 @@
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));
}
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (243961 => 243962)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -63,6 +63,7 @@
class CSSFilter;
class ClipRects;
class ClipRectsCache;
+class EventRegion;
class HitTestRequest;
class HitTestResult;
class HitTestingTransformState;
@@ -80,10 +81,6 @@
class Scrollbar;
class TransformationMatrix;
-#if ENABLE(POINTER_EVENTS)
-class TouchActionRegion;
-#endif
-
enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf };
@@ -916,10 +913,7 @@
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.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
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,11 +1459,7 @@
eventRegion.translate(contentOffset);
m_graphicsLayer->setEventRegion(WTFMove(eventRegion));
-#if ENABLE(POINTER_EVENTS)
- touchActionRegion.translate(contentOffset);
- m_graphicsLayer->setTouchActionRegion(WTFMove(touchActionRegion));
#endif
-#endif
}
// Return true if the layer changed.
Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -26,6 +26,7 @@
#include "RenderLayerModelObject.h"
#include "RenderLayer.h"
+#include "RenderLayerBacking.h"
#include "RenderLayerCompositor.h"
#include "RenderView.h"
#include "Settings.h"
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
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;
}
Deleted: trunk/Source/WebCore/rendering/TouchActionRegion.cpp (243961 => 243962)
--- trunk/Source/WebCore/rendering/TouchActionRegion.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/TouchActionRegion.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -1,155 +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.
- */
-
-#include "config.h"
-#include "TouchActionRegion.h"
-
-#if ENABLE(POINTER_EVENTS)
-
-namespace WebCore {
-
-constexpr unsigned toIndex(TouchAction touchAction)
-{
- switch (touchAction) {
- case TouchAction::None:
- return 0;
- case TouchAction::Manipulation:
- return 1;
- case TouchAction::PanX:
- return 2;
- case TouchAction::PanY:
- return 3;
- case TouchAction::PinchZoom:
- return 4;
- case TouchAction::Auto:
- break;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-constexpr TouchAction toTouchAction(unsigned index)
-{
- switch (index) {
- case 0:
- return TouchAction::None;
- case 1:
- return TouchAction::Manipulation;
- case 2:
- return TouchAction::PanX;
- case 3:
- return TouchAction::PanY;
- case 4:
- return TouchAction::PinchZoom;
- default:
- break;
- }
- ASSERT_NOT_REACHED();
- return TouchAction::Auto;
-}
-
-TouchActionRegion::TouchActionRegion() = default;
-
-void TouchActionRegion::unite(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);
- }
-
- for (unsigned i = 0; i < m_regions.size(); ++i) {
- auto regionTouchAction = toTouchAction(i);
- if (touchActions.contains(regionTouchAction))
- m_regions[i].unite(touchRegion);
- else
- m_regions[i].subtract(touchRegion);
- }
-}
-
-OptionSet<TouchAction> TouchActionRegion::actionsForPoint(const IntPoint& point) const
-{
- OptionSet<TouchAction> actions;
-
- for (unsigned i = 0; i < m_regions.size(); ++i) {
- if (m_regions[i].contains(point)) {
- auto action = ""
- actions.add(action);
- if (action == TouchAction::None || action == TouchAction::Manipulation)
- break;
- }
- }
-
- return actions;
-}
-
-void TouchActionRegion::translate(const IntSize& offset)
-{
- for (auto& region : m_regions)
- region.translate(offset);
-}
-
-TextStream& operator<<(TextStream& ts, TouchAction touchAction)
-{
- switch (touchAction) {
- case TouchAction::None:
- return ts << "none";
- case TouchAction::Manipulation:
- return ts << "manipulation";
- case TouchAction::PanX:
- return ts << "pan-x";
- case TouchAction::PanY:
- return ts << "pan-y";
- case TouchAction::PinchZoom:
- return ts << "pinch-zoom";
- case TouchAction::Auto:
- return ts << "auto";
- }
- ASSERT_NOT_REACHED();
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, const TouchActionRegion& touchActionRegion)
-{
- ts << "\n";
- {
- for (unsigned i = 0; i < touchActionRegion.m_regions.size(); ++i) {
- if (touchActionRegion.m_regions[i].isEmpty())
- continue;
- TextStream::IndentScope indentScope(ts);
- ts << indent << "(" << toTouchAction(i);
- ts << indent << touchActionRegion.m_regions[i] << ")\n";
- }
- }
- ts << indent;
-
- return ts;
-}
-
-}
-
-#endif
Deleted: trunk/Source/WebCore/rendering/TouchActionRegion.h (243961 => 243962)
--- trunk/Source/WebCore/rendering/TouchActionRegion.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebCore/rendering/TouchActionRegion.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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
Modified: trunk/Source/WebKit/ChangeLog (243961 => 243962)
--- trunk/Source/WebKit/ChangeLog 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/ChangeLog 2019-04-06 16:48:58 UTC (rev 243962)
@@ -1,3 +1,22 @@
+2019-04-06 Antti Koivisto <[email protected]>
+
+ 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 <[email protected]>
We should pass minimumEffectiveDeviceWidth to web process on new page creation.
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h (243961 => 243962)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -170,7 +170,7 @@
bool opaque;
bool contentsHidden;
bool userInteractionEnabled;
- WebCore::Region eventRegion;
+ WebCore::EventRegion eventRegion;
};
explicit RemoteLayerTreeTransaction();
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm (243961 => 243962)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
}
if (result.changedProperties & EventRegionChanged) {
- Optional<WebCore::Region> eventRegion;
+ Optional<WebCore::EventRegion> eventRegion;
decoder >> eventRegion;
if (!eventRegion)
return false;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h (243961 => 243962)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -56,8 +56,8 @@
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 @@
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 };
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm (243961 => 243962)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm 2019-04-06 16:48:58 UTC (rev 243962)
@@ -87,7 +87,7 @@
[layer() removeFromSuperlayer];
}
-void RemoteLayerTreeNode::setEventRegion(const WebCore::Region& eventRegion)
+void RemoteLayerTreeNode::setEventRegion(const WebCore::EventRegion& eventRegion)
{
m_eventRegion = eventRegion;
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp (243961 => 243962)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp 2019-04-06 16:48:58 UTC (rev 243962)
@@ -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 @@
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;
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h (243961 => 243962)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h 2019-04-06 03:41:26 UTC (rev 243961)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h 2019-04-06 16:48:58 UTC (rev 243962)
@@ -174,7 +174,7 @@
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;