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

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

Issue 2384063007: Fix scrollbar overflow with ScaleToEnclosingRectSafe (Closed)
Patch Set: With comment Created 4 years, 2 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 | ui/gfx/geometry/rect.h » ('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/painted_scrollbar_layer.h" 5 #include "cc/layers/painted_scrollbar_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 thumb_resource_ = nullptr; 126 thumb_resource_ = nullptr;
127 } 127 }
128 128
129 Layer::SetLayerTreeHost(host); 129 Layer::SetLayerTreeHost(host);
130 } 130 }
131 131
132 gfx::Rect PaintedScrollbarLayer::ScrollbarLayerRectToContentRect( 132 gfx::Rect PaintedScrollbarLayer::ScrollbarLayerRectToContentRect(
133 const gfx::Rect& layer_rect) const { 133 const gfx::Rect& layer_rect) const {
134 // Don't intersect with the bounds as in LayerRectToContentRect() because 134 // Don't intersect with the bounds as in LayerRectToContentRect() because
135 // layer_rect here might be in coordinates of the containing layer. 135 // layer_rect here might be in coordinates of the containing layer.
136 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( 136 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRectSafe(
137 layer_rect, internal_contents_scale_, internal_contents_scale_); 137 layer_rect, internal_contents_scale_, internal_contents_scale_);
138 // We should never return a rect bigger than the content bounds. 138 // We should never return a rect bigger than the content bounds.
139 gfx::Size clamped_size = expanded_rect.size(); 139 gfx::Size clamped_size = expanded_rect.size();
140 clamped_size.SetToMin(internal_content_bounds_); 140 clamped_size.SetToMin(internal_content_bounds_);
141 expanded_rect.set_size(clamped_size); 141 expanded_rect.set_size(clamped_size);
142 return expanded_rect; 142 return expanded_rect;
143 } 143 }
144 144
145 gfx::Rect PaintedScrollbarLayer::OriginThumbRect() const { 145 gfx::Rect PaintedScrollbarLayer::OriginThumbRect() const {
146 gfx::Size thumb_size; 146 gfx::Size thumb_size;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 scrollbar_->PaintPart(&skcanvas, part, layer_rect); 284 scrollbar_->PaintPart(&skcanvas, part, layer_rect);
285 // Make sure that the pixels are no longer mutable to unavoid unnecessary 285 // Make sure that the pixels are no longer mutable to unavoid unnecessary
286 // allocation and copying. 286 // allocation and copying.
287 skbitmap.setImmutable(); 287 skbitmap.setImmutable();
288 288
289 return UIResourceBitmap(skbitmap); 289 return UIResourceBitmap(skbitmap);
290 } 290 }
291 291
292 } // namespace cc 292 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/geometry/rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698