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

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 888743003: Rename ScrollOffsetFractionalPart to ScrollCompensationAdjustment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TRACE_EVENT0("cc", "LayerTreeHostCommon::SortLayers"); 43 TRACE_EVENT0("cc", "LayerTreeHostCommon::SortLayers");
44 layer_sorter->Sort(first, end); 44 layer_sorter->Sort(first, end);
45 } 45 }
46 46
47 template <typename LayerType> 47 template <typename LayerType>
48 static gfx::Vector2dF GetEffectiveScrollDelta(LayerType* layer) { 48 static gfx::Vector2dF GetEffectiveScrollDelta(LayerType* layer) {
49 // Layer's scroll offset can have an integer part and fractional part. 49 // Layer's scroll offset can have an integer part and fractional part.
50 // Due to Blink's limitation, it only counter-scrolls the position-fixed 50 // Due to Blink's limitation, it only counter-scrolls the position-fixed
51 // layer using the integer part of Layer's scroll offset. 51 // layer using the integer part of Layer's scroll offset.
52 // CC scrolls the layer using the full scroll offset, so we have to 52 // CC scrolls the layer using the full scroll offset, so we have to
53 // add the fractional part of the scroll offset to the effective scroll 53 // add the ScrollCompensationAdjustment (fractional part of the scroll
54 // delta which is used to counter-scroll the position-fixed layer. 54 // offset) to the effective scroll delta which is used to counter-scroll
55 // the position-fixed layer.
55 gfx::Vector2dF scroll_delta = 56 gfx::Vector2dF scroll_delta =
56 layer->ScrollDelta() + layer->MainScrollOffsetFractionalPart(); 57 layer->ScrollDelta() + layer->ScrollCompensationAdjustment();
57 // The scroll parent's scroll delta is the amount we've scrolled on the 58 // The scroll parent's scroll delta is the amount we've scrolled on the
58 // compositor thread since the commit for this layer tree's source frame. 59 // compositor thread since the commit for this layer tree's source frame.
59 // we last reported to the main thread. I.e., it's the discrepancy between 60 // we last reported to the main thread. I.e., it's the discrepancy between
60 // a scroll parent's scroll delta and offset, so we must add it here. 61 // a scroll parent's scroll delta and offset, so we must add it here.
61 if (layer->scroll_parent()) 62 if (layer->scroll_parent())
62 scroll_delta += layer->scroll_parent()->ScrollDelta() + 63 scroll_delta += layer->scroll_parent()->ScrollDelta() +
63 layer->scroll_parent()->MainScrollOffsetFractionalPart(); 64 layer->ScrollCompensationAdjustment();
64 return scroll_delta; 65 return scroll_delta;
65 } 66 }
66 67
67 template <typename LayerType> 68 template <typename LayerType>
68 static gfx::ScrollOffset GetEffectiveTotalScrollOffset(LayerType* layer) { 69 static gfx::ScrollOffset GetEffectiveTotalScrollOffset(LayerType* layer) {
69 gfx::ScrollOffset offset = layer->TotalScrollOffset(); 70 gfx::ScrollOffset offset = layer->TotalScrollOffset();
70 // The scroll parent's total scroll offset (scroll offset + scroll delta) 71 // The scroll parent's total scroll offset (scroll offset + scroll delta)
71 // can't be used because its scroll offset has already been applied to the 72 // can't be used because its scroll offset has already been applied to the
72 // scroll children's positions by the main thread layer positioning code. 73 // scroll children's positions by the main thread layer positioning code.
73 if (layer->scroll_parent()) 74 if (layer->scroll_parent())
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 inputs->current_render_surface_layer_list_id); 2573 inputs->current_render_surface_layer_list_id);
2573 2574
2574 // The dummy layer list should not have been used. 2575 // The dummy layer list should not have been used.
2575 DCHECK_EQ(0u, dummy_layer_list.size()); 2576 DCHECK_EQ(0u, dummy_layer_list.size());
2576 // A root layer render_surface should always exist after 2577 // A root layer render_surface should always exist after
2577 // CalculateDrawProperties. 2578 // CalculateDrawProperties.
2578 DCHECK(inputs->root_layer->render_surface()); 2579 DCHECK(inputs->root_layer->render_surface());
2579 } 2580 }
2580 2581
2581 } // namespace cc 2582 } // namespace cc
OLDNEW
« 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