Index: cc/layers/scrollbar_layer.cc |
diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc |
index 4b8accb9ca5d05f74ebc45d8f9d3ead48b6b6901..d7c19ff253be7aad11c2478655d324c8c55ec406 100644 |
--- a/cc/layers/scrollbar_layer.cc |
+++ b/cc/layers/scrollbar_layer.cc |
@@ -358,9 +358,13 @@ gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( |
gfx::Rect layer_rect) const { |
// Don't intersect with the bounds as in LayerRectToContentRect() because |
// layer_rect here might be in coordinates of the containing layer. |
- return gfx::ScaleToEnclosingRect(layer_rect, |
- contents_scale_y(), |
- contents_scale_y()); |
+ gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( |
+ layer_rect, contents_scale_y(), contents_scale_y()); |
+ // We should never return a rect bigger than the content_bounds(). |
+ gfx::Size clamped_size = expanded_rect.size(); |
+ clamped_size.ClampToMax(content_bounds()); |
+ expanded_rect.set_size(clamped_size); |
+ return expanded_rect; |
} |
void ScrollbarLayer::SetTexturePriorities( |