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/blink/scrollbar_impl.cc

Issue 1458703010: Mac: Don't repaint scrollbars every frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master2
Patch Set: Add missed file in rebase Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/blink/scrollbar_impl.h" 5 #include "cc/blink/scrollbar_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebScrollbar.h" 8 #include "third_party/WebKit/public/platform/WebScrollbar.h"
9 #include "third_party/WebKit/public/platform/WebScrollbarThemeGeometry.h" 9 #include "third_party/WebKit/public/platform/WebScrollbarThemeGeometry.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 gfx::Rect thumb_rect = geometry_->thumbRect(scrollbar_.get()); 56 gfx::Rect thumb_rect = geometry_->thumbRect(scrollbar_.get());
57 if (scrollbar_->orientation() == WebScrollbar::Horizontal) 57 if (scrollbar_->orientation() == WebScrollbar::Horizontal)
58 return thumb_rect.width(); 58 return thumb_rect.width();
59 return thumb_rect.height(); 59 return thumb_rect.height();
60 } 60 }
61 61
62 gfx::Rect ScrollbarImpl::TrackRect() const { 62 gfx::Rect ScrollbarImpl::TrackRect() const {
63 return geometry_->trackRect(scrollbar_.get()); 63 return geometry_->trackRect(scrollbar_.get());
64 } 64 }
65 65
66 float ScrollbarImpl::ThumbOpacity() const {
67 return painter_.thumbOpacity();
68 }
69
70 float ScrollbarImpl::TrackOpacity() const {
71 return painter_.trackOpacity();
72 }
73
74 bool ScrollbarImpl::NeedsPaintPart(cc::ScrollbarPart part) const {
75 if (part == cc::THUMB)
76 return painter_.thumbNeedsRepaint();
77 return painter_.trackBackgroudNeedsRepaint();
enne (OOO) 2015/11/24 17:59:18 typo?
ccameron 2015/11/24 18:48:19 Which one? (I think this is right -- I'm following
enne (OOO) 2015/11/24 18:55:13 It's hidden in the backgroud.
78 }
79
66 void ScrollbarImpl::PaintPart(SkCanvas* canvas, 80 void ScrollbarImpl::PaintPart(SkCanvas* canvas,
67 cc::ScrollbarPart part, 81 cc::ScrollbarPart part,
68 const gfx::Rect& content_rect) { 82 const gfx::Rect& content_rect) {
69 if (part == cc::THUMB) { 83 if (part == cc::THUMB) {
70 painter_.paintThumb(canvas, content_rect); 84 painter_.paintThumb(canvas, content_rect);
71 return; 85 return;
72 } 86 }
73 87
74 // The following is a simplification of ScrollbarThemeComposite::paint. 88 // The following is a simplification of ScrollbarThemeComposite::paint.
75 painter_.paintScrollbarBackground(canvas, content_rect); 89 painter_.paintScrollbarBackground(canvas, content_rect);
(...skipping 22 matching lines...) Expand all
98 bool thumb_present = geometry_->hasThumb(scrollbar_.get()); 112 bool thumb_present = geometry_->hasThumb(scrollbar_.get());
99 if (thumb_present) { 113 if (thumb_present) {
100 painter_.paintForwardTrackPart(canvas, track_paint_rect); 114 painter_.paintForwardTrackPart(canvas, track_paint_rect);
101 painter_.paintBackTrackPart(canvas, track_paint_rect); 115 painter_.paintBackTrackPart(canvas, track_paint_rect);
102 } 116 }
103 117
104 painter_.paintTickmarks(canvas, track_paint_rect); 118 painter_.paintTickmarks(canvas, track_paint_rect);
105 } 119 }
106 120
107 } // namespace cc_blink 121 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698