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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp

Issue 1525803002: Make ScrollbarThemeAura selectively invalidate scrollbar parts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments per skobes Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 pictureBuilder.endRecording()->playback(canvas); 59 pictureBuilder.endRecording()->playback(canvas);
60 } 60 }
61 61
62 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web Rect& rect) 62 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web Rect& rect)
63 { 63 {
64 IntRect intRect(rect); 64 IntRect intRect(rect);
65 SkPictureBuilder pictureBuilder(intRect); 65 SkPictureBuilder pictureBuilder(intRect);
66 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); 66 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
67 m_theme->paintTrackBackground(pictureBuilder.context(), *m_scrollbar, intRec t); 67 m_theme->paintTrackBackground(pictureBuilder.context(), *m_scrollbar, intRec t);
68 pictureBuilder.endRecording()->playback(canvas); 68 pictureBuilder.endRecording()->playback(canvas);
69 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) 69 m_scrollbar->setTrackNeedsRepaint(false);
70 m_scrollbar->setTrackNeedsRepaint(false);
71 } 70 }
72 71
73 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe ct& rect) 72 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe ct& rect)
74 { 73 {
75 IntRect intRect(rect); 74 IntRect intRect(rect);
76 SkPictureBuilder pictureBuilder(intRect); 75 SkPictureBuilder pictureBuilder(intRect);
77 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); 76 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
78 m_theme->paintTrackPiece(pictureBuilder.context(), *m_scrollbar, intRect, Ba ckTrackPart); 77 m_theme->paintTrackPiece(pictureBuilder.context(), *m_scrollbar, intRect, Ba ckTrackPart);
79 pictureBuilder.endRecording()->playback(canvas); 78 pictureBuilder.endRecording()->playback(canvas);
80 } 79 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 pictureBuilder.endRecording()->playback(canvas); 132 pictureBuilder.endRecording()->playback(canvas);
134 } 133 }
135 134
136 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect ) 135 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect )
137 { 136 {
138 IntRect intRect(rect); 137 IntRect intRect(rect);
139 SkPictureBuilder pictureBuilder(intRect); 138 SkPictureBuilder pictureBuilder(intRect);
140 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); 139 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
141 m_theme->paintThumb(pictureBuilder.context(), *m_scrollbar, intRect); 140 m_theme->paintThumb(pictureBuilder.context(), *m_scrollbar, intRect);
142 pictureBuilder.endRecording()->playback(canvas); 141 pictureBuilder.endRecording()->playback(canvas);
143 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) 142 m_scrollbar->setThumbNeedsRepaint(false);
144 m_scrollbar->setThumbNeedsRepaint(false);
145 } 143 }
146 144
147 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme& theme, Scroll bar& scrollbar, float deviceScaleFactor) 145 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme& theme, Scroll bar& scrollbar, float deviceScaleFactor)
148 : m_theme(&theme) 146 : m_theme(&theme)
149 , m_scrollbar(&scrollbar) 147 , m_scrollbar(&scrollbar)
150 , m_deviceScaleFactor(deviceScaleFactor) 148 , m_deviceScaleFactor(deviceScaleFactor)
151 { 149 {
152 } 150 }
153 151
154 float WebScrollbarThemePainter::thumbOpacity() const 152 float WebScrollbarThemePainter::thumbOpacity() const
155 { 153 {
156 return m_theme->thumbOpacity(*m_scrollbar); 154 return m_theme->thumbOpacity(*m_scrollbar);
157 } 155 }
158 156
159 bool WebScrollbarThemePainter::trackNeedsRepaint() const 157 bool WebScrollbarThemePainter::trackNeedsRepaint() const
160 { 158 {
161 return m_scrollbar->trackNeedsRepaint(); 159 return m_scrollbar->trackNeedsRepaint();
162 } 160 }
163 161
164 bool WebScrollbarThemePainter::thumbNeedsRepaint() const 162 bool WebScrollbarThemePainter::thumbNeedsRepaint() const
165 { 163 {
166 return m_scrollbar->thumbNeedsRepaint(); 164 return m_scrollbar->thumbNeedsRepaint();
167 } 165 }
168 166
169 } // namespace blink 167 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698