Changeset 269579 in webkit
- Timestamp:
- Nov 9, 2020 2:20:55 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269578 r269579 1 2020-11-09 Chris Lord <clord@igalia.com> 2 3 [GTK][WPE] Scrolling with mouse wheel doesn't work on iframes with async scrolling enabled 4 https://bugs.webkit.org/show_bug.cgi?id=214179 5 6 Reviewed by Žan Doberšek. 7 8 Implement ScrollingTree::scrollingNodeForPoint in 9 ScrollingTreeNicosia. This fixes overflow and iframe scrolling when 10 async scrolling is enabled on WPE and GTK ports. 11 12 * page/scrolling/ThreadedScrollingTree.h: 13 * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp: 14 (WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateBeforeChildren): 15 * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h: 16 * page/scrolling/nicosia/ScrollingTreeNicosia.cpp: 17 (WebCore::collectDescendantLayersAtPoint): 18 (WebCore::ScrollingTreeNicosia::scrollingNodeForPoint): 19 * page/scrolling/nicosia/ScrollingTreeNicosia.h: 20 * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp: 21 (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::commitStateBeforeChildren): 22 * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h: 23 * platform/graphics/nicosia/NicosiaPlatformLayer.h: 24 (Nicosia::CompositionLayer::flushState): 25 (Nicosia::CompositionLayer::accessPending): 26 1 27 2020-11-09 Chris Lord <clord@igalia.com> 2 28 -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h
r268522 r269579 78 78 void reportSynchronousScrollingReasonsChanged(MonotonicTime, OptionSet<SynchronousScrollingReason>) override; 79 79 80 RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator; 81 80 82 private: 81 83 bool isThreadedScrollingTree() const override { return true; } … … 91 93 92 94 Seconds maxAllowableRenderingUpdateDurationForSynchronization(); 93 94 RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator;95 95 96 96 enum class SynchronizationState : uint8_t { -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp
r269373 r269579 90 90 m_footerLayer = downcast<Nicosia::CompositionLayer>(layer); 91 91 } 92 if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::ScrolledContentsLayer)) { 93 auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer()); 94 ASSERT(scrollLayer); 95 auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer); 96 auto updateScope = compositionLayer.createUpdateScope(); 97 compositionLayer.updateState([nodeID = scrollingNodeID()](Nicosia::CompositionLayer::LayerState& state) { 98 state.scrollingNodeID = nodeID; 99 state.delta.scrollingNodeChanged = true; 100 }); 101 } 92 102 } 93 103 -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h
r269373 r269579 48 48 virtual ~ScrollingTreeFrameScrollingNodeNicosia(); 49 49 50 RefPtr<Nicosia::CompositionLayer> rootContentsLayer() const { return m_rootContentsLayer; } 51 50 52 private: 51 53 ScrollingTreeFrameScrollingNodeNicosia(ScrollingTree&, ScrollingNodeType, ScrollingNodeID); -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.cpp
r250514 r269579 31 31 #if ENABLE(ASYNC_SCROLLING) && USE(NICOSIA) 32 32 33 #include "AsyncScrollingCoordinator.h" 34 #include "NicosiaPlatformLayer.h" 33 35 #include "ScrollingTreeFixedNode.h" 34 36 #include "ScrollingTreeFrameHostingNode.h" … … 74 76 } 75 77 78 using Nicosia::CompositionLayer; 79 80 static void collectDescendantLayersAtPoint(Vector<RefPtr<CompositionLayer>>& layersAtPoint, RefPtr<CompositionLayer> parent, const FloatPoint& point) 81 { 82 bool childExistsAtPoint = false; 83 84 parent->accessPending([&](const CompositionLayer::LayerState& state) { 85 for (auto child : state.children) { 86 bool containsPoint = false; 87 FloatPoint transformedPoint; 88 child->accessPending([&](const CompositionLayer::LayerState& childState) { 89 if (!childState.transform.isInvertible()) 90 return; 91 float originX = childState.anchorPoint.x() * childState.size.width(); 92 float originY = childState.anchorPoint.y() * childState.size.height(); 93 auto transform = *(TransformationMatrix() 94 .translate3d(originX + childState.position.x(), originY + childState.position.y(), childState.anchorPoint.z()) 95 .multiply(childState.transform) 96 .translate3d(-originX, -originY, -childState.anchorPoint.z()).inverse()); 97 auto childPoint = transform.projectPoint(point); 98 if (FloatRect(FloatPoint(), childState.size).contains(childPoint)) { 99 containsPoint = true; 100 transformedPoint.set(childPoint.x(), childPoint.y()); 101 } 102 }); 103 if (containsPoint) { 104 childExistsAtPoint = true; 105 collectDescendantLayersAtPoint(layersAtPoint, child, transformedPoint); 106 } 107 } 108 }); 109 110 if (!childExistsAtPoint) 111 layersAtPoint.append(parent); 112 } 113 114 RefPtr<ScrollingTreeNode> ScrollingTreeNicosia::scrollingNodeForPoint(FloatPoint point) 115 { 116 auto* rootScrollingNode = rootNode(); 117 if (!rootScrollingNode) 118 return nullptr; 119 120 LayerTreeHitTestLocker layerLocker(m_scrollingCoordinator.get()); 121 122 auto rootContentsLayer = static_cast<ScrollingTreeFrameScrollingNodeNicosia*>(rootScrollingNode)->rootContentsLayer(); 123 Vector<RefPtr<CompositionLayer>> layersAtPoint; 124 collectDescendantLayersAtPoint(layersAtPoint, rootContentsLayer, point); 125 126 ScrollingTreeNode* returnNode = nullptr; 127 for (auto layer : WTF::makeReversedRange(layersAtPoint)) { 128 layer->accessCommitted([&](const CompositionLayer::LayerState& state) { 129 auto* scrollingNode = nodeForID(state.scrollingNodeID); 130 if (is<ScrollingTreeScrollingNode>(scrollingNode)) 131 returnNode = scrollingNode; 132 }); 133 if (returnNode) 134 break; 135 } 136 137 return returnNode ? returnNode : rootScrollingNode; 138 } 139 76 140 } // namespace WebCore 77 141 -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.h
r239667 r269579 42 42 43 43 Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) override; 44 45 RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint) final; 44 46 }; 45 47 -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp
r269184 r269579 57 57 ScrollingTreeOverflowScrollingNodeNicosia::~ScrollingTreeOverflowScrollingNodeNicosia() = default; 58 58 59 void ScrollingTreeOverflowScrollingNodeNicosia::commitStateBeforeChildren(const ScrollingStateNode& stateNode) 60 { 61 ScrollingTreeScrollingNode::commitStateBeforeChildren(stateNode); 62 63 const auto& scrollingStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode); 64 if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::ScrolledContentsLayer)) { 65 auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer()); 66 ASSERT(scrollLayer); 67 auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer); 68 auto updateScope = compositionLayer.createUpdateScope(); 69 compositionLayer.updateState([nodeID = scrollingNodeID()](Nicosia::CompositionLayer::LayerState& state) { 70 state.scrollingNodeID = nodeID; 71 state.delta.scrollingNodeChanged = true; 72 }); 73 } 74 } 75 59 76 void ScrollingTreeOverflowScrollingNodeNicosia::commitStateAfterChildren(const ScrollingStateNode& stateNode) 60 77 { -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h
r268522 r269579 45 45 ScrollingTreeOverflowScrollingNodeNicosia(ScrollingTree&, ScrollingNodeID); 46 46 47 void commitStateBeforeChildren(const ScrollingStateNode&) override; 47 48 void commitStateAfterChildren(const ScrollingStateNode&) override; 48 49 -
trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h
r264968 r269579 38 38 #include "NicosiaAnimation.h" 39 39 #include "NicosiaSceneIntegration.h" 40 #include "ScrollTypes.h" 40 41 #include "TransformationMatrix.h" 41 42 #include <wtf/Function.h> … … 135 136 bool repaintCounterChanged : 1; 136 137 bool debugBorderChanged : 1; 138 bool scrollingNodeChanged : 1; 137 139 }; 138 140 uint32_t value { 0 }; … … 199 201 bool visible { false }; 200 202 } debugBorder; 203 204 WebCore::ScrollingNodeID scrollingNodeID { 0 }; 201 205 }; 202 206 … … 267 271 staging.debugBorder = pending.debugBorder; 268 272 273 if (pending.delta.scrollingNodeChanged) 274 staging.scrollingNodeID = pending.scrollingNodeID; 275 269 276 if (pending.delta.backingStoreChanged) 270 277 staging.backingStore = pending.backingStore; … … 292 299 293 300 template<typename T> 301 void accessPending(const T& functor) 302 { 303 LockHolder locker(PlatformLayer::m_state.lock); 304 functor(m_state.pending); 305 } 306 307 template<typename T> 294 308 void accessCommitted(const T& functor) 295 309 {
Note: See TracChangeset
for help on using the changeset viewer.