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

Side by Side 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: ready for review 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 unified diff | Download patch
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 28 matching lines...) Expand all
39 static void SortLayers(LayerImplList::iterator first, 39 static void SortLayers(LayerImplList::iterator first,
40 LayerImplList::iterator end, 40 LayerImplList::iterator end,
41 LayerSorter* layer_sorter) { 41 LayerSorter* layer_sorter) {
42 DCHECK(layer_sorter); 42 DCHECK(layer_sorter);
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 gfx::Vector2dF scroll_delta = layer->ScrollDelta(); 49 gfx::Vector2dF scroll_delta =
50 layer->ScrollDelta() + layer->MainScrollOffsetFracitionalPart();
aelias_OOO_until_Jul13 2015/01/28 02:04:00 Please add a comment explaining why the fractional
Yufeng Shen (Slow to review) 2015/01/28 22:28:09 Done.
50 // The scroll parent's scroll delta is the amount we've scrolled on the 51 // The scroll parent's scroll delta is the amount we've scrolled on the
51 // compositor thread since the commit for this layer tree's source frame. 52 // compositor thread since the commit for this layer tree's source frame.
52 // we last reported to the main thread. I.e., it's the discrepancy between 53 // we last reported to the main thread. I.e., it's the discrepancy between
53 // a scroll parent's scroll delta and offset, so we must add it here. 54 // a scroll parent's scroll delta and offset, so we must add it here.
54 if (layer->scroll_parent()) 55 if (layer->scroll_parent())
55 scroll_delta += layer->scroll_parent()->ScrollDelta(); 56 scroll_delta += layer->scroll_parent()->ScrollDelta() +
57 layer->scroll_parent()->MainScrollOffsetFracitionalPart();
56 return scroll_delta; 58 return scroll_delta;
57 } 59 }
58 60
59 template <typename LayerType> 61 template <typename LayerType>
60 static gfx::ScrollOffset GetEffectiveTotalScrollOffset(LayerType* layer) { 62 static gfx::ScrollOffset GetEffectiveTotalScrollOffset(LayerType* layer) {
61 gfx::ScrollOffset offset = layer->TotalScrollOffset(); 63 gfx::ScrollOffset offset = layer->TotalScrollOffset();
62 // The scroll parent's total scroll offset (scroll offset + scroll delta) 64 // The scroll parent's total scroll offset (scroll offset + scroll delta)
63 // can't be used because its scroll offset has already been applied to the 65 // can't be used because its scroll offset has already been applied to the
64 // scroll children's positions by the main thread layer positioning code. 66 // scroll children's positions by the main thread layer positioning code.
65 if (layer->scroll_parent()) 67 if (layer->scroll_parent())
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 inputs->current_render_surface_layer_list_id); 2566 inputs->current_render_surface_layer_list_id);
2565 2567
2566 // The dummy layer list should not have been used. 2568 // The dummy layer list should not have been used.
2567 DCHECK_EQ(0u, dummy_layer_list.size()); 2569 DCHECK_EQ(0u, dummy_layer_list.size());
2568 // A root layer render_surface should always exist after 2570 // A root layer render_surface should always exist after
2569 // CalculateDrawProperties. 2571 // CalculateDrawProperties.
2570 DCHECK(inputs->root_layer->render_surface()); 2572 DCHECK(inputs->root_layer->render_surface());
2571 } 2573 }
2572 2574
2573 } // namespace cc 2575 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698