diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp')
-rw-r--r-- | Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
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 <wtf/OwnPtr.h> #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) namespace WebCore { -PassOwnPtr<ScrollingStateFixedNode> ScrollingStateFixedNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID) +Ref<ScrollingStateFixedNode> 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<ScrollingStateNode> ScrollingStateFixedNode::clone(ScrollingStateTree& adoptiveTree) +Ref<ScrollingStateNode> 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<GraphicsLayer*>(layer())->syncPosition(position); + if (layer().representsGraphicsLayer()) { + GraphicsLayer* graphicsLayer = static_cast<GraphicsLayer*>(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"; |