From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../page/scrolling/ScrollingStateFixedNode.cpp | 35 ++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp') diff --git a/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp b/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp index cce42eb7e..17d016597 100644 --- a/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp +++ b/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp @@ -27,17 +27,17 @@ #include "ScrollingStateFixedNode.h" #include "GraphicsLayer.h" +#include "Logging.h" #include "ScrollingStateTree.h" #include "TextStream.h" -#include #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) namespace WebCore { -PassOwnPtr ScrollingStateFixedNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID) +Ref ScrollingStateFixedNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID) { - return adoptPtr(new ScrollingStateFixedNode(stateTree, nodeID)); + return adoptRef(*new ScrollingStateFixedNode(stateTree, nodeID)); } ScrollingStateFixedNode::ScrollingStateFixedNode(ScrollingStateTree& tree, ScrollingNodeID nodeID) @@ -55,9 +55,9 @@ ScrollingStateFixedNode::~ScrollingStateFixedNode() { } -PassOwnPtr ScrollingStateFixedNode::clone(ScrollingStateTree& adoptiveTree) +Ref ScrollingStateFixedNode::clone(ScrollingStateTree& adoptiveTree) { - return adoptPtr(new ScrollingStateFixedNode(*this, adoptiveTree)); + return adoptRef(*new ScrollingStateFixedNode(*this, adoptiveTree)); } void ScrollingStateFixedNode::updateConstraints(const FixedPositionViewportConstraints& constraints) @@ -69,14 +69,31 @@ void ScrollingStateFixedNode::updateConstraints(const FixedPositionViewportConst setPropertyChanged(ViewportConstraints); } -void ScrollingStateFixedNode::syncLayerPositionForViewportRect(const LayoutRect& viewportRect) +void ScrollingStateFixedNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action) { FloatPoint position = m_constraints.layerPositionForViewportRect(viewportRect); - if (layer().representsGraphicsLayer()) - static_cast(layer())->syncPosition(position); + if (layer().representsGraphicsLayer()) { + GraphicsLayer* graphicsLayer = static_cast(layer()); + + LOG_WITH_STREAM(Compositing, stream << "ScrollingStateFixedNode::reconcileLayerPositionForViewportRect setting position of layer " << graphicsLayer->primaryLayerID() << " to " << position); + + switch (action) { + case ScrollingLayerPositionAction::Set: + graphicsLayer->setPosition(position); + break; + + case ScrollingLayerPositionAction::SetApproximate: + graphicsLayer->setApproximatePosition(position); + break; + + case ScrollingLayerPositionAction::Sync: + graphicsLayer->syncPosition(position); + break; + } + } } -void ScrollingStateFixedNode::dumpProperties(TextStream& ts, int indent) const +void ScrollingStateFixedNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const { ts << "(" << "Fixed node" << "\n"; -- cgit v1.2.1