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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 877173002: Fixed position layer counter-scroll with main thread scroll offset fractional part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests Created 5 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 | « cc/layers/layer_impl.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index e12e272653ab7fa2ed335c41ed084711a0da16c0..b05f8ec0e4a335bbad076c29f097c5de73740d27 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -46,13 +46,21 @@ static void SortLayers(LayerImplList::iterator first,
template <typename LayerType>
static gfx::Vector2dF GetEffectiveScrollDelta(LayerType* layer) {
- gfx::Vector2dF scroll_delta = layer->ScrollDelta();
+ // Layer's scroll offset can have an integer part and fractional part.
+ // Due to Blink's limitation, it only counter-scrolls the position-fixed
+ // layer using the integer part of Layer's scroll offset.
+ // CC scrolls the layer using the full scroll offset, so we have to
+ // add the fractional part of the scroll offset to the effective scroll
+ // delta which is used to counter-scroll the position-fixed layer.
+ gfx::Vector2dF scroll_delta =
+ layer->ScrollDelta() + layer->MainScrollOffsetFractionalPart();
// The scroll parent's scroll delta is the amount we've scrolled on the
// compositor thread since the commit for this layer tree's source frame.
// we last reported to the main thread. I.e., it's the discrepancy between
// a scroll parent's scroll delta and offset, so we must add it here.
if (layer->scroll_parent())
- scroll_delta += layer->scroll_parent()->ScrollDelta();
+ scroll_delta += layer->scroll_parent()->ScrollDelta() +
+ layer->scroll_parent()->MainScrollOffsetFractionalPart();
return scroll_delta;
}
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698