WebKit Bugzilla
Attachment 347805 Details for
Bug 187385
: [Nicosia] Add a platform layer concept
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
platform-layers.patch (text/plain), 108.06 KB, created by
Zan Dobersek
on 2018-08-22 09:19:49 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2018-08-22 09:19:49 PDT
Size:
108.06 KB
patch
obsolete
>diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp b/Source/WebCore/page/scrolling/ScrollingStateTree.cpp >index b33aa0cdafe..0f2dd4cfa96 100644 >--- a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingStateTree.cpp >@@ -263,7 +263,6 @@ ScrollingStateNode* ScrollingStateTree::stateNodeForID(ScrollingNodeID scrollLay > > } // namespace WebCore > >-#ifndef NDEBUG > void showScrollingStateTree(const WebCore::ScrollingStateTree* tree) > { > if (!tree) >@@ -287,6 +286,4 @@ void showScrollingStateTree(const WebCore::ScrollingStateNode* node) > showScrollingStateTree(&node->scrollingStateTree()); > } > >-#endif >- > #endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.h b/Source/WebCore/page/scrolling/ScrollingStateTree.h >index 3b256151ad7..6ae6f33db86 100644 >--- a/Source/WebCore/page/scrolling/ScrollingStateTree.h >+++ b/Source/WebCore/page/scrolling/ScrollingStateTree.h >@@ -99,9 +99,7 @@ private: > > } // namespace WebCore > >-#ifndef NDEBUG > void showScrollingStateTree(const WebCore::ScrollingStateTree*); > void showScrollingStateTree(const WebCore::ScrollingStateNode*); >-#endif > > #endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp >index 830353648ce..ac3d99856a7 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp >@@ -87,6 +87,7 @@ void ScrollingCoordinatorCoordinatedGraphics::commitTreeState() > > auto treeState = scrollingStateTree()->commit(LayerRepresentation::PlatformLayerRepresentation); > ScrollingThread::dispatch([threadedScrollingTree, treeState = WTFMove(treeState)]() mutable { >+ // showScrollingStateTree(treeState.get()); > threadedScrollingTree->commitTreeState(WTFMove(treeState)); > }); > } >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp >index 3d68ae66a8f..190e58aaedc 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp >@@ -26,22 +26,23 @@ > #include "config.h" > #include "ScrollingStateNode.h" > >-#include "GraphicsLayer.h" >-#include "NotImplemented.h" >-#include "ScrollingStateTree.h" >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > >-#if USE(COORDINATED_GRAPHICS) >+#include "NicosiaPlatformLayer.h" >+#include "PlatformLayer.h" > > namespace WebCore { > >-void LayerRepresentation::retainPlatformLayer(void*) >+void LayerRepresentation::retainPlatformLayer(void* typelessLayer) > { >- notImplemented(); >+ if (auto* layer = makePlatformLayerTyped(typelessLayer)) >+ layer->ref(); > } > >-void LayerRepresentation::releasePlatformLayer(void*) >+void LayerRepresentation::releasePlatformLayer(void* typelessLayer) > { >- notImplemented(); >+ if (auto* layer = makePlatformLayerTyped(typelessLayer)) >+ layer->deref(); > } > > PlatformLayer* LayerRepresentation::makePlatformLayerTyped(void* typelessLayer) >@@ -56,4 +57,4 @@ void* LayerRepresentation::makePlatformLayerTypeless(PlatformLayer* layer) > > } // namespace WebCore > >-#endif // USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp >index 6bfca4dfd51..0412a6792dd 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp >@@ -28,7 +28,7 @@ > #include "config.h" > #include "ScrollingTreeCoordinatedGraphics.h" > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > > #include "ScrollingTreeFixedNode.h" > #include "ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h" >@@ -66,4 +66,4 @@ Ref<ScrollingTreeNode> ScrollingTreeCoordinatedGraphics::createScrollingTreeNode > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp >index 22cd1ff7719..55d33de07a5 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp >@@ -28,9 +28,11 @@ > #include "config.h" > #include "ScrollingTreeFixedNode.h" > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > >+#include "ScrollingStateFixedNode.h" > #include "ScrollingTree.h" >+#include "NicosiaPlatformLayer.h" > > namespace WebCore { > >@@ -50,14 +52,44 @@ ScrollingTreeFixedNode::~ScrollingTreeFixedNode() > scrollingTree().fixedOrStickyNodeRemoved(); > } > >-void ScrollingTreeFixedNode::commitStateBeforeChildren(const ScrollingStateNode&) >+void ScrollingTreeFixedNode::commitStateBeforeChildren(const ScrollingStateNode& stateNode) > { >+ auto& fixedNode = downcast<ScrollingStateFixedNode>(stateNode); >+ >+ if (fixedNode.hasChangedProperty(ScrollingStateNode::ScrollLayer)) { >+ Nicosia::PlatformLayer* layer = fixedNode.layer(); >+ m_scrollLayer = downcast<Nicosia::CompositionLayer>(layer); >+ } >+ >+ if (stateNode.hasChangedProperty(ScrollingStateFixedNode::ViewportConstraints)) >+ m_constraints = fixedNode.viewportConstraints(); > } > >-void ScrollingTreeFixedNode::updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&) >+void ScrollingTreeFixedNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) > { >+ FloatPoint layerPosition = m_constraints.layerPositionForViewportRect(fixedPositionRect); >+ layerPosition -= cumulativeDelta; >+ >+ ASSERT(m_scrollLayer); >+ m_scrollLayer->accessState( >+ [this, &layerPosition](Nicosia::CompositionLayer::LayerState& state) >+ { >+ auto& anchorPoint = state.anchorPoint; >+ auto& size = state.size; >+ >+ FloatPoint position = layerPosition - m_constraints.alignmentOffset() >+ + FloatPoint(anchorPoint.x() * size.width(), anchorPoint.y() * size.height()); >+ state.position = position; >+ state.delta.positionChanged = true; >+ }); >+ >+ if (m_children) { >+ FloatSize newDelta = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta; >+ for (auto& child : *m_children) >+ child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, newDelta); >+ } > } > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h >index d0aa8792422..3d5dbb51091 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h >@@ -27,10 +27,13 @@ > > #pragma once > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > > #include "ScrollingTreeNode.h" > >+#include "ScrollingConstraints.h" >+#include <wtf/RefPtr.h> >+ > namespace WebCore { > > class ScrollingTreeFixedNode final : public ScrollingTreeNode { >@@ -43,8 +46,11 @@ private: > > void commitStateBeforeChildren(const ScrollingStateNode&) override; > void updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&) override; >+ >+ RefPtr<Nicosia::CompositionLayer> m_scrollLayer; >+ FixedPositionViewportConstraints m_constraints; > }; > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp >index ecc6f317306..83c3f25635b 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp >@@ -28,7 +28,10 @@ > #include "config.h" > #include "ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h" > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >+ >+#include "NicosiaPlatformLayer.h" >+#include "FrameView.h" > > namespace WebCore { > >@@ -44,25 +47,140 @@ ScrollingTreeFrameScrollingNodeCoordinatedGraphics::ScrollingTreeFrameScrollingN > > ScrollingTreeFrameScrollingNodeCoordinatedGraphics::~ScrollingTreeFrameScrollingNodeCoordinatedGraphics() = default; > >-void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent(const PlatformWheelEvent&) >+void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::commitStateBeforeChildren(const ScrollingStateNode& stateNode) >+{ >+ //fprintf(stderr, "ScrollingTreeFrameScrollingNodeCoordinatedGraphics::commitStateBeforeChildren() changed properties %d\n", >+ // stateNode.changedProperties()); >+ ScrollingTreeFrameScrollingNode::commitStateBeforeChildren(stateNode); >+ const auto& scrollingStateNode = downcast<ScrollingStateFrameScrollingNode>(stateNode); >+ >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::ScrollLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.layer(); >+ m_scrollLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: ScrollLayer %p id %lu\n", m_scrollLayer.get(), m_scrollLayer ? m_scrollLayer->id() : 0); >+ } >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.scrolledContentsLayer(); >+ m_scrolledContentsLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: ScrolledContentsLayer %p id %lu\n", m_scrolledContentsLayer.get(), m_scrolledContentsLayer ? m_scrolledContentsLayer->id() : 0); >+ } >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::CounterScrollingLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.counterScrollingLayer(); >+ m_counterScrollingLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: CounterScrollingLayer %p\n", m_counterScrollingLayer.get()); >+ } >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::InsetClipLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.insetClipLayer(); >+ m_insetClipLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: InsetClipLayer %p\n", m_insetClipLayer.get()); >+ } >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::ContentShadowLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.contentShadowLayer(); >+ m_contentShadowLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: ContentShadowLayer %p\n", m_contentShadowLayer.get()); >+ } >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::HeaderLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.headerLayer(); >+ m_headerLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: HeaderLayer %p\n", m_headerLayer.get()); >+ } >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::FooterLayer)) { >+ Nicosia::PlatformLayer* layer = scrollingStateNode.footerLayer(); >+ m_footerLayer = downcast<Nicosia::CompositionLayer>(layer); >+ //fprintf(stderr, "\tchanged property: FooterLayer %p\n", m_footerLayer.get()); >+ } >+} >+ >+void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::commitStateAfterChildren(const ScrollingStateNode& stateNode) > { >+ //fprintf(stderr, "ScrollingTreeFrameScrollingNodeCoordinatedGraphics::commitStateAfterChildren() changed properties %d\n", >+ // stateNode.changedProperties()); >+} >+ >+void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent(const PlatformWheelEvent& wheelEvent) >+{ >+ if (!canHaveScrollbars()) >+ return; >+ >+ scrollBy({ wheelEvent.deltaX(), -wheelEvent.deltaY() }); >+ >+ // TODO: >+ // scrollingTree().setOrClearLatchedNode(wheelEvent, scrollingNodeID()); >+ // scrollingTree().handleWheelEventPhase(wheelEvent.phase()); > } > > FloatPoint ScrollingTreeFrameScrollingNodeCoordinatedGraphics::scrollPosition() const > { >- return { }; >+ ASSERT(m_scrollLayer); >+ >+ FloatPoint scrollPosition; >+ m_scrollLayer->accessState( >+ [&scrollPosition](const Nicosia::CompositionLayer::LayerState& state) >+ { >+ scrollPosition = -state.position; >+ }); >+ return scrollPosition; > } > >-void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition(const FloatPoint&) >+void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition(const FloatPoint& position) > { >+ ScrollingTreeFrameScrollingNode::setScrollPosition(position); > } > >-void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&) >+void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints(const FloatPoint& scrollPosition) > { >+ std::optional<FloatPoint> layoutViewportOrigin; >+ if (scrollingTree().visualViewportEnabled()) { >+ FloatPoint visibleContentOrigin = scrollPosition; >+ FloatRect newLayoutViewport = layoutViewportForScrollPosition(visibleContentOrigin, frameScaleFactor()); >+ setLayoutViewport(newLayoutViewport); >+ layoutViewportOrigin = newLayoutViewport.location(); >+ } >+ >+ setScrollLayerPosition(scrollPosition, layoutViewport()); >+ scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, layoutViewportOrigin); > } > >-void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition(const FloatPoint&, const FloatRect&) >+void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect& layoutViewport) > { >+ //fprintf(stderr, "ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition() position (%.2f,%.2f) layoutViewport (%.2f,%.2f)x(%.2f,%.2f)\n", >+ // scrollPosition.x(), scrollPosition.y(), >+ // layoutViewport.x(), layoutViewport.y(), layoutViewport.width(), layoutViewport.height()); >+ >+ auto updateScope = m_scrollLayer->createUpdateScope(); >+ >+ ASSERT(m_scrollLayer); >+ m_scrollLayer->accessState( >+ [&scrollPosition](Nicosia::CompositionLayer::LayerState& state) >+ { >+ state.position = -scrollPosition; >+ state.delta.positionChanged = true; >+ }); >+ >+ FloatRect visibleContentRect(scrollPosition, scrollableAreaSize()); >+ FloatRect fixedPositionRect; >+ ScrollBehaviorForFixedElements behaviorForFixed = StickToViewportBounds; >+ >+ if (scrollingTree().visualViewportEnabled()) >+ fixedPositionRect = layoutViewport; >+ else { >+ behaviorForFixed = scrollBehaviorForFixedElements(); >+ >+ FloatPoint scrollPositionForFixedChildren = FrameView::scrollPositionForFixedPosition(enclosingLayoutRect(visibleContentRect), LayoutSize(totalContentsSize()), >+ LayoutPoint(scrollPosition), scrollOrigin(), frameScaleFactor(), fixedElementsLayoutRelativeToFrame(), behaviorForFixed, headerHeight(), footerHeight()); >+ >+ fixedPositionRect = { scrollPositionForFixedChildren, visibleContentRect.size() }; >+ } >+ >+ float topContentInset = this->topContentInset(); >+ if (m_insetClipLayer && m_scrolledContentsLayer && topContentInset) { >+ // TODO: ... >+ } >+ >+ if (m_children) { >+ for (auto& child : *m_children) >+ child->updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize()); >+ } > } > > void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewportChange(const FloatRect&, double) >@@ -71,4 +189,4 @@ void ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewpo > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h >index 65086cc92bd..be7bd676ab2 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h >@@ -27,10 +27,12 @@ > > #pragma once > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > > #include "ScrollingTreeFrameScrollingNode.h" > >+#include <wtf/RefPtr.h> >+ > namespace WebCore { > > class ScrollingTreeFrameScrollingNodeCoordinatedGraphics final : public ScrollingTreeFrameScrollingNode { >@@ -41,6 +43,9 @@ public: > private: > ScrollingTreeFrameScrollingNodeCoordinatedGraphics(ScrollingTree&, ScrollingNodeType, ScrollingNodeID); > >+ void commitStateBeforeChildren(const ScrollingStateNode&) override; >+ void commitStateAfterChildren(const ScrollingStateNode&) override; >+ > void handleWheelEvent(const PlatformWheelEvent&) override; > > FloatPoint scrollPosition() const override; >@@ -49,8 +54,16 @@ private: > void setScrollLayerPosition(const FloatPoint&, const FloatRect&) override; > > void updateLayersAfterViewportChange(const FloatRect&, double) override; >+ >+ RefPtr<Nicosia::CompositionLayer> m_scrollLayer; >+ RefPtr<Nicosia::CompositionLayer> m_scrolledContentsLayer; >+ RefPtr<Nicosia::CompositionLayer> m_counterScrollingLayer; >+ RefPtr<Nicosia::CompositionLayer> m_insetClipLayer; >+ RefPtr<Nicosia::CompositionLayer> m_contentShadowLayer; >+ RefPtr<Nicosia::CompositionLayer> m_headerLayer; >+ RefPtr<Nicosia::CompositionLayer> m_footerLayer; > }; > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp >index 0322e676a68..9ed58ea0b0a 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp >@@ -28,9 +28,13 @@ > #include "config.h" > #include "ScrollingTreeStickyNode.h" > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > >+#include "ScrollingStateStickyNode.h" > #include "ScrollingTree.h" >+#include "ScrollingTreeFrameScrollingNode.h" >+#include "ScrollingTreeOverflowScrollingNode.h" >+#include "NicosiaPlatformLayer.h" > > namespace WebCore { > >@@ -50,14 +54,59 @@ ScrollingTreeStickyNode::~ScrollingTreeStickyNode() > scrollingTree().fixedOrStickyNodeRemoved(); > } > >-void ScrollingTreeStickyNode::commitStateBeforeChildren(const ScrollingStateNode&) >+void ScrollingTreeStickyNode::commitStateBeforeChildren(const ScrollingStateNode& stateNode) > { >+ auto& stickyNode = downcast<ScrollingStateStickyNode>(stateNode); >+ >+ if (stickyNode.hasChangedProperty(ScrollingStateNode::ScrollLayer)) { >+ Nicosia::PlatformLayer* layer = stickyNode.layer(); >+ m_scrollLayer = downcast<Nicosia::CompositionLayer>(layer); >+ } >+ >+ if (stateNode.hasChangedProperty(ScrollingStateStickyNode::ViewportConstraints)) >+ m_constraints = stickyNode.viewportConstraints(); > } > >-void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&) >+void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) > { >+ bool adjustStickyLayer = false; >+ FloatRect constrainingRect; >+ >+ if (is<ScrollingTreeOverflowScrollingNode>(*parent())) { >+ constrainingRect = FloatRect(downcast<ScrollingTreeOverflowScrollingNode>(*parent()).scrollPosition(), m_constraints.constrainingRectAtLastLayout().size()); >+ adjustStickyLayer = true; >+ } else if (is<ScrollingTreeFrameScrollingNode>(*parent())) { >+ constrainingRect = fixedPositionRect; >+ adjustStickyLayer = true; >+ } >+ >+ FloatSize deltaForDescendants = cumulativeDelta; >+ >+ if (adjustStickyLayer) { >+ FloatPoint layerPosition = m_constraints.layerPositionForConstrainingRect(constrainingRect); >+ >+ ASSERT(m_scrollLayer); >+ m_scrollLayer->accessState( >+ [this, &layerPosition](Nicosia::CompositionLayer::LayerState& state) >+ { >+ auto& anchorPoint = state.anchorPoint; >+ auto& size = state.size; >+ >+ FloatPoint position = layerPosition - m_constraints.alignmentOffset() >+ + FloatPoint(anchorPoint.x() * size.width(), anchorPoint.y() * size.height()); >+ state.position = position; >+ state.delta.positionChanged = true; >+ }); >+ >+ deltaForDescendants = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta; >+ } >+ >+ if (m_children) { >+ for (auto& child : *m_children) >+ child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, deltaForDescendants); >+ } > } > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h >index f3133a708c7..eb18f4cefe2 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h >@@ -27,10 +27,13 @@ > > #pragma once > >-#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#if ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) > > #include "ScrollingTreeNode.h" > >+#include "ScrollingConstraints.h" >+#include <wtf/RefPtr.h> >+ > namespace WebCore { > > class ScrollingTreeStickyNode final : public ScrollingTreeNode { >@@ -43,8 +46,11 @@ private: > > void commitStateBeforeChildren(const ScrollingStateNode&) override; > void updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&) override; >+ >+ RefPtr<Nicosia::CompositionLayer> m_scrollLayer; >+ StickyPositionViewportConstraints m_constraints; > }; > > } // namespace WebCore > >-#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) >+#endif // ENABLE(ASYNC_SCROLLING) && USE(COORDINATED_GRAPHICS) && USE(NICOSIA) >diff --git a/Source/WebCore/platform/TextureMapper.cmake b/Source/WebCore/platform/TextureMapper.cmake >index 4b49962360a..499fed8d053 100644 >--- a/Source/WebCore/platform/TextureMapper.cmake >+++ b/Source/WebCore/platform/TextureMapper.cmake >@@ -35,7 +35,6 @@ if (USE_COORDINATED_GRAPHICS) > > platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp > platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >- platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp > platform/graphics/texmap/coordinated/Tile.cpp > platform/graphics/texmap/coordinated/TiledBackingStore.cpp > ) >@@ -54,6 +53,7 @@ if (USE_COORDINATED_GRAPHICS) > platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp > platform/graphics/nicosia/NicosiaPlatformLayer.cpp > platform/graphics/nicosia/NicosiaScene.cpp >+ platform/graphics/nicosia/NicosiaSceneIntegration.cpp > > platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp > platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >index 49f22db4d1d..c1acd00003a 100644 >--- a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >@@ -34,6 +34,7 @@ > #include "FloatPoint3D.h" > #include "FloatRect.h" > #include "FloatSize.h" >+#include "NicosiaSceneIntegration.h" > #include "TextureMapperAnimation.h" > #include "TransformationMatrix.h" > #include <wtf/Function.h> >@@ -50,7 +51,29 @@ public: > virtual bool isCompositionLayer() const { return false; } > virtual bool isContentLayer() const { return false; } > >- uint64_t id() const { return m_id; } >+ using LayerID = uint64_t; >+ LayerID id() const { return m_id; } >+ >+ void setSceneIntegration(RefPtr<SceneIntegration>&& sceneIntegration) >+ { >+ LockHolder locker(m_state.lock); >+ m_state.sceneIntegration = WTFMove(sceneIntegration); >+ } >+ >+ std::unique_ptr<SceneIntegration::UpdateScope> createUpdateScope() >+ { >+ LockHolder locker(m_state.lock); >+ if (m_state.sceneIntegration) >+ return m_state.sceneIntegration->createUpdateScope(); >+ return nullptr; >+ } >+ >+ void requestUpdate() >+ { >+ LockHolder locker(m_state.lock); >+ if (m_state.sceneIntegration) >+ m_state.sceneIntegration->requestUpdate(); >+ } > > protected: > explicit PlatformLayer(uint64_t); >@@ -59,6 +82,7 @@ protected: > > struct { > Lock lock; >+ RefPtr<SceneIntegration> sceneIntegration; > } m_state; > }; > >@@ -173,6 +197,24 @@ public: > } debugBorder; > }; > >+ template<typename T> >+ void accessState(const T& functor) >+ { >+ LockHolder locker(PlatformLayer::m_state.lock); >+ functor(m_state.pending); >+ } >+ >+ template<typename T> >+ void accessStateAndUpdate(const T& functor) >+ { >+ LockHolder locker(PlatformLayer::m_state.lock); >+ functor(m_state.pending); >+ >+ auto& sceneIntegration = PlatformLayer::m_state.sceneIntegration; >+ if (sceneIntegration) >+ sceneIntegration->requestUpdate(); >+ } >+ > template<typename T> > void updateState(const T& functor) > { >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp b/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp >new file mode 100644 >index 00000000000..6892e664f10 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp >@@ -0,0 +1,49 @@ >+#include "config.h" >+#include "NicosiaSceneIntegration.h" >+ >+namespace Nicosia { >+ >+SceneIntegration::SceneIntegration(Client& client) >+{ >+ m_client.object = &client; >+} >+ >+SceneIntegration::~SceneIntegration() >+{ >+ ASSERT(!m_client.object); >+} >+ >+void SceneIntegration::invalidate() >+{ >+ LockHolder locker(m_client.lock); >+ m_client.object = nullptr; >+} >+ >+void SceneIntegration::requestUpdate() >+{ >+ LockHolder locker(m_client.lock); >+ if (m_client.object) >+ m_client.object->requestUpdate(); >+} >+ >+std::unique_ptr<SceneIntegration::UpdateScope> SceneIntegration::createUpdateScope() >+{ >+ return std::make_unique<UpdateScope>(makeRef(*this)); >+} >+ >+SceneIntegration::Client::~Client() = default; >+ >+SceneIntegration::UpdateScope::UpdateScope(Ref<SceneIntegration>&& sceneIntegration) >+ : m_sceneIntegration(WTFMove(sceneIntegration)) >+ , m_locker(m_sceneIntegration->m_client.lock) >+{ >+} >+ >+SceneIntegration::UpdateScope::~UpdateScope() >+{ >+ auto& sceneIntegrationObj = m_sceneIntegration.get(); >+ if (sceneIntegrationObj.m_client.object) >+ sceneIntegrationObj.m_client.object->requestUpdate(); >+} >+ >+} // namespace Nicosia >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.h b/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.h >new file mode 100644 >index 00000000000..bf59fd336fa >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.h >@@ -0,0 +1,45 @@ >+#pragma once >+ >+#include <memory> >+#include <wtf/Lock.h> >+#include <wtf/Ref.h> >+#include <wtf/ThreadSafeRefCounted.h> >+ >+namespace Nicosia { >+ >+class SceneIntegration : public ThreadSafeRefCounted<SceneIntegration> { >+public: >+ class Client { >+ public: >+ virtual ~Client(); >+ >+ virtual void requestUpdate() = 0; >+ }; >+ >+ SceneIntegration(Client&); >+ ~SceneIntegration(); >+ >+ void invalidate(); >+ >+ void requestUpdate(); >+ >+ class UpdateScope { >+ public: >+ UpdateScope(Ref<SceneIntegration>&&); >+ ~UpdateScope(); >+ >+ private: >+ Ref<SceneIntegration> m_sceneIntegration; >+ LockHolder m_locker; >+ }; >+ >+ std::unique_ptr<UpdateScope> createUpdateScope(); >+ >+private: >+ struct { >+ Lock lock; >+ Client* object { nullptr }; >+ } m_client; >+}; >+ >+} // namespace Nicosia >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >index 59db0f592ad..117d9184541 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >@@ -38,6 +38,7 @@ > #include "NicosiaPaintingEngine.h" > #include "ScrollableArea.h" > #include "TextureMapperPlatformLayerProxyProvider.h" >+#include "TiledBackingStore.h" > #ifndef NDEBUG > #include <wtf/SetForScope.h> > #endif >@@ -53,11 +54,6 @@ std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* facto > return factory->createGraphicsLayer(layerType, client); > } > >-static CoordinatedLayerID toCoordinatedLayerID(GraphicsLayer* layer) >-{ >- return is<CoordinatedGraphicsLayer>(layer) ? downcast<CoordinatedGraphicsLayer>(*layer).id() : 0; >-} >- > void CoordinatedGraphicsLayer::notifyFlushRequired() > { > if (!m_coordinator) >@@ -69,33 +65,21 @@ void CoordinatedGraphicsLayer::notifyFlushRequired() > client().notifyFlushRequired(this); > } > >-void CoordinatedGraphicsLayer::didChangeLayerState() >-{ >- m_shouldSyncLayerState = true; >- notifyFlushRequired(); >-} >- > void CoordinatedGraphicsLayer::didChangeAnimations() > { >- m_shouldSyncAnimations = true; >+ m_nicosia.delta.animationsChanged = true; > notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::didChangeChildren() > { >- m_shouldSyncChildren = true; >+ m_nicosia.delta.childrenChanged = true; > notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::didChangeFilters() > { >- m_shouldSyncFilters = true; >- notifyFlushRequired(); >-} >- >-void CoordinatedGraphicsLayer::didChangeImageBacking() >-{ >- m_shouldSyncImageBacking = true; >+ m_nicosia.delta.filtersChanged = true; > notifyFlushRequired(); > } > >@@ -105,8 +89,6 @@ void CoordinatedGraphicsLayer::didUpdateTileBuffers() > return; > > auto repaintCount = incrementRepaintCount(); >- m_layerState.repaintCount.count = repaintCount; >- m_layerState.repaintCountChanged = true; > m_nicosia.repaintCounter.count = repaintCount; > m_nicosia.delta.repaintCounterChanged = true; > } >@@ -122,7 +104,7 @@ void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect() > > void CoordinatedGraphicsLayer::didChangeGeometry() > { >- didChangeLayerState(); >+ notifyFlushRequired(); > setShouldUpdateVisibleRect(); > } > >@@ -132,28 +114,24 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayer > , m_isPurging(false) > #endif > , m_shouldUpdateVisibleRect(true) >- , m_shouldSyncLayerState(true) >- , m_shouldSyncChildren(true) >- , m_shouldSyncFilters(true) >- , m_shouldSyncImageBacking(true) >- , m_shouldSyncAnimations(true) > , m_movingVisibleRect(false) > , m_pendingContentsScaleAdjustment(false) > , m_pendingVisibleRectAdjustment(false) > #if USE(COORDINATED_GRAPHICS_THREADED) >- , m_shouldSyncPlatformLayer(false) > , m_shouldUpdatePlatformLayer(false) > #endif > , m_coordinator(0) > , m_compositedNativeImagePtr(0) >- , m_platformLayer(0) > , m_animationStartedTimer(*this, &CoordinatedGraphicsLayer::animationStartedTimerFired) > { >- static CoordinatedLayerID nextLayerID = 1; >+ static Nicosia::PlatformLayer::LayerID nextLayerID = 1; > m_id = nextLayerID++; > > m_nicosia.layer = Nicosia::CompositionLayer::create(m_id, > Nicosia::CompositionLayerTextureMapperImpl::createFactory()); >+ >+ // Hey, what can you do. >+ m_nicosia.delta.value = UINT_MAX; > } > > CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer() >@@ -162,8 +140,6 @@ CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer() > purgeBackingStores(); > m_coordinator->detachLayer(this); > } >- ASSERT(!m_coordinatedImageBacking); >- ASSERT(!m_mainBackingStore); > ASSERT(!m_nicosia.imageBacking); > ASSERT(!m_nicosia.backingStore); > willBeDestroyed(); >@@ -229,18 +205,26 @@ void CoordinatedGraphicsLayer::setPosition(const FloatPoint& p) > return; > > GraphicsLayer::setPosition(p); >- m_layerState.positionChanged = true; > m_nicosia.delta.positionChanged = true; > didChangeGeometry(); > } > >+void CoordinatedGraphicsLayer::syncPosition(const FloatPoint& p) >+{ >+ if (position() == p) >+ return; >+ >+ GraphicsLayer::syncPosition(p); >+ m_nicosia.delta.positionChanged = true; >+ setShouldUpdateVisibleRect(); >+} >+ > void CoordinatedGraphicsLayer::setAnchorPoint(const FloatPoint3D& p) > { > if (anchorPoint() == p) > return; > > GraphicsLayer::setAnchorPoint(p); >- m_layerState.anchorPointChanged = true; > m_nicosia.delta.anchorPointChanged = true; > didChangeGeometry(); > } >@@ -251,7 +235,6 @@ void CoordinatedGraphicsLayer::setSize(const FloatSize& size) > return; > > GraphicsLayer::setSize(size); >- m_layerState.sizeChanged = true; > m_nicosia.delta.sizeChanged = true; > > if (maskLayer()) >@@ -265,7 +248,6 @@ void CoordinatedGraphicsLayer::setTransform(const TransformationMatrix& t) > return; > > GraphicsLayer::setTransform(t); >- m_layerState.transformChanged = true; > m_nicosia.delta.transformChanged = true; > > didChangeGeometry(); >@@ -277,7 +259,6 @@ void CoordinatedGraphicsLayer::setChildrenTransform(const TransformationMatrix& > return; > > GraphicsLayer::setChildrenTransform(t); >- m_layerState.childrenTransformChanged = true; > m_nicosia.delta.childrenTransformChanged = true; > > didChangeGeometry(); >@@ -289,8 +270,6 @@ void CoordinatedGraphicsLayer::setPreserves3D(bool b) > return; > > GraphicsLayer::setPreserves3D(b); >- m_layerState.preserves3D = b; >- m_layerState.flagsChanged = true; > m_nicosia.delta.flagsChanged = true; > > didChangeGeometry(); >@@ -301,8 +280,6 @@ void CoordinatedGraphicsLayer::setMasksToBounds(bool b) > if (masksToBounds() == b) > return; > GraphicsLayer::setMasksToBounds(b); >- m_layerState.masksToBounds = b; >- m_layerState.flagsChanged = true; > m_nicosia.delta.flagsChanged = true; > > didChangeGeometry(); >@@ -313,11 +290,9 @@ void CoordinatedGraphicsLayer::setDrawsContent(bool b) > if (drawsContent() == b) > return; > GraphicsLayer::setDrawsContent(b); >- m_layerState.drawsContent = b; >- m_layerState.flagsChanged = true; > m_nicosia.delta.flagsChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setContentsVisible(bool b) >@@ -325,14 +300,12 @@ void CoordinatedGraphicsLayer::setContentsVisible(bool b) > if (contentsAreVisible() == b) > return; > GraphicsLayer::setContentsVisible(b); >- m_layerState.contentsVisible = b; >- m_layerState.flagsChanged = true; > m_nicosia.delta.flagsChanged = true; > > if (maskLayer()) > maskLayer()->setContentsVisible(b); > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setContentsOpaque(bool b) >@@ -341,8 +314,6 @@ void CoordinatedGraphicsLayer::setContentsOpaque(bool b) > return; > > GraphicsLayer::setContentsOpaque(b); >- m_layerState.contentsOpaque = b; >- m_layerState.flagsChanged = true; > m_nicosia.delta.flagsChanged = true; > > // Demand a repaint of the whole layer. >@@ -353,7 +324,7 @@ void CoordinatedGraphicsLayer::setContentsOpaque(bool b) > addRepaintRect({ { }, m_size }); > } > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b) >@@ -362,11 +333,9 @@ void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b) > return; > > GraphicsLayer::setBackfaceVisibility(b); >- m_layerState.backfaceVisible = b; >- m_layerState.flagsChanged = true; > m_nicosia.delta.flagsChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setOpacity(float opacity) >@@ -375,11 +344,9 @@ void CoordinatedGraphicsLayer::setOpacity(float opacity) > return; > > GraphicsLayer::setOpacity(opacity); >- m_layerState.opacity = opacity; >- m_layerState.opacityChanged = true; > m_nicosia.delta.opacityChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setContentsRect(const FloatRect& r) >@@ -388,11 +355,9 @@ void CoordinatedGraphicsLayer::setContentsRect(const FloatRect& r) > return; > > GraphicsLayer::setContentsRect(r); >- m_layerState.contentsRect = r; >- m_layerState.contentsRectChanged = true; > m_nicosia.delta.contentsRectChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setContentsTileSize(const FloatSize& s) >@@ -401,10 +366,8 @@ void CoordinatedGraphicsLayer::setContentsTileSize(const FloatSize& s) > return; > > GraphicsLayer::setContentsTileSize(s); >- m_layerState.contentsTileSize = s; >- m_layerState.contentsTilingChanged = true; > m_nicosia.delta.contentsTilingChanged = true; >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setContentsTilePhase(const FloatSize& p) >@@ -413,10 +376,8 @@ void CoordinatedGraphicsLayer::setContentsTilePhase(const FloatSize& p) > return; > > GraphicsLayer::setContentsTilePhase(p); >- m_layerState.contentsTilePhase = p; >- m_layerState.contentsTilingChanged = true; > m_nicosia.delta.contentsTilingChanged = true; >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > bool GraphicsLayer::supportsContentsTiling() >@@ -427,13 +388,8 @@ bool GraphicsLayer::supportsContentsTiling() > void CoordinatedGraphicsLayer::setContentsNeedsDisplay() > { > #if USE(COORDINATED_GRAPHICS_THREADED) >-#if USE(NICOSIA) > if (m_nicosia.contentLayer) > m_shouldUpdatePlatformLayer = true; >-#else >- if (m_platformLayer) >- m_shouldUpdatePlatformLayer = true; >-#endif > #endif > > notifyFlushRequired(); >@@ -443,19 +399,12 @@ void CoordinatedGraphicsLayer::setContentsNeedsDisplay() > void CoordinatedGraphicsLayer::setContentsToPlatformLayer(PlatformLayer* platformLayer, ContentsLayerPurpose) > { > #if USE(COORDINATED_GRAPHICS_THREADED) >-#if USE(NICOSIA) > auto* contentLayer = downcast<Nicosia::ContentLayer>(platformLayer); > if (m_nicosia.contentLayer != contentLayer) { >- m_shouldSyncPlatformLayer = true; > m_nicosia.contentLayer = contentLayer; > m_nicosia.delta.contentLayerChanged = true; > } >-#else >- if (m_platformLayer != platformLayer) >- m_shouldSyncPlatformLayer = true; > >- m_platformLayer = platformLayer; >-#endif > notifyFlushRequired(); > #else > UNUSED_PARAM(platformLayer); >@@ -499,11 +448,9 @@ void CoordinatedGraphicsLayer::setContentsToSolidColor(const Color& color) > return; > > m_solidColor = color; >- m_layerState.solidColor = color; >- m_layerState.solidColorChanged = true; > m_nicosia.delta.solidColorChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setShowDebugBorder(bool show) >@@ -512,12 +459,13 @@ void CoordinatedGraphicsLayer::setShowDebugBorder(bool show) > return; > > GraphicsLayer::setShowDebugBorder(show); >- m_layerState.debugVisuals.showDebugBorders = show; >- m_layerState.debugVisualsChanged = true; > m_nicosia.debugBorder.visible = show; > m_nicosia.delta.debugBorderChanged = true; > >- didChangeLayerState(); >+ if (m_nicosia.debugBorder.visible) >+ updateDebugIndicators(); >+ >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show) >@@ -526,12 +474,10 @@ void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show) > return; > > GraphicsLayer::setShowRepaintCounter(show); >- m_layerState.repaintCount.showRepaintCounter = show; >- m_layerState.repaintCountChanged = true; > m_nicosia.repaintCounter.visible = show; > m_nicosia.delta.repaintCounterChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setContentsToImage(Image* image) >@@ -544,7 +490,7 @@ void CoordinatedGraphicsLayer::setContentsToImage(Image* image) > m_compositedNativeImagePtr = nativeImagePtr; > > GraphicsLayer::setContentsToImage(image); >- didChangeImageBacking(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) >@@ -559,14 +505,10 @@ void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) > > layer->setSize(size()); > layer->setContentsVisible(contentsAreVisible()); >- auto& coordinatedLayer = downcast<CoordinatedGraphicsLayer>(*layer); >- coordinatedLayer.didChangeLayerState(); > >- m_layerState.mask = coordinatedLayer.id(); >- m_layerState.maskChanged = true; > m_nicosia.delta.maskChanged = true; > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > bool CoordinatedGraphicsLayer::shouldDirectlyCompositeImage(Image* image) const >@@ -587,10 +529,8 @@ void CoordinatedGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer) > return; > > GraphicsLayer::setReplicatedByLayer(layer); >- m_layerState.replica = toCoordinatedLayerID(layer); >- m_layerState.replicaChanged = true; > m_nicosia.delta.replicaChanged = true; >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setNeedsDisplay() >@@ -601,7 +541,7 @@ void CoordinatedGraphicsLayer::setNeedsDisplay() > m_needsDisplay.completeLayer = true; > m_needsDisplay.rects.clear(); > >- didChangeLayerState(); >+ notifyFlushRequired(); > addRepaintRect({ { }, m_size }); > } > >@@ -628,7 +568,7 @@ void CoordinatedGraphicsLayer::setNeedsDisplayInRect(const FloatRect& initialRec > else > rects[0].unite(rect); > >- didChangeLayerState(); >+ notifyFlushRequired(); > addRepaintRect(rect); > } > >@@ -646,136 +586,20 @@ void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect) > child->flushCompositingState(rect); > } > >-void CoordinatedGraphicsLayer::syncChildren() >-{ >- if (!m_shouldSyncChildren) >- return; >- m_shouldSyncChildren = false; >- m_layerState.childrenChanged = true; >- m_nicosia.delta.childrenChanged = true; >- >- m_layerState.children.clear(); >- for (auto& child : children()) >- m_layerState.children.append(toCoordinatedLayerID(child)); >-} >- >-void CoordinatedGraphicsLayer::syncFilters() >-{ >- if (!m_shouldSyncFilters) >- return; >- m_shouldSyncFilters = false; >- >- m_layerState.filters = GraphicsLayer::filters(); >- m_layerState.filtersChanged = true; >- m_nicosia.delta.filtersChanged = true; >-} >- >-void CoordinatedGraphicsLayer::syncImageBacking() >-{ >- if (!m_shouldSyncImageBacking) >- return; >- m_shouldSyncImageBacking = false; >- >- if (m_compositedNativeImagePtr) { >- ASSERT(!shouldHaveBackingStore()); >- ASSERT(m_compositedImage); >- >- bool imageInstanceReplaced = m_coordinatedImageBacking && (m_coordinatedImageBacking->id() != CoordinatedImageBacking::getCoordinatedImageBackingID(*m_compositedImage)); >- if (imageInstanceReplaced) >- releaseImageBackingIfNeeded(); >- >- if (!m_coordinatedImageBacking) { >- m_coordinatedImageBacking = m_coordinator->createImageBackingIfNeeded(*m_compositedImage); >- m_coordinatedImageBacking->addHost(*this); >- m_layerState.imageID = m_coordinatedImageBacking->id(); >- } >- >- m_coordinatedImageBacking->markDirty(); >- m_layerState.imageChanged = true; >- } else >- releaseImageBackingIfNeeded(); >-} >- >-void CoordinatedGraphicsLayer::syncLayerState() >-{ >- if (!m_shouldSyncLayerState) >- return; >- m_shouldSyncLayerState = false; >- >- m_layerState.childrenTransform = childrenTransform(); >- m_layerState.contentsRect = contentsRect(); >- m_layerState.mask = toCoordinatedLayerID(maskLayer()); >- m_layerState.opacity = opacity(); >- m_layerState.replica = toCoordinatedLayerID(replicaLayer()); >- m_layerState.transform = transform(); >- >- m_layerState.anchorPoint = m_adjustedAnchorPoint; >- m_layerState.pos = m_adjustedPosition; >- m_layerState.size = m_adjustedSize; >- >- if (m_layerState.flagsChanged) { >- m_layerState.contentsOpaque = contentsOpaque(); >- m_layerState.drawsContent = drawsContent(); >- m_layerState.contentsVisible = contentsAreVisible(); >- m_layerState.backfaceVisible = backfaceVisibility(); >- m_layerState.masksToBounds = masksToBounds(); >- m_layerState.preserves3D = preserves3D(); >- } >- >- if (m_layerState.debugVisualsChanged) { >- m_layerState.debugVisuals.showDebugBorders = isShowingDebugBorder(); >- if (m_layerState.debugVisuals.showDebugBorders) >- updateDebugIndicators(); >- } >- if (m_layerState.repaintCountChanged) >- m_layerState.repaintCount.showRepaintCounter = isShowingRepaintCounter(); >-} >- > void CoordinatedGraphicsLayer::setDebugBorder(const Color& color, float width) > { >- ASSERT(m_layerState.debugVisuals.showDebugBorders); >- if (m_layerState.debugVisuals.debugBorderColor != color) { >- m_layerState.debugVisuals.debugBorderColor = color; >- m_layerState.debugVisualsChanged = true; >+ ASSERT(m_nicosia.debugBorder.visible); >+ if (m_nicosia.debugBorder.color != color) { > m_nicosia.debugBorder.color = color; > m_nicosia.delta.debugBorderChanged = true; > } > >- if (m_layerState.debugVisuals.debugBorderWidth != width) { >- m_layerState.debugVisuals.debugBorderWidth = width; >- m_layerState.debugVisualsChanged = true; >+ if (m_nicosia.debugBorder.width != width) { > m_nicosia.debugBorder.width = width; > m_nicosia.delta.debugBorderChanged = true; > } > } > >-void CoordinatedGraphicsLayer::syncAnimations() >-{ >- if (!m_shouldSyncAnimations) >- return; >- >- m_shouldSyncAnimations = false; >- m_layerState.animations = m_animations.getActiveAnimations(); >- m_layerState.animationsChanged = true; >- m_nicosia.delta.animationsChanged = true; >-} >- >-void CoordinatedGraphicsLayer::syncPlatformLayer() >-{ >- if (!m_shouldSyncPlatformLayer) >- return; >- >- m_shouldSyncPlatformLayer = false; >-#if USE(COORDINATED_GRAPHICS_THREADED) >-#if USE(NICOSIA) >-#else >- m_layerState.platformLayerChanged = true; >- if (m_platformLayer) >- m_layerState.platformLayerProxy = m_platformLayer->proxy(); >-#endif >-#endif >-} >- > void CoordinatedGraphicsLayer::updatePlatformLayer() > { > if (!m_shouldUpdatePlatformLayer) >@@ -783,14 +607,8 @@ void CoordinatedGraphicsLayer::updatePlatformLayer() > > m_shouldUpdatePlatformLayer = false; > #if USE(COORDINATED_GRAPHICS_THREADED) >-#if USE(NICOSIA) > if (m_nicosia.contentLayer) > downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosia.contentLayer->impl()).swapBuffersIfNeeded(); >-#else >- m_layerState.platformLayerUpdated = true; >- if (m_platformLayer) >- m_platformLayer->swapBuffersIfNeeded(); >-#endif > #endif > } > >@@ -804,16 +622,7 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > // Sets the values. > computePixelAlignment(m_adjustedPosition, m_adjustedSize, m_adjustedAnchorPoint, m_pixelAlignmentOffset); > >- // FIXME: this is commented out to immediately disable any old-way image updates. >- // It will soon be removed in a larger cleanup. >- // syncImageBacking(); >- >- syncLayerState(); >- syncAnimations(); > computeTransformedVisibleRect(); >- syncChildren(); >- syncFilters(); >- syncPlatformLayer(); > updatePlatformLayer(); > > // Only unset m_movingVisibleRect after we have updated the visible rect after the animation stopped. >@@ -965,13 +774,8 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > > void CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers() > { >- // FIXME: For now the best way for layer state changes to trigger an update is to use >- // the CoordinatedGraphicsLayerClient::syncLayerState() method. This should be simplified >- // once the m_layerState member object is removed. >- if (m_nicosia.performLayerSync || m_layerState.hasPendingChanges()) { >- m_coordinator->syncLayerState(m_id, m_layerState); >- resetLayerState(); >- } >+ if (m_nicosia.performLayerSync) >+ m_coordinator->syncLayerState(); > m_nicosia.performLayerSync = false; > > if (maskLayer()) >@@ -981,32 +785,6 @@ void CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers() > downcast<CoordinatedGraphicsLayer>(*child).syncPendingStateChangesIncludingSubLayers(); > } > >-void CoordinatedGraphicsLayer::resetLayerState() >-{ >- m_layerState.changeMask = 0; >- m_layerState.tilesToCreate.clear(); >- m_layerState.tilesToRemove.clear(); >- m_layerState.tilesToUpdate.clear(); >-} >- >-bool CoordinatedGraphicsLayer::imageBackingVisible() >-{ >- ASSERT(m_coordinatedImageBacking); >- return transformedVisibleRect().intersects(IntRect(contentsRect())); >-} >- >-void CoordinatedGraphicsLayer::releaseImageBackingIfNeeded() >-{ >- if (!m_coordinatedImageBacking) >- return; >- >- ASSERT(m_coordinator); >- m_coordinatedImageBacking->removeHost(*this); >- m_coordinatedImageBacking = nullptr; >- m_layerState.imageID = InvalidCoordinatedImageBackingID; >- m_layerState.imageChanged = true; >-} >- > void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged() > { > if (shouldHaveBackingStore()) >@@ -1018,12 +796,6 @@ float CoordinatedGraphicsLayer::effectiveContentsScale() > return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor(); > } > >-void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation() >-{ >- setNeedsVisibleRectAdjustment(); >- notifyFlushRequired(); >-} >- > static void clampToContentsRectIfRectIsInfinite(FloatRect& rect, const FloatSize& contentsSize) > { > if (rect.width() >= LayoutUnit::nearlyMax() || rect.width() <= LayoutUnit::nearlyMin()) { >@@ -1052,36 +824,6 @@ IntRect CoordinatedGraphicsLayer::transformedVisibleRect() > return enclosingIntRect(rect); > } > >-void CoordinatedGraphicsLayer::createTile(uint32_t tileID, float scaleFactor) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges()); >- >- TileCreationInfo creationInfo; >- creationInfo.tileID = tileID; >- creationInfo.scale = scaleFactor; >- m_layerState.tilesToCreate.append(creationInfo); >-} >- >-void CoordinatedGraphicsLayer::updateTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges()); >- >- TileUpdateInfo tileUpdateInfo; >- tileUpdateInfo.tileID = tileID; >- tileUpdateInfo.tileRect = tileRect; >- tileUpdateInfo.updateInfo = updateInfo; >- m_layerState.tilesToUpdate.append(tileUpdateInfo); >-} >- >-void CoordinatedGraphicsLayer::removeTile(uint32_t tileID) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges() || m_isPurging); >- m_layerState.tilesToRemove.append(tileID); >-} >- > void CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() > { > if (CoordinatedGraphicsLayer* mask = downcast<CoordinatedGraphicsLayer>(maskLayer())) >@@ -1213,8 +955,6 @@ void CoordinatedGraphicsLayer::purgeBackingStores() > #ifndef NDEBUG > SetForScope<bool> updateModeProtector(m_isPurging, true); > #endif >- m_mainBackingStore = nullptr; >- m_previousBackingStore = nullptr; > if (m_nicosia.backingStore) { > auto& layerState = downcast<Nicosia::BackingStoreTextureMapperImpl>(m_nicosia.backingStore->impl()).layerState(); > layerState.isPurging = true; >@@ -1224,9 +964,9 @@ void CoordinatedGraphicsLayer::purgeBackingStores() > m_nicosia.backingStore = nullptr; > } > >- releaseImageBackingIfNeeded(); >+ // FIXME: m_nicosia.imageBacking purge > >- didChangeLayerState(); >+ notifyFlushRequired(); > } > > void CoordinatedGraphicsLayer::setCoordinator(CoordinatedGraphicsLayerClient* coordinator) >@@ -1254,7 +994,7 @@ void CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded(Coordina > // flag value, so the scene won't update it and the layer won't be rendered. > // > // We need to update here the layer changeMask so the scene gets all the current values. >- m_layerState.changeMask = UINT_MAX; >+ m_nicosia.delta.value = UINT_MAX; > > coordinator->attachLayer(this); > for (auto& child : children()) >@@ -1441,6 +1181,13 @@ void CoordinatedGraphicsLayer::animationStartedTimerFired() > client().notifyAnimationStarted(this, "", m_lastAnimationStartTime); > } > >+#if USE(NICOSIA) >+PlatformLayer* CoordinatedGraphicsLayer::platformLayer() const >+{ >+ return m_nicosia.layer.get(); >+} >+#endif >+ > } // namespace WebCore > > #endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >index 7d6b66db3d2..2099d6c76d4 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >@@ -24,7 +24,6 @@ > #if USE(COORDINATED_GRAPHICS) > > #include "CoordinatedGraphicsState.h" >-#include "CoordinatedImageBacking.h" > #include "FloatPoint3D.h" > #include "GraphicsLayer.h" > #include "GraphicsLayerTransform.h" >@@ -33,8 +32,6 @@ > #include "NicosiaBuffer.h" > #include "NicosiaPlatformLayer.h" > #include "TextureMapperAnimation.h" >-#include "TiledBackingStore.h" >-#include "TiledBackingStoreClient.h" > #include "TransformationMatrix.h" > #include <wtf/text/StringHash.h> > >@@ -50,17 +47,13 @@ class CoordinatedGraphicsLayerClient { > public: > virtual bool isFlushingLayerChanges() const = 0; > virtual FloatRect visibleContentsRect() const = 0; >- virtual Ref<CoordinatedImageBacking> createImageBackingIfNeeded(Image&) = 0; > virtual void detachLayer(CoordinatedGraphicsLayer*) = 0; > virtual void attachLayer(CoordinatedGraphicsLayer*) = 0; >+ virtual void syncLayerState() = 0; > virtual Nicosia::PaintingEngine& paintingEngine() = 0; >- >- virtual void syncLayerState(CoordinatedLayerID, CoordinatedGraphicsLayerState&) = 0; > }; > >-class WEBCORE_EXPORT CoordinatedGraphicsLayer : public GraphicsLayer >- , public TiledBackingStoreClient >- , public CoordinatedImageBacking::Host { >+class WEBCORE_EXPORT CoordinatedGraphicsLayer : public GraphicsLayer { > public: > explicit CoordinatedGraphicsLayer(Type, GraphicsLayerClient&); > virtual ~CoordinatedGraphicsLayer(); >@@ -76,6 +69,7 @@ public: > bool replaceChild(GraphicsLayer*, GraphicsLayer*) override; > void removeFromParent() override; > void setPosition(const FloatPoint&) override; >+ void syncPosition(const FloatPoint&) override; > void setAnchorPoint(const FloatPoint3D&) override; > void setSize(const FloatSize&) override; > void setTransform(const TransformationMatrix&) override; >@@ -110,7 +104,11 @@ public: > void removeAnimation(const String&) override; > void suspendAnimations(MonotonicTime) override; > void resumeAnimations() override; >- bool usesContentsLayer() const override { return m_platformLayer || m_nicosia.contentLayer || m_compositedImage; } >+ bool usesContentsLayer() const override { return m_nicosia.contentLayer || m_compositedImage; } >+ >+#if USE(NICOSIA) >+ PlatformLayer* platformLayer() const override; >+#endif > > void syncPendingStateChangesIncludingSubLayers(); > void updateContentBuffersIncludingSubLayers(); >@@ -118,16 +116,10 @@ public: > FloatPoint computePositionRelativeToBase(); > void computePixelAlignment(FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset); > >- CoordinatedLayerID id() const { return m_id; } >+ Nicosia::PlatformLayer::LayerID id() const { return m_id; } > > IntRect transformedVisibleRect(); > >- // TiledBackingStoreClient >- void tiledBackingStoreHasPendingTileCreation() override; >- void createTile(uint32_t tileID, float) override; >- void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) override; >- void removeTile(uint32_t tileID) override; >- > void setCoordinator(CoordinatedGraphicsLayerClient*); > void setCoordinatorIncludingSubLayersIfNeeded(CoordinatedGraphicsLayerClient*); > >@@ -139,34 +131,21 @@ public: > private: > bool isCoordinatedGraphicsLayer() const override { return true; } > >- void syncPlatformLayer(); > void updatePlatformLayer(); > > void setDebugBorder(const Color&, float width) override; > >- void didChangeLayerState(); > void didChangeAnimations(); > void didChangeGeometry(); > void didChangeChildren(); > void didChangeFilters(); >- void didChangeImageBacking(); > void didUpdateTileBuffers(); > >- void resetLayerState(); >- void syncLayerState(); >- void syncAnimations(); >- void syncChildren(); >- void syncFilters(); >- void syncImageBacking(); > void computeTransformedVisibleRect(); > void updateContentBuffers(); > >- void releaseImageBackingIfNeeded(); >- > void notifyFlushRequired(); > >- // CoordinatedImageBacking::Host >- bool imageBackingVisible() override; > bool shouldHaveBackingStore() const; > bool selfOrAncestorHasActiveTransformAnimation() const; > bool selfOrAncestorHaveNonAffineTransforms(); >@@ -178,8 +157,7 @@ private: > > bool filtersCanBeComposited(const FilterOperations&) const; > >- CoordinatedLayerID m_id; >- CoordinatedGraphicsLayerState m_layerState; >+ Nicosia::PlatformLayer::LayerID m_id; > GraphicsLayerTransform m_layerTransform; > TransformationMatrix m_cachedInverseTransform; > FloatSize m_pixelAlignmentOffset; >@@ -194,22 +172,12 @@ private: > #endif > bool m_shouldUpdateVisibleRect: 1; > bool m_shouldSyncLayerState: 1; >- bool m_shouldSyncChildren: 1; >- bool m_shouldSyncFilters: 1; >- bool m_shouldSyncImageBacking: 1; >- bool m_shouldSyncAnimations: 1; > bool m_movingVisibleRect : 1; > bool m_pendingContentsScaleAdjustment : 1; > bool m_pendingVisibleRectAdjustment : 1; >-#if USE(COORDINATED_GRAPHICS_THREADED) >- bool m_shouldSyncPlatformLayer : 1; > bool m_shouldUpdatePlatformLayer : 1; >-#endif > > CoordinatedGraphicsLayerClient* m_coordinator; >- std::unique_ptr<TiledBackingStore> m_mainBackingStore; >- std::unique_ptr<TiledBackingStore> m_previousBackingStore; >- > struct { > bool completeLayer { false }; > Vector<FloatRect, 32> rects; >@@ -217,9 +185,7 @@ private: > > RefPtr<Image> m_compositedImage; > NativeImagePtr m_compositedNativeImagePtr; >- RefPtr<CoordinatedImageBacking> m_coordinatedImageBacking; > >- PlatformLayer* m_platformLayer; > Timer m_animationStartedTimer; > TextureMapperAnimations m_animations; > MonotonicTime m_lastAnimationStartTime; >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >index 6f9624f4e5d..bb9e79d67a2 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >@@ -30,161 +30,14 @@ > > #if USE(COORDINATED_GRAPHICS) > >-#include "Color.h" >-#include "FilterOperations.h" >-#include "FloatRect.h" >-#include "FloatSize.h" >-#include "IntRect.h" >-#include "IntSize.h" >-#include "NicosiaBuffer.h" >-#include "NicosiaPlatformLayer.h" > #include "NicosiaScene.h" >-#include "SurfaceUpdateInfo.h" >-#include "TextureMapperAnimation.h" >-#include "TransformationMatrix.h" >- >-#if USE(COORDINATED_GRAPHICS_THREADED) >-#include "TextureMapperPlatformLayerProxy.h" >-#endif > > namespace WebCore { > >-typedef uint32_t CoordinatedLayerID; >-enum { InvalidCoordinatedLayerID = 0 }; >- >-typedef uint64_t CoordinatedImageBackingID; >-enum { InvalidCoordinatedImageBackingID = 0 }; >- >-struct TileUpdateInfo { >- uint32_t tileID; >- IntRect tileRect; >- WebCore::SurfaceUpdateInfo updateInfo; >-}; >- >-struct TileCreationInfo { >- uint32_t tileID; >- float scale; >-}; >- >-struct DebugVisuals { >- Color debugBorderColor; >- float debugBorderWidth { 0 }; >- bool showDebugBorders { false }; >-}; >- >-struct RepaintCount { >- unsigned count { 0 }; >- bool showRepaintCounter { false }; >-}; >- >-struct CoordinatedGraphicsLayerState { >- union { >- struct { >- bool positionChanged: 1; >- bool anchorPointChanged: 1; >- bool sizeChanged: 1; >- bool transformChanged: 1; >- bool childrenTransformChanged: 1; >- bool contentsRectChanged: 1; >- bool opacityChanged: 1; >- bool solidColorChanged: 1; >- bool debugVisualsChanged: 1; >- bool replicaChanged: 1; >- bool maskChanged: 1; >- bool imageChanged: 1; >- bool flagsChanged: 1; >- bool animationsChanged: 1; >- bool filtersChanged: 1; >- bool childrenChanged: 1; >- bool repaintCountChanged : 1; >- bool platformLayerChanged: 1; >- bool platformLayerUpdated: 1; >- bool platformLayerShouldSwapBuffers: 1; >- bool isScrollableChanged: 1; >- bool contentsTilingChanged: 1; >- }; >- unsigned changeMask; >- }; >- union { >- struct { >- bool contentsOpaque : 1; >- bool drawsContent : 1; >- bool contentsVisible : 1; >- bool backfaceVisible : 1; >- bool masksToBounds : 1; >- bool preserves3D : 1; >- bool isScrollable: 1; >- }; >- unsigned flags; >- }; >- >- CoordinatedGraphicsLayerState() >- : changeMask(0) >- , contentsOpaque(false) >- , drawsContent(false) >- , contentsVisible(true) >- , backfaceVisible(true) >- , masksToBounds(false) >- , preserves3D(false) >- , isScrollable(false) >- , opacity(0) >- , replica(InvalidCoordinatedLayerID) >- , mask(InvalidCoordinatedLayerID) >- , imageID(InvalidCoordinatedImageBackingID) >-#if USE(COORDINATED_GRAPHICS_THREADED) >- , platformLayerProxy(0) >-#endif >- { >- } >- >- FloatPoint pos; >- FloatPoint3D anchorPoint; >- FloatSize size; >- TransformationMatrix transform; >- TransformationMatrix childrenTransform; >- FloatRect contentsRect; >- FloatSize contentsTilePhase; >- FloatSize contentsTileSize; >- float opacity; >- Color solidColor; >- FilterOperations filters; >- TextureMapperAnimations animations; >- Vector<uint32_t> children; >- Vector<TileCreationInfo> tilesToCreate; >- Vector<uint32_t> tilesToRemove; >- CoordinatedLayerID replica; >- CoordinatedLayerID mask; >- CoordinatedImageBackingID imageID; >- DebugVisuals debugVisuals; >- RepaintCount repaintCount; >- >- Vector<TileUpdateInfo> tilesToUpdate; >- >-#if USE(COORDINATED_GRAPHICS_THREADED) >- RefPtr<TextureMapperPlatformLayerProxy> platformLayerProxy; >-#endif >- >- bool hasPendingChanges() const >- { >- return changeMask || tilesToUpdate.size() || tilesToRemove.size() || tilesToCreate.size(); >- } >-}; >- > struct CoordinatedGraphicsState { > struct NicosiaState { > RefPtr<Nicosia::Scene> scene; > } nicosia; >- >- uint32_t rootCompositingLayer; >- >- Vector<CoordinatedLayerID> layersToCreate; >- Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState>> layersToUpdate; >- Vector<CoordinatedLayerID> layersToRemove; >- >- Vector<CoordinatedImageBackingID> imagesToCreate; >- Vector<CoordinatedImageBackingID> imagesToRemove; >- Vector<std::pair<CoordinatedImageBackingID, RefPtr<Nicosia::Buffer>>> imagesToUpdate; >- Vector<CoordinatedImageBackingID> imagesToClear; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp >deleted file mode 100644 >index 258ba5a6a24..00000000000 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp >+++ /dev/null >@@ -1,127 +0,0 @@ >-/* >- * Copyright (C) 2012 Company 100, 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 "CoordinatedImageBacking.h" >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "CoordinatedGraphicsState.h" >-#include "GraphicsContext.h" >-#include "NicosiaBuffer.h" >-#include "NicosiaPaintingContext.h" >- >-namespace WebCore { >- >-CoordinatedImageBackingID CoordinatedImageBacking::getCoordinatedImageBackingID(Image& image) >-{ >- // CoordinatedImageBacking keeps a RefPtr<Image> member, so the same Image pointer can not refer two different instances until CoordinatedImageBacking releases the member. >- return reinterpret_cast<CoordinatedImageBackingID>(&image); >-} >- >-CoordinatedImageBacking::CoordinatedImageBacking(Client& client, Ref<Image>&& image) >- : m_client(client) >- , m_id(getCoordinatedImageBackingID(image)) >- , m_image(WTFMove(image)) >- , m_clearContentsTimer(*this, &CoordinatedImageBacking::clearContentsTimerFired) >-{ >- m_client.createImageBacking(m_id); >-} >- >-CoordinatedImageBacking::~CoordinatedImageBacking() = default; >- >-void CoordinatedImageBacking::addHost(Host& host) >-{ >- ASSERT(!m_hosts.contains(&host)); >- m_hosts.add(&host); >-} >- >-void CoordinatedImageBacking::removeHost(Host& host) >-{ >- m_hosts.remove(&host); >- >- if (m_hosts.isEmpty()) >- m_client.removeImageBacking(m_id); >-} >- >-static const Seconds clearContentsTimerInterval { 3_s }; >- >-void CoordinatedImageBacking::update() >-{ >- bool previousIsVisible = m_isVisible; >- m_isVisible = std::any_of(m_hosts.begin(), m_hosts.end(), >- [](auto* host) >- { >- return host->imageBackingVisible(); >- }); >- >- if (!m_isVisible) { >- if (previousIsVisible) { >- ASSERT(!m_clearContentsTimer.isActive()); >- m_clearContentsTimer.startOneShot(clearContentsTimerInterval); >- } >- return; >- } >- >- bool changedToVisible = !previousIsVisible; >- if (m_clearContentsTimer.isActive()) { >- m_clearContentsTimer.stop(); >- // We don't want to update the texture if we didn't remove the texture. >- changedToVisible = false; >- } >- >- auto nativeImagePtr = m_image->nativeImageForCurrentFrame(); >- if (!changedToVisible) { >- if (!m_isDirty) >- return; >- >- if (m_nativeImagePtr == nativeImagePtr) { >- m_isDirty = false; >- return; >- } >- } >- >- m_nativeImagePtr = WTFMove(nativeImagePtr); >- >- auto buffer = Nicosia::Buffer::create(IntSize(m_image->size()), !m_image->currentFrameKnownToBeOpaque() ? Nicosia::Buffer::SupportsAlpha : Nicosia::Buffer::NoFlags); >- Nicosia::PaintingContext::paint(buffer, >- [this](GraphicsContext& context) >- { >- IntRect rect { { }, IntSize { m_image->size() } }; >- context.drawImage(m_image, rect, rect, ImagePaintingOptions(CompositeCopy)); >- }); >- >- m_client.updateImageBacking(m_id, WTFMove(buffer)); >- m_isDirty = false; >-} >- >-void CoordinatedImageBacking::clearContentsTimerFired() >-{ >- m_client.clearImageBackingContents(m_id); >-} >- >-} // namespace WebCore >- >-#endif >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >deleted file mode 100644 >index e4bd4398353..00000000000 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >+++ /dev/null >@@ -1,95 +0,0 @@ >-/* >- * Copyright (C) 2012 Company 100, 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 USE(COORDINATED_GRAPHICS) >- >-#include "CoordinatedGraphicsState.h" >-#include "Image.h" >-#include "Timer.h" >-#include <wtf/RefCounted.h> >-#include <wtf/Vector.h> >- >-namespace Nicosia { >-class Buffer; >-} >- >-namespace WebCore { >- >-class WEBCORE_EXPORT CoordinatedImageBacking : public RefCounted<CoordinatedImageBacking> { >-public: >- class Client { >- public: >- virtual void createImageBacking(CoordinatedImageBackingID) = 0; >- virtual void updateImageBacking(CoordinatedImageBackingID, RefPtr<Nicosia::Buffer>&&) = 0; >- virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0; >- virtual void removeImageBacking(CoordinatedImageBackingID) = 0; >- }; >- >- class Host { >- public: >- virtual bool imageBackingVisible() = 0; >- }; >- >- static Ref<CoordinatedImageBacking> create(Client& client, Ref<Image>&& image) >- { >- return adoptRef(*new CoordinatedImageBacking(client, WTFMove(image))); >- } >- virtual ~CoordinatedImageBacking(); >- >- static CoordinatedImageBackingID getCoordinatedImageBackingID(Image&); >- CoordinatedImageBackingID id() const { return m_id; } >- >- void addHost(Host&); >- void removeHost(Host&); >- >- // When a new image is updated or an animated gif is progressed, CoordinatedGraphicsLayer calls markDirty(). >- void markDirty() { m_isDirty = true; } >- >- // Create, remove or update its backing. >- void update(); >- >-private: >- CoordinatedImageBacking(Client&, Ref<Image>&&); >- >- void clearContentsTimerFired(); >- >- Client& m_client; >- HashSet<Host*> m_hosts; >- >- CoordinatedImageBackingID m_id; >- Ref<Image> m_image; >- NativeImagePtr m_nativeImagePtr; >- >- Timer m_clearContentsTimer; >- >- bool m_isDirty { false }; >- bool m_isVisible { false }; >-}; >- >-} // namespace WebCore >- >-#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >index 56926a2f4b6..2fe66aeb7c2 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >+++ b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >@@ -449,7 +449,7 @@ void CoordinatedGraphicsScene::purgeGLResources() > } > > m_rootLayer = nullptr; >- m_rootLayerID = InvalidCoordinatedLayerID; >+ m_rootLayerID = 0; > m_textureMapper = nullptr; > } > >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h >index 40b8b63110e..f54407e5e06 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h >+++ b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h >@@ -28,6 +28,8 @@ > #include <WebCore/GraphicsLayer.h> > #include <WebCore/IntRect.h> > #include <WebCore/IntSize.h> >+#include <WebCore/NicosiaPlatformLayer.h> >+#include <WebCore/NicosiaScene.h> > #include <WebCore/TextureMapper.h> > #include <WebCore/TextureMapperBackingStore.h> > #include <WebCore/TextureMapperFPSCounter.h> >@@ -111,7 +113,7 @@ private: > > std::unique_ptr<WebCore::TextureMapperLayer> m_rootLayer; > >- WebCore::CoordinatedLayerID m_rootLayerID { WebCore::InvalidCoordinatedLayerID }; >+ Nicosia::PlatformLayer::LayerID m_rootLayerID { 0 }; > WebCore::Color m_viewBackgroundColor { WebCore::Color::white }; > > WebCore::TextureMapperFPSCounter m_fpsCounter; >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp >index 0b2b68ae11e..2ff8f3c7aed 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp >+++ b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp >@@ -308,6 +308,11 @@ void ThreadedCompositor::updateSceneState(const CoordinatedGraphicsState& state) > m_compositingRunLoop->scheduleUpdate(); > } > >+void ThreadedCompositor::requestUpdate() >+{ >+ m_compositingRunLoop->scheduleUpdate(); >+} >+ > #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) > RefPtr<WebCore::DisplayRefreshMonitor> ThreadedCompositor::displayRefreshMonitor(PlatformDisplayID) > { >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h >index 42b246d2b06..134892c039c 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h >+++ b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h >@@ -72,6 +72,7 @@ public: > void setDrawsBackground(bool); > > void updateSceneState(const WebCore::CoordinatedGraphicsState&); >+ void requestUpdate(); > > void invalidate(); > >diff --git a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp >index 66cfe77ff87..6ee099795a4 100644 >--- a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp >+++ b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp >@@ -40,7 +40,7 @@ namespace WebKit { > > PageClientImpl::PageClientImpl(WKWPE::View& view) > : m_view(view) >- , m_scrollGestureController(std::make_unique<ScrollGestureController>()) >+ , m_scrollGestureController(m_view.scrollGestureController()) > { > } > >@@ -192,8 +192,8 @@ void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& touchEvent, b > > auto& page = m_view.page(); > >- if (m_scrollGestureController->handleEvent(touchPoint)) { >- struct wpe_input_axis_event* axisEvent = m_scrollGestureController->axisEvent(); >+ if (m_scrollGestureController.handleEvent(touchPoint)) { >+ struct wpe_input_axis_event* axisEvent = m_scrollGestureController.axisEvent(); > if (axisEvent->type != wpe_input_axis_event_type_null) > page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, m_view.page().deviceScaleFactor())); > return; >diff --git a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h >index ca21d8be6e1..2ee137c9721 100644 >--- a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h >+++ b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h >@@ -144,8 +144,7 @@ private: > WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; > > WKWPE::View& m_view; >- >- std::unique_ptr<ScrollGestureController> m_scrollGestureController; >+ ScrollGestureController& m_scrollGestureController; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp b/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp >index da12c8eb351..a313ce7a2ee 100644 >--- a/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp >+++ b/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp >@@ -27,19 +27,38 @@ > #include "ScrollGestureController.h" > > #include <WebCore/Scrollbar.h> >+#include <glib.h> >+#include <numeric> > > namespace WebKit { > >+ScrollGestureController::Client::~Client() = default; >+ >+ScrollGestureController::ScrollGestureController(Client& client) >+ : m_client(client) >+{ >+ m_kinetics.timer = std::make_unique<RunLoop::Timer<ScrollGestureController>>(RunLoop::main(), this, &ScrollGestureController::dispatchCallback); >+} >+ >+ScrollGestureController::~ScrollGestureController() >+{ >+} >+ > bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw* touchPoint) > { > switch (touchPoint->type) { > case wpe_input_touch_event_type_down: >- m_start.time = touchPoint->time; >- m_start.x = touchPoint->x; >- m_start.y = touchPoint->y; >- m_offset.x = touchPoint->x; >- m_offset.y = touchPoint->y; >+ { >+ int32_t x = touchPoint->x; >+ int32_t y = touchPoint->y; >+ m_start = { touchPoint->time, x, y }; >+ m_offset = { x, y }; >+ m_kinetics.last = { touchPoint->time, x, y }; >+ m_kinetics.velocity = { }; >+ m_kinetics.application = { }; >+ m_kinetics.timer->stop(); > return false; >+ } > case wpe_input_touch_event_type_motion: > if (!m_handling) { > int32_t deltaX = touchPoint->x - m_start.x; >@@ -49,7 +68,7 @@ bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw > int pixelsPerLineStep = WebCore::Scrollbar::pixelsPerLineStep(); > m_handling = std::abs(deltaX) >= pixelsPerLineStep > || std::abs(deltaY) >= pixelsPerLineStep >- || deltaTime >= 200; >+ || deltaTime >= 64; > } > if (m_handling) { > m_axisEvent = { >@@ -59,8 +78,25 @@ bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw > }; > m_offset.x = touchPoint->x; > m_offset.y = touchPoint->y; >+ >+ { >+ auto& last = m_kinetics.last; >+ auto& velocity = m_kinetics.velocity; >+ std::rotate(velocity.x.begin(), velocity.x.begin() + 1, velocity.x.end()); >+ std::rotate(velocity.y.begin(), velocity.y.begin() + 1, velocity.y.end()); >+ std::rotate(velocity.time.begin(), velocity.time.begin() + 1, velocity.time.end()); >+ >+ velocity.x.back() = touchPoint->x - last.x; >+ velocity.y.back() = touchPoint->y - last.y; >+ velocity.time.back() = touchPoint->time - last.time; >+ >+ last = { touchPoint->time, touchPoint->x, touchPoint->y }; >+ } >+ > return true; > } >+ >+ m_kinetics.last = { touchPoint->time, touchPoint->x, touchPoint->y }; > return false; > case wpe_input_touch_event_type_up: > if (m_handling) { >@@ -69,6 +105,20 @@ bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw > wpe_input_axis_event_type_null, > 0, 0, 0, 0, 0 > }; >+ >+ auto& velocity = m_kinetics.velocity; >+ uint32_t accumulatedTime = std::accumulate(velocity.time.begin(), velocity.time.end(), 0); >+ int32_t accumulatedX = std::accumulate(velocity.x.begin(), velocity.x.end(), 0); >+ int32_t accumulatedY = std::accumulate(velocity.y.begin(), velocity.y.end(), 0); >+ double trajectoryX = 1000.0 * accumulatedX / accumulatedTime; >+ double trajectoryY = 1000.0 * accumulatedY / accumulatedTime; >+ >+ m_kinetics.application = { >+ g_get_monotonic_time(), touchPoint->time, touchPoint->time, >+ { m_start.x, trajectoryX, std::abs(trajectoryX * 0.2) }, >+ { m_start.y, trajectoryY, std::abs(trajectoryY * 0.2) } >+ }; >+ m_kinetics.timer->startOneShot(Seconds::fromMilliseconds(15)); > return true; > } > return false; >@@ -77,4 +127,42 @@ bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw > } > } > >+void ScrollGestureController::dispatchCallback() >+{ >+ uint32_t timeOffset = (g_get_monotonic_time() - m_kinetics.application.baseMonotonicTime) / 1000; >+ uint32_t time = m_kinetics.application.baseTime + timeOffset; >+ uint32_t timeDelta = time - m_kinetics.application.lastTime; >+ m_kinetics.application.lastTime = time; >+ >+ double trajectoryXValue = 0; >+ if (timeOffset < m_kinetics.application.x.duration) { >+ trajectoryXValue = -std::pow(double(timeOffset) / m_kinetics.application.x.duration, 2) + 1; >+ trajectoryXValue = std::max<double>(trajectoryXValue, 0); >+ } >+ >+ double trajectoryYValue = 0; >+ if (timeOffset < m_kinetics.application.y.duration) { >+ trajectoryYValue = -std::pow(double(timeOffset) / m_kinetics.application.y.duration, 2) + 1; >+ trajectoryYValue = std::max<double>(trajectoryYValue, 0); >+ } >+ >+ bool activeTrajectories = !!trajectoryXValue || !!trajectoryYValue; >+ >+ int32_t trajectoryYChange = m_kinetics.application.y.trajectory * trajectoryYValue * timeDelta / 1000.0; >+ if (trajectoryYChange) { >+ struct wpe_input_axis_event axisEvent = { >+ wpe_input_axis_event_type_motion, >+ m_kinetics.application.baseTime + timeOffset, >+ m_kinetics.application.x.coordinate, m_kinetics.application.y.coordinate, >+ 2, trajectoryYChange >+ }; >+ m_client.dispatchAxisEvent(&axisEvent); >+ } >+ >+ // FIXME: Also handle change in the horizontal trajectory. >+ >+ if (activeTrajectories) >+ m_kinetics.timer->startOneShot(Seconds::fromMilliseconds(15)); >+} >+ > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h b/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h >index 9c9f6e9e3b1..626e118aecf 100644 >--- a/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h >+++ b/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h >@@ -25,19 +25,34 @@ > > #pragma once > >+#include <array> > #include <wpe/wpe.h> >+#include <wtf/RunLoop.h> > > namespace WebKit { > > class ScrollGestureController { > public: >- ScrollGestureController() = default; >+ class Client { >+ public: >+ virtual ~Client(); >+ >+ virtual void dispatchAxisEvent(struct wpe_input_axis_event*) = 0; >+ }; >+ >+ ScrollGestureController(Client&); >+ ~ScrollGestureController(); > > struct wpe_input_axis_event* axisEvent() { return &m_axisEvent; } > >+ bool isHandling() const { return m_handling; } > bool handleEvent(const struct wpe_input_touch_event_raw*); > > private: >+ void dispatchCallback(); >+ >+ Client& m_client; >+ > struct { > uint32_t time { 0 }; > int32_t x { 0 }; >@@ -49,6 +64,32 @@ private: > int32_t y { 0 }; > } m_offset; > >+ struct { >+ struct { >+ uint32_t time { 0 }; >+ int32_t x { 0 }; >+ int32_t y { 0 }; >+ } last; >+ struct { >+ std::array<int32_t, 4> x; >+ std::array<int32_t, 4> y; >+ std::array<uint32_t, 4> time; >+ } velocity; >+ >+ struct { >+ int64_t baseMonotonicTime { 0 }; >+ uint32_t baseTime { 0 }; >+ uint32_t lastTime { 0 }; >+ struct { >+ int32_t coordinate { 0 }; >+ double trajectory { 0 }; >+ double duration { 0 }; >+ } x, y; >+ } application; >+ >+ std::unique_ptr<RunLoop::Timer<ScrollGestureController>> timer; >+ } m_kinetics; >+ > bool m_handling { false }; > struct wpe_input_axis_event m_axisEvent; > }; >diff --git a/Source/WebKit/UIProcess/API/wpe/WPEView.cpp b/Source/WebKit/UIProcess/API/wpe/WPEView.cpp >index fffcb11fee4..afcc27205e6 100644 >--- a/Source/WebKit/UIProcess/API/wpe/WPEView.cpp >+++ b/Source/WebKit/UIProcess/API/wpe/WPEView.cpp >@@ -43,6 +43,7 @@ namespace WKWPE { > > View::View(struct wpe_view_backend* backend, const API::PageConfiguration& baseConfiguration) > : m_client(std::make_unique<API::ViewClient>()) >+ , m_scrollGestureController(std::make_unique<ScrollGestureController>(*this)) > , m_pageClient(std::make_unique<PageClientImpl>(*this)) > , m_size { 800, 600 } > , m_viewStateFlags { WebCore::ActivityState::WindowIsActive, WebCore::ActivityState::IsFocused, WebCore::ActivityState::IsVisible, WebCore::ActivityState::IsInWindow } >@@ -126,8 +127,27 @@ View::View(struct wpe_view_backend* backend, const API::PageConfiguration& baseC > // handle_touch_event > [](void* data, struct wpe_input_touch_event* event) > { >- auto& page = reinterpret_cast<View*>(data)->page(); >- page.handleTouchEvent(WebKit::NativeWebTouchEvent(event, page.deviceScaleFactor())); >+ auto& view = *reinterpret_cast<View*>(data); >+ auto& page = view.page(); >+ >+ bool handled = false; >+ >+ WebKit::NativeWebTouchEvent nativeEvent(event, page.deviceScaleFactor()); >+ >+ auto& scrollGestureController = *view.m_scrollGestureController; >+ if (scrollGestureController.isHandling()) { >+ const struct wpe_input_touch_event_raw* touchPoint = nativeEvent.nativeFallbackTouchPoint(); >+ if (touchPoint->type != wpe_input_touch_event_type_null && >+ scrollGestureController.handleEvent(touchPoint)) { >+ handled = true; >+ struct wpe_input_axis_event* axisEvent = scrollGestureController.axisEvent(); >+ if (axisEvent->type != wpe_input_axis_event_type_null) >+ page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, page.deviceScaleFactor())); >+ } >+ } >+ >+ if (!handled) >+ page.handleTouchEvent(nativeEvent); > }, > // padding > nullptr, >@@ -188,4 +208,10 @@ void View::close() > m_pageProxy->close(); > } > >+void View::dispatchAxisEvent(struct wpe_input_axis_event* axisEvent) >+{ >+ auto& page = this->page(); >+ page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, page.deviceScaleFactor())); >+} >+ > } // namespace WKWPE >diff --git a/Source/WebKit/UIProcess/API/wpe/WPEView.h b/Source/WebKit/UIProcess/API/wpe/WPEView.h >index 2ab48530ea1..55cbf1c7ece 100644 >--- a/Source/WebKit/UIProcess/API/wpe/WPEView.h >+++ b/Source/WebKit/UIProcess/API/wpe/WPEView.h >@@ -28,6 +28,7 @@ > #include "APIObject.h" > #include "CompositingManagerProxy.h" > #include "PageClientImpl.h" >+#include "ScrollGestureController.h" > #include "WebPageProxy.h" > #include <WebCore/ActivityState.h> > #include <memory> >@@ -35,6 +36,7 @@ > #include <wtf/RefPtr.h> > > typedef struct OpaqueJSContext* JSGlobalContextRef; >+struct wpe_input_axis_event; > struct wpe_view_backend; > > namespace API { >@@ -43,13 +45,14 @@ class ViewClient; > > namespace WebKit { > class DownloadProxy; >+class ScrollGestureController; > class WebPageGroup; > class WebProcessPool; > } > > namespace WKWPE { > >-class View : public API::ObjectImpl<API::Object::Type::View> { >+class View : public API::ObjectImpl<API::Object::Type::View>, public WebKit::ScrollGestureController::Client { > public: > static View* create(struct wpe_view_backend* backend, const API::PageConfiguration& configuration) > { >@@ -78,13 +81,19 @@ public: > void setFullScreen(bool fullScreenState) { m_fullScreenModeActive = fullScreenState; }; > #endif > >+ WebKit::ScrollGestureController& scrollGestureController() const { return *m_scrollGestureController; } >+ > private: > View(struct wpe_view_backend*, const API::PageConfiguration&); > > void setSize(const WebCore::IntSize&); > >+ // ScrollGestureController::Client >+ void dispatchAxisEvent(struct wpe_input_axis_event*) override; >+ > std::unique_ptr<API::ViewClient> m_client; > >+ std::unique_ptr<WebKit::ScrollGestureController> m_scrollGestureController; > std::unique_ptr<WebKit::PageClientImpl> m_pageClient; > RefPtr<WebKit::WebPageProxy> m_pageProxy; > WebCore::IntSize m_size; >diff --git a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp >index f752b5dd62e..2017a8499b8 100644 >--- a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp >+++ b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp >@@ -171,6 +171,11 @@ void AcceleratedDrawingArea::mainFrameContentSizeChanged(const IntSize& size) > #endif > } > >+bool AcceleratedDrawingArea::supportsAsyncScrolling() >+{ >+ return false; >+} >+ > void AcceleratedDrawingArea::layerHostDidFlushLayers() > { > ASSERT(m_layerTreeHost); >diff --git a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h >index 6d68b5b8991..a80325bd3b6 100644 >--- a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h >@@ -54,6 +54,8 @@ protected: > void updatePreferences(const WebPreferencesStore&) override; > void mainFrameContentSizeChanged(const WebCore::IntSize&) override; > >+ bool supportsAsyncScrolling() override; >+ > WebCore::GraphicsLayerFactory* graphicsLayerFactory() override; > void setRootCompositingLayer(WebCore::GraphicsLayer*) override; > void scheduleCompositingLayerFlush() override; >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >index 6ba95758c09..7826bbad0f5 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >@@ -107,6 +107,36 @@ void CompositingCoordinator::sizeDidChange(const IntSize& newSize) > notifyFlushRequired(m_rootLayer.get()); > } > >+void dumpPlatformLayer(Nicosia::CompositionLayer& layer, unsigned indentation) >+{ >+ auto writeIndentation = >+ [](unsigned id) >+ { >+ for (unsigned i = 0; i < id; ++i) >+ fprintf(stderr, " |"); >+ }; >+ >+ layer.accessState( >+ [&layer, &writeIndentation, indentation](const Nicosia::CompositionLayer::LayerState& state) >+ { >+ writeIndentation(indentation); >+ fprintf(stderr, "layer(%p): id %lu position (%.2f,%.2f) anchorPoint (%.2f,%.2f,%.2f) size (%.2f,%.2f)\n", >+ &layer, layer.id(), state.position.x(), state.position.y(), >+ state.anchorPoint.x(), state.anchorPoint.y(), state.anchorPoint.z(), >+ state.size.width(), state.size.height()); >+ writeIndentation(indentation); >+ fprintf(stderr, " children[%zu] replica %p mask %p\n", >+ state.children.size(), state.replica.get(), state.mask.get()); >+ writeIndentation(indentation); >+ fprintf(stderr, " flags { %d, %d, %d, %d, %d, %d }\n", >+ state.flags.contentsOpaque, state.flags.drawsContent, state.flags.contentsVisible, >+ state.flags.backfaceVisible, state.flags.masksToBounds, state.flags.preserves3D); >+ >+ for (auto& child : state.children) >+ dumpPlatformLayer(*child, indentation + 1); >+ }); >+} >+ > bool CompositingCoordinator::flushPendingLayerChanges() > { > SetForScope<bool> protector(m_isFlushingLayerChanges, true); >@@ -125,7 +155,12 @@ bool CompositingCoordinator::flushPendingLayerChanges() > coordinatedLayer.updateContentBuffersIncludingSubLayers(); > coordinatedLayer.syncPendingStateChangesIncludingSubLayers(); > >- flushPendingImageBackingChanges(); >+#if 0 >+ fprintf(stderr, "CompositingCoordinator::flushPendingLayerChanges()\n"); >+ fprintf(stderr, "\tm_rootLayer %p, m_rootLayer.platformLayer() %p\n", >+ m_rootLayer.get(), m_rootLayer->platformLayer()); >+ dumpPlatformLayer(*m_rootLayer->platformLayer(), 1); >+#endif > > if (m_shouldSyncFrame) { > didSync = true; >@@ -163,8 +198,6 @@ bool CompositingCoordinator::flushPendingLayerChanges() > }); > > m_client.commitSceneState(m_state); >- >- clearPendingStateChanges(); > m_shouldSyncFrame = false; > } > >@@ -191,18 +224,6 @@ double CompositingCoordinator::nextAnimationServiceTime() const > return std::max<double>(0., MinimalTimeoutForAnimations - timestamp() + m_lastAnimationServiceTime); > } > >-void CompositingCoordinator::clearPendingStateChanges() >-{ >- m_state.layersToCreate.clear(); >- m_state.layersToUpdate.clear(); >- m_state.layersToRemove.clear(); >- >- m_state.imagesToCreate.clear(); >- m_state.imagesToRemove.clear(); >- m_state.imagesToUpdate.clear(); >- m_state.imagesToClear.clear(); >-} >- > void CompositingCoordinator::initializeRootCompositingLayerIfNeeded() > { > if (m_didInitializeRootCompositingLayer) >@@ -210,7 +231,6 @@ void CompositingCoordinator::initializeRootCompositingLayerIfNeeded() > > auto& rootLayer = downcast<CoordinatedGraphicsLayer>(*m_rootLayer); > m_nicosia.state.rootLayer = rootLayer.compositionLayer(); >- m_state.rootCompositingLayer = rootLayer.id(); > m_didInitializeRootCompositingLayer = true; > m_shouldSyncFrame = true; > } >@@ -227,57 +247,9 @@ void CompositingCoordinator::createRootLayer(const IntSize& size) > m_rootLayer->setSize(size); > } > >-void CompositingCoordinator::syncLayerState(CoordinatedLayerID id, CoordinatedGraphicsLayerState& state) >-{ >- m_shouldSyncFrame = true; >- m_state.layersToUpdate.append(std::make_pair(id, state)); >-} >- >-Ref<CoordinatedImageBacking> CompositingCoordinator::createImageBackingIfNeeded(Image& image) >-{ >- CoordinatedImageBackingID imageID = CoordinatedImageBacking::getCoordinatedImageBackingID(image); >- auto addResult = m_imageBackings.ensure(imageID, [this, &image] { >- return CoordinatedImageBacking::create(*this, image); >- }); >- return *addResult.iterator->value; >-} >- >-void CompositingCoordinator::createImageBacking(CoordinatedImageBackingID imageID) >-{ >- m_state.imagesToCreate.append(imageID); >-} >- >-void CompositingCoordinator::updateImageBacking(CoordinatedImageBackingID imageID, RefPtr<Nicosia::Buffer>&& buffer) >-{ >- m_shouldSyncFrame = true; >- m_state.imagesToUpdate.append(std::make_pair(imageID, WTFMove(buffer))); >-} >- >-void CompositingCoordinator::clearImageBackingContents(CoordinatedImageBackingID imageID) >+void CompositingCoordinator::syncLayerState() > { > m_shouldSyncFrame = true; >- m_state.imagesToClear.append(imageID); >-} >- >-void CompositingCoordinator::removeImageBacking(CoordinatedImageBackingID imageID) >-{ >- if (m_isPurging) >- return; >- >- ASSERT(m_imageBackings.contains(imageID)); >- m_imageBackings.remove(imageID); >- >- m_state.imagesToRemove.append(imageID); >- >- size_t imageIDPosition = m_state.imagesToClear.find(imageID); >- if (imageIDPosition != notFound) >- m_state.imagesToClear.remove(imageIDPosition); >-} >- >-void CompositingCoordinator::flushPendingImageBackingChanges() >-{ >- for (auto& imageBacking : m_imageBackings.values()) >- imageBacking->update(); > } > > void CompositingCoordinator::notifyFlushRequired(const GraphicsLayer*) >@@ -302,7 +274,6 @@ std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(Graph > layer->setCoordinator(this); > m_nicosia.state.layers.add(layer->compositionLayer()); > m_registeredLayers.add(layer->id(), layer); >- m_state.layersToCreate.append(layer->id()); > layer->setNeedsVisibleRectAdjustment(); > notifyFlushRequired(layer); > return std::unique_ptr<GraphicsLayer>(layer); >@@ -343,14 +314,6 @@ void CompositingCoordinator::detachLayer(CoordinatedGraphicsLayer* layer) > > m_nicosia.state.layers.remove(layer->compositionLayer()); > m_registeredLayers.remove(layer->id()); >- >- size_t index = m_state.layersToCreate.find(layer->id()); >- if (index != notFound) { >- m_state.layersToCreate.remove(index); >- return; >- } >- >- m_state.layersToRemove.append(layer->id()); > notifyFlushRequired(layer); > } > >@@ -359,23 +322,16 @@ void CompositingCoordinator::attachLayer(CoordinatedGraphicsLayer* layer) > layer->setCoordinator(this); > m_nicosia.state.layers.add(layer->compositionLayer()); > m_registeredLayers.add(layer->id(), layer); >- m_state.layersToCreate.append(layer->id()); > layer->setNeedsVisibleRectAdjustment(); > notifyFlushRequired(layer); > } > >-void CompositingCoordinator::renderNextFrame() >-{ >-} >- > void CompositingCoordinator::purgeBackingStores() > { > SetForScope<bool> purgingToggle(m_isPurging, true); > > for (auto& registeredLayer : m_registeredLayers.values()) > registeredLayer->purgeBackingStores(); >- >- m_imageBackings.clear(); > } > > Nicosia::PaintingEngine& CompositingCoordinator::paintingEngine() >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >index 4308eae2ff6..9cb3504b6e5 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >@@ -31,15 +31,16 @@ > > #include <WebCore/CoordinatedGraphicsLayer.h> > #include <WebCore/CoordinatedGraphicsState.h> >-#include <WebCore/CoordinatedImageBacking.h> > #include <WebCore/FloatPoint.h> > #include <WebCore/GraphicsLayerClient.h> > #include <WebCore/GraphicsLayerFactory.h> > #include <WebCore/IntRect.h> > #include <WebCore/NicosiaBuffer.h> >+#include <WebCore/NicosiaPlatformLayer.h> > > namespace Nicosia { > class PaintingEngine; >+class SceneIntegration; > } > > namespace WebCore { >@@ -52,7 +53,6 @@ namespace WebKit { > > class CompositingCoordinator final : public WebCore::GraphicsLayerClient > , public WebCore::CoordinatedGraphicsLayerClient >- , public WebCore::CoordinatedImageBacking::Client > , public WebCore::GraphicsLayerFactory { > WTF_MAKE_NONCOPYABLE(CompositingCoordinator); > public: >@@ -61,6 +61,7 @@ public: > virtual void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) = 0; > virtual void notifyFlushRequired() = 0; > virtual void commitSceneState(const WebCore::CoordinatedGraphicsState&) = 0; >+ virtual RefPtr<Nicosia::SceneIntegration> sceneIntegration() = 0; > }; > > CompositingCoordinator(WebCore::Page*, CompositingCoordinator::Client&); >@@ -74,7 +75,6 @@ public: > void deviceOrPageScaleFactorChanged(); > > void setVisibleContentsRect(const WebCore::FloatRect&); >- void renderNextFrame(); > > void createRootLayer(const WebCore::IntSize&); > WebCore::GraphicsLayer* rootLayer() const { return m_rootLayer.get(); } >@@ -95,27 +95,18 @@ private: > float deviceScaleFactor() const override; > float pageScaleFactor() const override; > >- // CoordinatedImageBacking::Client >- void createImageBacking(WebCore::CoordinatedImageBackingID) override; >- void updateImageBacking(WebCore::CoordinatedImageBackingID, RefPtr<Nicosia::Buffer>&&) override; >- void clearImageBackingContents(WebCore::CoordinatedImageBackingID) override; >- void removeImageBacking(WebCore::CoordinatedImageBackingID) override; >- > // CoordinatedGraphicsLayerClient > bool isFlushingLayerChanges() const override { return m_isFlushingLayerChanges; } > WebCore::FloatRect visibleContentsRect() const override; >- Ref<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image&) override; > void detachLayer(WebCore::CoordinatedGraphicsLayer*) override; > void attachLayer(WebCore::CoordinatedGraphicsLayer*) override; > Nicosia::PaintingEngine& paintingEngine() override; >- void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&) override; >+ void syncLayerState() override; > > // GraphicsLayerFactory > std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override; > > void initializeRootCompositingLayerIfNeeded(); >- void flushPendingImageBackingChanges(); >- void clearPendingStateChanges(); > > void purgeBackingStores(); > >@@ -134,8 +125,7 @@ private: > } m_nicosia; > WebCore::CoordinatedGraphicsState m_state; > >- HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> m_registeredLayers; >- HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking>> m_imageBackings; >+ HashMap<Nicosia::PlatformLayer::LayerID, WebCore::CoordinatedGraphicsLayer*> m_registeredLayers; > > std::unique_ptr<Nicosia::PaintingEngine> m_paintingEngine; > >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >index 7092fc5320b..a68e0f3ed10 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >@@ -149,7 +149,6 @@ void CoordinatedLayerTreeHost::renderNextFrame(bool forceRepaint) > { > m_isWaitingForRenderer = false; > bool scheduledWhileWaitingForRenderer = std::exchange(m_scheduledWhileWaitingForRenderer, false); >- m_coordinator.renderNextFrame(); > > if (m_forceRepaintAsync.callbackID) { > // If the asynchronous force-repaint needs a separate fresh flush, it was due to >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >index 0a8bec8a398..2a1ccf32f18 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >@@ -70,6 +70,7 @@ protected: > void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) override; > void notifyFlushRequired() override { scheduleLayerFlush(); }; > void commitSceneState(const WebCore::CoordinatedGraphicsState&) override; >+ RefPtr<Nicosia::SceneIntegration> sceneIntegration() override { return nullptr; } > > void flushLayersAndForceRepaint(); > >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp >index d99f16bce75..3e706642256 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp >@@ -35,6 +35,7 @@ > #include "WebPage.h" > #include <WebCore/Frame.h> > #include <WebCore/FrameView.h> >+#include <WebCore/NicosiaSceneIntegration.h> > > namespace WebKit { > using namespace WebCore; >@@ -59,6 +60,7 @@ ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webP > : CoordinatedLayerTreeHost(webPage) > , m_compositorClient(*this) > , m_surface(AcceleratedSurface::create(webPage, *this)) >+ , m_sceneIntegration(adoptRef(*new Nicosia::SceneIntegration(*this))) > , m_viewportController(webPage.size()) > { > if (FrameView* frameView = m_webPage.mainFrameView()) { >@@ -89,6 +91,7 @@ ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webP > > void ThreadedCoordinatedLayerTreeHost::invalidate() > { >+ m_sceneIntegration->invalidate(); > m_compositor->invalidate(); > CoordinatedLayerTreeHost::invalidate(); > m_surface = nullptr; >@@ -121,6 +124,11 @@ void ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate(bool ha > m_compositor->handleDisplayRefreshMonitorUpdate(); > } > >+RefPtr<Nicosia::SceneIntegration> ThreadedCoordinatedLayerTreeHost::sceneIntegration() >+{ >+ return m_sceneIntegration.copyRef(); >+} >+ > uint64_t ThreadedCoordinatedLayerTreeHost::nativeSurfaceHandleForCompositing() > { > if (!m_surface) >@@ -273,6 +281,11 @@ void ThreadedCoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphic > m_compositor->updateSceneState(state); > } > >+void ThreadedCoordinatedLayerTreeHost::requestUpdate() >+{ >+ m_compositor->requestUpdate(); >+} >+ > void ThreadedCoordinatedLayerTreeHost::setIsDiscardable(bool discardable) > { > m_isDiscardable = discardable; >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h >index 87a7da717cd..b8408b52961 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h >@@ -34,6 +34,7 @@ > #include "SimpleViewportController.h" > #include "ThreadedCompositor.h" > #include "ThreadedDisplayRefreshMonitor.h" >+#include <WebCore/NicosiaSceneIntegration.h> > #include <wtf/OptionSet.h> > > namespace WebCore { >@@ -46,7 +47,10 @@ namespace WebKit { > > class WebPage; > >-class ThreadedCoordinatedLayerTreeHost final : public CoordinatedLayerTreeHost, public AcceleratedSurface::Client { >+class ThreadedCoordinatedLayerTreeHost final >+ : public CoordinatedLayerTreeHost >+ , public AcceleratedSurface::Client >+ , public Nicosia::SceneIntegration::Client { > public: > static Ref<ThreadedCoordinatedLayerTreeHost> create(WebPage&); > virtual ~ThreadedCoordinatedLayerTreeHost(); >@@ -120,6 +124,9 @@ private: > void didFlushRootLayer(const WebCore::FloatRect&) override { } > void commitSceneState(const WebCore::CoordinatedGraphicsState&) override; > >+ // Nicosia::SceneIntegration::Client >+ void requestUpdate() override; >+ > #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) > RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) override; > #endif >@@ -127,6 +134,9 @@ private: > // AcceleratedSurface::Client > void frameComplete() override; > >+ // CompositingCoordinator::Client >+ RefPtr<Nicosia::SceneIntegration> sceneIntegration() override; >+ > uint64_t nativeSurfaceHandleForCompositing(); > void didDestroyGLContext(); > void willRenderFrame(); >@@ -144,6 +154,7 @@ private: > CompositorClient m_compositorClient; > std::unique_ptr<AcceleratedSurface> m_surface; > RefPtr<ThreadedCompositor> m_compositor; >+ Ref<Nicosia::SceneIntegration> m_sceneIntegration; > SimpleViewportController m_viewportController; > float m_lastPageScaleFactor { 1 }; > WebCore::IntPoint m_lastScrollPosition;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187385
:
344418
|
346471
|
346895
|
347274
|
347805
|
351378