Changeset 261602 in webkit
- Timestamp:
- May 13, 2020 12:10:51 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r261597 r261602 1 2020-05-13 Antti Koivisto <antti@apple.com> 2 3 [Wheel event region] Add support for getting wheel event region from ScrollingTree 4 https://bugs.webkit.org/show_bug.cgi?id=211785 5 6 Reviewed by Simon Fraser. 7 8 Add ScrollingTree::eventListenerRegionTypesForPoint. It is not used yet. 9 10 * page/scrolling/ScrollingTree.cpp: 11 (WebCore::ScrollingTree::eventListenerRegionTypesForPoint const): 12 * page/scrolling/ScrollingTree.h: 13 * page/scrolling/mac/ScrollingTreeMac.h: 14 * page/scrolling/mac/ScrollingTreeMac.mm: 15 (collectDescendantLayersAtPoint): 16 (ScrollingTreeMac::eventListenerRegionTypesForPoint const): 17 * platform/graphics/ca/PlatformCALayer.h: 18 * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: 19 * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: 20 (WebCore::PlatformCALayerCocoa::eventRegionContainsPoint const): Deleted. 21 * rendering/EventRegion.cpp: 22 (WebCore::EventRegion::eventListenerRegionTypesForPoint const): 23 * rendering/EventRegion.h: 24 1 25 2020-05-12 Alex Christensen <achristensen@webkit.org> 2 26 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r261558 r261602 171 171 } 172 172 173 OptionSet<EventListenerRegionType> ScrollingTree::eventListenerRegionTypesForPoint(FloatPoint) const 174 { 175 return { }; 176 } 177 173 178 void ScrollingTree::traverseScrollingTree(VisitorFunction&& visitorFunction) 174 179 { -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r261427 r261602 54 54 class ScrollingTreePositionedNode; 55 55 class ScrollingTreeScrollingNode; 56 enum class EventListenerRegionType : uint8_t; 56 57 57 58 class ScrollingTree : public ThreadSafeRefCounted<ScrollingTree> { … … 195 196 196 197 WEBCORE_EXPORT virtual RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint); 198 WEBCORE_EXPORT virtual OptionSet<EventListenerRegionType> eventListenerRegionTypesForPoint(FloatPoint) const; 197 199 virtual void receivedWheelEvent(const PlatformWheelEvent&) { } 198 200 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.h
r258679 r261602 44 44 45 45 RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint) final; 46 OptionSet<EventListenerRegionType> eventListenerRegionTypesForPoint(FloatPoint) const final; 46 47 47 48 void setWheelEventTestMonitor(RefPtr<WheelEventTestMonitor>&&) final; … … 56 57 57 58 // This lock protects the CALayer/PlatformCALayer tree. 58 Lock m_layerHitTestMutex;59 mutable Lock m_layerHitTestMutex; 59 60 60 61 RefPtr<WheelEventTestMonitor> m_wheelEventTestMonitor; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm
r260366 r261602 103 103 FloatPoint boundsOrigin = layer.bounds.origin; 104 104 FloatPoint localPoint = subviewPoint - toFloatSize(boundsOrigin); 105 return platformCALayer->eventRegionContainsPoint(IntPoint(localPoint)); 105 auto* eventRegion = platformCALayer->eventRegion(); 106 return eventRegion && eventRegion->contains(roundedIntPoint(localPoint)); 106 107 } 107 108 … … 185 186 } 186 187 188 OptionSet<EventListenerRegionType> ScrollingTreeMac::eventListenerRegionTypesForPoint(FloatPoint point) const 189 { 190 auto* rootScrollingNode = rootNode(); 191 if (!rootScrollingNode) 192 return { }; 193 194 LockHolder lockHolder(m_layerHitTestMutex); 195 196 auto rootContentsLayer = static_cast<ScrollingTreeFrameScrollingNodeMac*>(rootScrollingNode)->rootContentsLayer(); 197 198 Vector<CALayer *, 16> layersAtPoint; 199 collectDescendantLayersAtPoint(layersAtPoint, rootContentsLayer.get(), point); 200 201 if (layersAtPoint.isEmpty()) 202 return { }; 203 204 auto *hitLayer = layersAtPoint.last(); 205 if (!hitLayer) 206 return { }; 207 208 auto platformCALayer = PlatformCALayer::platformCALayerForLayer((__bridge void*)hitLayer); 209 if (!platformCALayer) 210 return { }; 211 212 auto* eventRegion = platformCALayer->eventRegion(); 213 if (!eventRegion) 214 return { }; 215 216 return eventRegion->eventListenerRegionTypesForPoint(roundedIntPoint(point)); 217 } 218 187 219 void ScrollingTreeMac::lockLayersForHitTesting() 188 220 { -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
r258006 r261602 236 236 virtual void setShapeWindRule(WindRule) = 0; 237 237 238 virtual const EventRegion* eventRegion() const { return nullptr; } 238 239 virtual void setEventRegion(const EventRegion&) { } 239 virtual bool eventRegionContainsPoint(IntPoint) const { return false; }240 240 241 241 #if ENABLE(SCROLLING_THREAD) -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
r257949 r261602 169 169 void updateCustomAppearance(GraphicsLayer::CustomAppearance) override; 170 170 171 const EventRegion* eventRegion() const override { return &m_eventRegion; } 171 172 void setEventRegion(const EventRegion&) override; 172 bool eventRegionContainsPoint(IntPoint) const override;173 173 174 174 #if ENABLE(SCROLLING_THREAD) -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
r261210 r261602 1039 1039 } 1040 1040 1041 bool PlatformCALayerCocoa::eventRegionContainsPoint(IntPoint point) const1042 {1043 return m_eventRegion.contains(point);1044 }1045 1046 1041 GraphicsLayer::EmbeddedViewID PlatformCALayerCocoa::embeddedViewID() const 1047 1042 { -
trunk/Source/WebCore/rendering/EventRegion.cpp
r261279 r261602 230 230 } 231 231 232 OptionSet<EventListenerRegionType> EventRegion::eventListenerRegionTypesForPoint(const IntPoint& point) const 233 { 234 OptionSet<EventListenerRegionType> regionTypes; 235 if (m_wheelEventListenerRegion.contains(point)) 236 regionTypes.add(EventListenerRegionType::Wheel); 237 if (m_nonPassiveWheelEventListenerRegion.contains(point)) 238 regionTypes.add(EventListenerRegionType::NonPassiveWheel); 239 240 return regionTypes; 241 } 242 232 243 #if ENABLE(EDITABLE_REGION) 233 244 -
trunk/Source/WebCore/rendering/EventRegion.h
r261279 r261602 80 80 const Region* regionForTouchAction(TouchAction) const; 81 81 82 OptionSet<EventListenerRegionType> eventListenerRegionTypesForPoint(const IntPoint&) const; 83 82 84 #if ENABLE(EDITABLE_REGION) 83 85 WEBCORE_EXPORT bool containsEditableElementsInRect(const IntRect&) const;
Note: See TracChangeset
for help on using the changeset viewer.