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

Unified Diff: cc/layers/scrollbar_layer.cc

Issue 15294018: Limit size of scaled layer rects in ScrollbarLayer to content_bounds(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to fix merge conflict. Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« 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