Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(865)

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp

Issue 2643203002: Rewrite blink->cc scroll offset logic for SPV2 (Closed)
Patch Set: Move code back under updateScrollOffset Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp
index ade03cb8d00f135b3d1c44aff673e1b71175df7c..3107a2178cf8e15d44164b44f528e8b2b3510b83 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp
@@ -281,23 +281,27 @@ int PropertyTreeManager::ensureCompositorScrollNode(
return id;
}
-void PropertyTreeManager::updateScrollOffset(int layerId, int scrollId) {
- cc::ScrollNode& scrollNode = *scrollTree().Node(scrollId);
- cc::TransformNode& transformNode =
- *transformTree().Node(scrollNode.transform_id);
-
- transformNode.scrolls = true;
+void PropertyTreeManager::updateScrollOffset(
+ const ScrollPaintPropertyNode* scrollNode) {
+ int scrollNodeId = ensureCompositorScrollNode(scrollNode);
+ cc::ScrollNode& compositorScrollNode = *scrollTree().Node(scrollNodeId);
+ cc::TransformNode& compositorTransformNode =
+ *transformTree().Node(compositorScrollNode.transform_id);
// Blink creates a 2d transform node just for scroll offset whereas cc's
- // transform node has a special scroll offset field. To handle this we
- // adjust cc's transform node to remove the 2d scroll translation and
- // let the cc scroll tree update the cc scroll offset.
- DCHECK(transformNode.local.IsIdentityOr2DTranslation());
- auto offset = transformNode.local.To2dTranslation();
- transformNode.local.MakeIdentity();
- scrollTree().SetScrollOffset(layerId,
- gfx::ScrollOffset(-offset.x(), -offset.y()));
- scrollTree().set_needs_update(true);
+ // transform node has a special scroll offset field. To handle this we adjust
+ // cc's transform node to remove the 2d scroll translation and instead set the
+ // scroll_offset field.
+ auto* scrollOffsetTransform = scrollNode->scrollOffsetTranslation();
+ auto scrollOffsetSize = scrollOffsetTransform->matrix().to2DTranslation();
+ auto scrollOffset =
+ gfx::ScrollOffset(-scrollOffsetSize.width(), -scrollOffsetSize.height());
+ DCHECK(compositorTransformNode.local.IsIdentityOr2DTranslation());
+ compositorTransformNode.scroll_offset = scrollOffset;
+ compositorTransformNode.local.MakeIdentity();
+ compositorTransformNode.scrolls = true;
+ transformTree().set_needs_update(true);
+ // TODO(pdr): The scroll tree's scroll offset will need to be set here.
}
int PropertyTreeManager::switchToEffectNode(
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698