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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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.h" 5 #include "cc/layers/scrollbar_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/layers/scrollbar_layer_impl.h" 10 #include "cc/layers/scrollbar_layer_impl.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 resource->texture()->ReturnBackingTexture(); 351 resource->texture()->ReturnBackingTexture();
352 352
353 gfx::Vector2d dest_offset(0, 0); 353 gfx::Vector2d dest_offset(0, 0);
354 resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats); 354 resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats);
355 } 355 }
356 356
357 gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( 357 gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect(
358 gfx::Rect layer_rect) const { 358 gfx::Rect layer_rect) const {
359 // Don't intersect with the bounds as in LayerRectToContentRect() because 359 // Don't intersect with the bounds as in LayerRectToContentRect() because
360 // layer_rect here might be in coordinates of the containing layer. 360 // layer_rect here might be in coordinates of the containing layer.
361 return gfx::ScaleToEnclosingRect(layer_rect, 361 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect(
362 contents_scale_y(), 362 layer_rect, contents_scale_y(), contents_scale_y());
363 contents_scale_y()); 363 // We should never return a rect bigger than the content_bounds().
364 gfx::Size clamped_size = expanded_rect.size();
365 clamped_size.ClampToMax(content_bounds());
366 expanded_rect.set_size(clamped_size);
367 return expanded_rect;
364 } 368 }
365 369
366 void ScrollbarLayer::SetTexturePriorities( 370 void ScrollbarLayer::SetTexturePriorities(
367 const PriorityCalculator& priority_calc) { 371 const PriorityCalculator& priority_calc) {
368 if (layer_tree_host()->settings().solid_color_scrollbars) 372 if (layer_tree_host()->settings().solid_color_scrollbars)
369 return; 373 return;
370 374
371 if (content_bounds().IsEmpty()) 375 if (content_bounds().IsEmpty())
372 return; 376 return;
373 DCHECK_LE(content_bounds().width(), MaxTextureSize()); 377 DCHECK_LE(content_bounds().width(), MaxTextureSize());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 thumb_.get(), 442 thumb_.get(),
439 origin_thumb_rect, 443 origin_thumb_rect,
440 queue, 444 queue,
441 stats); 445 stats);
442 } 446 }
443 447
444 dirty_rect_ = gfx::RectF(); 448 dirty_rect_ = gfx::RectF();
445 } 449 }
446 450
447 } // namespace cc 451 } // namespace cc
OLDNEW
« 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