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

Unified Diff: cc/trees/property_tree.cc

Issue 1021823006: Fix scroll position adjustment for fixed-position layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 9 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 | « cc/trees/property_tree.h ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index 544755b211625cf9ab73cfdbbc88b9d28bca0333..febd17068105994c4861ab9721234e14c6ac6021 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -316,20 +316,22 @@ void TransformTree::UpdateSnapping(TransformNode* node) {
rounded.RoundTranslationComponents();
gfx::Transform delta = node->data.from_target;
delta *= rounded;
- gfx::Transform inverse_delta(gfx::Transform::kSkipInitialization);
- bool invertible_delta = delta.GetInverse(&inverse_delta);
- // The delta should be a translation, modulo floating point error, and should
- // therefore be invertible.
- DCHECK(invertible_delta);
+ DCHECK(delta.IsIdentityOr2DTranslation());
+
+ gfx::Vector2dF translation = delta.To2dTranslation();
// Now that we have our scroll delta, we must apply it to each of our
// combined, to/from matrices.
- node->data.to_parent.PreconcatTransform(delta);
- node->data.to_target.PreconcatTransform(delta);
- node->data.from_target.ConcatTransform(inverse_delta);
- node->data.to_screen.PreconcatTransform(delta);
- node->data.from_screen.ConcatTransform(inverse_delta);
+ node->data.to_parent.Translate(translation.x(), translation.y());
+ node->data.to_target.Translate(translation.x(), translation.y());
+ node->data.from_target.matrix().postTranslate(-translation.x(),
+ -translation.y(), 0);
+ node->data.to_screen.Translate(translation.x(), translation.y());
+ node->data.from_screen.matrix().postTranslate(-translation.x(),
+ -translation.y(), 0);
+
+ node->data.scroll_snap = translation;
}
} // namespace cc
« no previous file with comments | « cc/trees/property_tree.h ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698