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

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

Issue 21839004: cc: Push valid property values when CalcDrawProps skips layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pushpaintprops: Call SavePaintProps when needed in tests Created 7 years, 4 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 | « cc/layers/picture_layer.cc ('k') | 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 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 } 296 }
297 297
298 bool ScrollbarLayer::Update(ResourceUpdateQueue* queue, 298 bool ScrollbarLayer::Update(ResourceUpdateQueue* queue,
299 const OcclusionTracker* occlusion) { 299 const OcclusionTracker* occlusion) {
300 track_rect_ = scrollbar_->TrackRect(); 300 track_rect_ = scrollbar_->TrackRect();
301 301
302 if (layer_tree_host()->settings().solid_color_scrollbars) 302 if (layer_tree_host()->settings().solid_color_scrollbars)
303 return false; 303 return false;
304 304
305 bool updated = false;
306
305 { 307 {
306 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, 308 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_,
307 true); 309 true);
308 ContentsScalingLayer::Update(queue, occlusion); 310 updated = ContentsScalingLayer::Update(queue, occlusion);
309 } 311 }
310 312
311 dirty_rect_.Union(update_rect_); 313 dirty_rect_.Union(update_rect_);
312 if (content_bounds().IsEmpty()) 314 if (content_bounds().IsEmpty())
313 return false; 315 return false;
314 if (visible_content_rect().IsEmpty()) 316 if (visible_content_rect().IsEmpty())
315 return false; 317 return false;
316 318
317 CreateUpdaterIfNeeded(); 319 CreateUpdaterIfNeeded();
318 320
319 gfx::Rect content_rect = ScrollbarLayerRectToContentRect( 321 gfx::Rect content_rect = ScrollbarLayerRectToContentRect(
320 gfx::Rect(scrollbar_->Location(), bounds())); 322 gfx::Rect(scrollbar_->Location(), bounds()));
321 bool updated = UpdatePart(track_updater_.get(), track_.get(), content_rect, 323 updated |= UpdatePart(track_updater_.get(), track_.get(), content_rect,
322 queue); 324 queue);
323 325
324 if (scrollbar_->HasThumb()) { 326 if (scrollbar_->HasThumb()) {
325 thumb_thickness_ = scrollbar_->ThumbThickness(); 327 thumb_thickness_ = scrollbar_->ThumbThickness();
326 thumb_length_ = scrollbar_->ThumbLength(); 328 thumb_length_ = scrollbar_->ThumbLength();
327 gfx::Rect origin_thumb_rect = OriginThumbRect(); 329 gfx::Rect origin_thumb_rect = OriginThumbRect();
328 if (!origin_thumb_rect.IsEmpty()) { 330 if (!origin_thumb_rect.IsEmpty()) {
329 updated |= UpdatePart(thumb_updater_.get(), thumb_.get(), 331 updated |= UpdatePart(thumb_updater_.get(), thumb_.get(),
330 origin_thumb_rect, queue); 332 origin_thumb_rect, queue);
331 } 333 }
332 } 334 }
333 335
334 dirty_rect_ = gfx::RectF(); 336 dirty_rect_ = gfx::RectF();
335 return updated; 337 return updated;
336 } 338 }
337 339
338 gfx::Rect ScrollbarLayer::OriginThumbRect() const { 340 gfx::Rect ScrollbarLayer::OriginThumbRect() const {
339 gfx::Size thumb_size; 341 gfx::Size thumb_size;
340 if (Orientation() == HORIZONTAL) { 342 if (Orientation() == HORIZONTAL) {
341 thumb_size = gfx::Size(scrollbar_->ThumbLength(), 343 thumb_size = gfx::Size(scrollbar_->ThumbLength(),
342 scrollbar_->ThumbThickness()); 344 scrollbar_->ThumbThickness());
343 } else { 345 } else {
344 thumb_size = gfx::Size(scrollbar_->ThumbThickness(), 346 thumb_size = gfx::Size(scrollbar_->ThumbThickness(),
345 scrollbar_->ThumbLength()); 347 scrollbar_->ThumbLength());
346 } 348 }
347 return ScrollbarLayerRectToContentRect(gfx::Rect(thumb_size)); 349 return ScrollbarLayerRectToContentRect(gfx::Rect(thumb_size));
348 } 350 }
349 351
350 } // namespace cc 352 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698