OLD | NEW |
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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 static PassOwnPtr<ScrollbarBackgroundPainter> create(ScrollbarThemeClient* s
crollbar, ScrollbarThemeComposite* theme) | 109 static PassOwnPtr<ScrollbarBackgroundPainter> create(ScrollbarThemeClient* s
crollbar, ScrollbarThemeComposite* theme) |
110 { | 110 { |
111 return adoptPtr(new ScrollbarBackgroundPainter(scrollbar, theme)); | 111 return adoptPtr(new ScrollbarBackgroundPainter(scrollbar, theme)); |
112 } | 112 } |
113 | 113 |
114 virtual void paint(SkCanvas* canvas, const IntRect& contentRect, IntRect&) O
VERRIDE | 114 virtual void paint(SkCanvas* canvas, const IntRect& contentRect, IntRect&) O
VERRIDE |
115 { | 115 { |
116 PlatformContextSkia platformContext(canvas); | 116 PlatformContextSkia platformContext(canvas); |
117 platformContext.setDrawingToImageBuffer(true); | 117 platformContext.setDrawingToImageBuffer(true); |
118 GraphicsContext context(&platformContext); | 118 GraphicsContext context(&platformContext); |
119 context.clearRect(contentRect); | |
120 context.clip(contentRect); | |
121 | 119 |
122 // The following is a simplification of ScrollbarThemeComposite::paint. | 120 // The following is a simplification of ScrollbarThemeComposite::paint. |
123 m_theme->paintScrollbarBackground(&context, m_scrollbar); | 121 m_theme->paintScrollbarBackground(&context, m_scrollbar); |
124 | 122 |
125 if (m_theme->hasButtons(m_scrollbar)) { | 123 if (m_theme->hasButtons(m_scrollbar)) { |
126 IntRect backButtonStartPaintRect = m_theme->backButtonRect(m_scrollb
ar, BackButtonStartPart, true); | 124 IntRect backButtonStartPaintRect = m_theme->backButtonRect(m_scrollb
ar, BackButtonStartPart, true); |
127 m_theme->paintButton(&context, m_scrollbar, backButtonStartPaintRect
, BackButtonStartPart); | 125 m_theme->paintButton(&context, m_scrollbar, backButtonStartPaintRect
, BackButtonStartPart); |
128 | 126 |
129 IntRect backButtonEndPaintRect = m_theme->backButtonRect(m_scrollbar
, BackButtonEndPart, true); | 127 IntRect backButtonEndPaintRect = m_theme->backButtonRect(m_scrollbar
, BackButtonEndPart, true); |
130 m_theme->paintButton(&context, m_scrollbar, backButtonEndPaintRect,
BackButtonEndPart); | 128 m_theme->paintButton(&context, m_scrollbar, backButtonEndPaintRect,
BackButtonEndPart); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 { | 167 { |
170 return adoptPtr(new ScrollbarThumbPainter(scrollbar, theme)); | 168 return adoptPtr(new ScrollbarThumbPainter(scrollbar, theme)); |
171 } | 169 } |
172 | 170 |
173 virtual void paint(SkCanvas* canvas, const IntRect& contentRect, IntRect& op
aque) OVERRIDE | 171 virtual void paint(SkCanvas* canvas, const IntRect& contentRect, IntRect& op
aque) OVERRIDE |
174 { | 172 { |
175 PlatformContextSkia platformContext(canvas); | 173 PlatformContextSkia platformContext(canvas); |
176 platformContext.setDrawingToImageBuffer(true); | 174 platformContext.setDrawingToImageBuffer(true); |
177 GraphicsContext context(&platformContext); | 175 GraphicsContext context(&platformContext); |
178 | 176 |
179 context.clearRect(contentRect); | |
180 | |
181 // Consider the thumb to be at the origin when painting. | 177 // Consider the thumb to be at the origin when painting. |
182 IntRect thumbRect = IntRect(IntPoint(), m_theme->thumbRect(m_scrollbar).
size()); | 178 IntRect thumbRect = IntRect(IntPoint(), m_theme->thumbRect(m_scrollbar).
size()); |
183 m_theme->paintThumb(&context, m_scrollbar, thumbRect); | 179 m_theme->paintThumb(&context, m_scrollbar, thumbRect); |
184 } | 180 } |
185 | 181 |
186 private: | 182 private: |
187 ScrollbarThumbPainter(ScrollbarThemeClient* scrollbar, ScrollbarThemeComposi
te* theme) | 183 ScrollbarThumbPainter(ScrollbarThemeClient* scrollbar, ScrollbarThemeComposi
te* theme) |
188 : m_scrollbar(scrollbar) | 184 : m_scrollbar(scrollbar) |
189 , m_theme(theme) | 185 , m_theme(theme) |
190 { | 186 { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 updatePart(m_backgroundUpdater.get(), m_background.get(), contentRect, updat
er); | 256 updatePart(m_backgroundUpdater.get(), m_background.get(), contentRect, updat
er); |
261 | 257 |
262 // Consider the thumb to be at the origin when painting. | 258 // Consider the thumb to be at the origin when painting. |
263 IntRect thumbRect = IntRect(IntPoint(), theme()->thumbRect(m_scrollbar.get()
).size()); | 259 IntRect thumbRect = IntRect(IntPoint(), theme()->thumbRect(m_scrollbar.get()
).size()); |
264 if (!thumbRect.isEmpty()) | 260 if (!thumbRect.isEmpty()) |
265 updatePart(m_thumbUpdater.get(), m_thumb.get(), thumbRect, updater); | 261 updatePart(m_thumbUpdater.get(), m_thumb.get(), thumbRect, updater); |
266 } | 262 } |
267 | 263 |
268 } | 264 } |
269 #endif // USE(ACCELERATED_COMPOSITING) | 265 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |