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

Side by Side Diff: cc/layers/scrollbar_layer_impl_base.cc

Issue 2803853007: Ignore rounding error between clip_layer_length_ and scroll_layer_length_ (Closed)
Patch Set: rebase update Created 3 years, 8 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 | « no previous file | cc/layers/scrollbar_layer_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/scrollbar_layer_impl_base.h" 5 #include "cc/layers/scrollbar_layer_impl_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "cc/trees/effect_node.h" 8 #include "cc/trees/effect_node.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 #include "ui/gfx/geometry/rect_conversions.h" 10 #include "ui/gfx/geometry/rect_conversions.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return false; 63 return false;
64 current_pos_ = current_pos; 64 current_pos_ = current_pos;
65 NoteLayerPropertyChanged(); 65 NoteLayerPropertyChanged();
66 return true; 66 return true;
67 } 67 }
68 68
69 bool ScrollbarLayerImplBase::CanScrollOrientation() const { 69 bool ScrollbarLayerImplBase::CanScrollOrientation() const {
70 LayerImpl* scroll_layer = layer_tree_impl()->LayerById(scroll_layer_id_); 70 LayerImpl* scroll_layer = layer_tree_impl()->LayerById(scroll_layer_id_);
71 if (!scroll_layer) 71 if (!scroll_layer)
72 return false; 72 return false;
73
74 float device_scale_factor = layer_tree_impl()->device_scale_factor();
75
76 int clip_layer_length = std::ceil(clip_layer_length_ * device_scale_factor);
bokan 2017/04/20 21:34:36 Sorry to flip flop again, but I think you were rig
77 int scroll_layer_length =
78 std::ceil(scroll_layer_length_ * device_scale_factor);
79
73 return scroll_layer->user_scrollable(orientation()) && 80 return scroll_layer->user_scrollable(orientation()) &&
74 clip_layer_length_ < scroll_layer_length_; 81 clip_layer_length < scroll_layer_length;
75 } 82 }
76 83
77 bool ScrollbarLayerImplBase::SetVerticalAdjust(float vertical_adjust) { 84 bool ScrollbarLayerImplBase::SetVerticalAdjust(float vertical_adjust) {
78 if (vertical_adjust_ == vertical_adjust) 85 if (vertical_adjust_ == vertical_adjust)
79 return false; 86 return false;
80 vertical_adjust_ = vertical_adjust; 87 vertical_adjust_ = vertical_adjust;
81 NoteLayerPropertyChanged(); 88 NoteLayerPropertyChanged();
82 return true; 89 return true;
83 } 90 }
84 91
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity); 237 layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity);
231 238
232 node->opacity = opacity; 239 node->opacity = opacity;
233 node->effect_changed = true; 240 node->effect_changed = true;
234 property_trees->changed = true; 241 property_trees->changed = true;
235 property_trees->effect_tree.set_needs_update(true); 242 property_trees->effect_tree.set_needs_update(true);
236 layer_tree_impl()->set_needs_update_draw_properties(); 243 layer_tree_impl()->set_needs_update_draw_properties();
237 } 244 }
238 245
239 } // namespace cc 246 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698