summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp')
-rw-r--r--Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp35
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";