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

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

Issue 23102003: Note scrollbar layer properties changed when position changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/scrollbar_layer_impl.h ('k') | 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "cc/layers/scrollbar_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/animation/scrollbar_animation_controller.h" 9 #include "cc/animation/scrollbar_animation_controller.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return ScrollbarLayerImpl::Create(tree_impl, 56 return ScrollbarLayerImpl::Create(tree_impl,
57 id(), 57 id(),
58 orientation_).PassAs<LayerImpl>(); 58 orientation_).PassAs<LayerImpl>();
59 } 59 }
60 60
61 void ScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { 61 void ScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) {
62 LayerImpl::PushPropertiesTo(layer); 62 LayerImpl::PushPropertiesTo(layer);
63 63
64 ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer); 64 ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer);
65 65
66 scrollbar_layer->set_thumb_thickness(thumb_thickness_); 66 scrollbar_layer->SetThumbThickness(thumb_thickness_);
67 scrollbar_layer->set_thumb_length(thumb_length_); 67 scrollbar_layer->SetThumbLength(thumb_length_);
68 scrollbar_layer->set_track_start(track_start_); 68 scrollbar_layer->SetTrackStart(track_start_);
69 scrollbar_layer->set_track_length(track_length_); 69 scrollbar_layer->SetTrackLength(track_length_);
70 scrollbar_layer->set_is_overlay_scrollbar(is_overlay_scrollbar_); 70 scrollbar_layer->set_is_overlay_scrollbar(is_overlay_scrollbar_);
71 71
72 scrollbar_layer->set_track_ui_resource_id(track_ui_resource_id_); 72 scrollbar_layer->set_track_ui_resource_id(track_ui_resource_id_);
73 scrollbar_layer->set_thumb_ui_resource_id(thumb_ui_resource_id_); 73 scrollbar_layer->set_thumb_ui_resource_id(thumb_ui_resource_id_);
74 } 74 }
75 75
76 bool ScrollbarLayerImpl::WillDraw(DrawMode draw_mode, 76 bool ScrollbarLayerImpl::WillDraw(DrawMode draw_mode,
77 ResourceProvider* resource_provider) { 77 ResourceProvider* resource_provider) {
78 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE && 78 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE &&
79 !layer_tree_impl()->settings().solid_color_scrollbars) 79 !layer_tree_impl()->settings().solid_color_scrollbars)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 gfx::Rect ScrollbarLayerImpl::ScrollbarLayerRectToContentRect( 162 gfx::Rect ScrollbarLayerImpl::ScrollbarLayerRectToContentRect(
163 gfx::RectF layer_rect) const { 163 gfx::RectF layer_rect) const {
164 // Don't intersect with the bounds as in layerRectToContentRect() because 164 // Don't intersect with the bounds as in layerRectToContentRect() because
165 // layer_rect here might be in coordinates of the containing layer. 165 // layer_rect here might be in coordinates of the containing layer.
166 gfx::RectF content_rect = gfx::ScaleRect(layer_rect, 166 gfx::RectF content_rect = gfx::ScaleRect(layer_rect,
167 contents_scale_x(), 167 contents_scale_x(),
168 contents_scale_y()); 168 contents_scale_y());
169 return gfx::ToEnclosingRect(content_rect); 169 return gfx::ToEnclosingRect(content_rect);
170 } 170 }
171 171
172 void ScrollbarLayerImpl::SetThumbThickness(int thumb_thickness) {
173 if (thumb_thickness_ == thumb_thickness)
174 return;
175 thumb_thickness_ = thumb_thickness;
176 NoteLayerPropertyChanged();
177 }
178
179 void ScrollbarLayerImpl::SetThumbLength(int thumb_length) {
180 if (thumb_length_ == thumb_length)
181 return;
182 thumb_length_ = thumb_length;
183 NoteLayerPropertyChanged();
184 }
185 void ScrollbarLayerImpl::SetTrackStart(int track_start) {
186 if (track_start_ == track_start)
187 return;
188 track_start_ = track_start;
189 NoteLayerPropertyChanged();
190 }
191
192 void ScrollbarLayerImpl::SetTrackLength(int track_length) {
193 if (track_length_ == track_length)
194 return;
195 track_length_ = track_length;
196 NoteLayerPropertyChanged();
197 }
198
199 void ScrollbarLayerImpl::SetVerticalAdjust(float vertical_adjust) {
200 if (vertical_adjust_ == vertical_adjust)
201 return;
202 vertical_adjust_ = vertical_adjust;
203 NoteLayerPropertyChanged();
204 }
205
206 void ScrollbarLayerImpl::SetVisibleToTotalLengthRatio(float ratio) {
207 if (visible_to_total_length_ratio_ == ratio)
208 return;
209 visible_to_total_length_ratio_ = ratio;
210 NoteLayerPropertyChanged();
211 }
212
213 void ScrollbarLayerImpl::SetCurrentPos(float current_pos) {
214 if (current_pos_ == current_pos)
215 return;
216 current_pos_ = current_pos;
217 NoteLayerPropertyChanged();
218 }
219
220 void ScrollbarLayerImpl::SetMaximum(int maximum) {
221 if (maximum_ == maximum)
222 return;
223 maximum_ = maximum;
224 NoteLayerPropertyChanged();
225 }
226
172 gfx::Rect ScrollbarLayerImpl::ComputeThumbQuadRect() const { 227 gfx::Rect ScrollbarLayerImpl::ComputeThumbQuadRect() const {
173 // Thumb extent is the length of the thumb in the scrolling direction, thumb 228 // Thumb extent is the length of the thumb in the scrolling direction, thumb
174 // thickness is in the perpendicular direction. Here's an example of a 229 // thickness is in the perpendicular direction. Here's an example of a
175 // horizontal scrollbar - inputs are above the scrollbar, computed values 230 // horizontal scrollbar - inputs are above the scrollbar, computed values
176 // below: 231 // below:
177 // 232 //
178 // |<------------------- track_length_ ------------------->| 233 // |<------------------- track_length_ ------------------->|
179 // 234 //
180 // |--| <-- start_offset 235 // |--| <-- start_offset
181 // 236 //
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 313 }
259 314
260 return ScrollbarLayerRectToContentRect(thumb_rect); 315 return ScrollbarLayerRectToContentRect(thumb_rect);
261 } 316 }
262 317
263 const char* ScrollbarLayerImpl::LayerTypeAsString() const { 318 const char* ScrollbarLayerImpl::LayerTypeAsString() const {
264 return "cc::ScrollbarLayerImpl"; 319 return "cc::ScrollbarLayerImpl";
265 } 320 }
266 321
267 } // namespace cc 322 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/scrollbar_layer_impl.h ('k') | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698