OLD | NEW |
1 | 1 |
2 // Copyright 2012 The Chromium Authors. All rights reserved. | 2 // Copyright 2012 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "cc/layers/scrollbar_layer.h" | 6 #include "cc/layers/scrollbar_layer.h" |
7 | 7 |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 | 252 |
253 gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( | 253 gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( |
254 gfx::Rect layer_rect) const { | 254 gfx::Rect layer_rect) const { |
255 // Don't intersect with the bounds as in LayerRectToContentRect() because | 255 // Don't intersect with the bounds as in LayerRectToContentRect() because |
256 // layer_rect here might be in coordinates of the containing layer. | 256 // layer_rect here might be in coordinates of the containing layer. |
257 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( | 257 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( |
258 layer_rect, contents_scale_y(), contents_scale_y()); | 258 layer_rect, contents_scale_y(), contents_scale_y()); |
259 // We should never return a rect bigger than the content_bounds(). | 259 // We should never return a rect bigger than the content_bounds(). |
260 gfx::Size clamped_size = expanded_rect.size(); | 260 gfx::Size clamped_size = expanded_rect.size(); |
261 clamped_size.ClampToMax(content_bounds()); | 261 clamped_size.SetToMin(content_bounds()); |
262 expanded_rect.set_size(clamped_size); | 262 expanded_rect.set_size(clamped_size); |
263 return expanded_rect; | 263 return expanded_rect; |
264 } | 264 } |
265 | 265 |
266 void ScrollbarLayer::SetTexturePriorities( | 266 void ScrollbarLayer::SetTexturePriorities( |
267 const PriorityCalculator& priority_calc) { | 267 const PriorityCalculator& priority_calc) { |
268 if (layer_tree_host()->settings().solid_color_scrollbars) | 268 if (layer_tree_host()->settings().solid_color_scrollbars) |
269 return; | 269 return; |
270 | 270 |
271 if (content_bounds().IsEmpty()) | 271 if (content_bounds().IsEmpty()) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 thumb_size = gfx::Size(scrollbar_->ThumbLength(), | 341 thumb_size = gfx::Size(scrollbar_->ThumbLength(), |
342 scrollbar_->ThumbThickness()); | 342 scrollbar_->ThumbThickness()); |
343 } else { | 343 } else { |
344 thumb_size = gfx::Size(scrollbar_->ThumbThickness(), | 344 thumb_size = gfx::Size(scrollbar_->ThumbThickness(), |
345 scrollbar_->ThumbLength()); | 345 scrollbar_->ThumbLength()); |
346 } | 346 } |
347 return ScrollbarLayerRectToContentRect(gfx::Rect(thumb_size)); | 347 return ScrollbarLayerRectToContentRect(gfx::Rect(thumb_size)); |
348 } | 348 } |
349 | 349 |
350 } // namespace cc | 350 } // namespace cc |
OLD | NEW |