OLD | NEW |
---|---|
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 "content/child/webthemeengine_impl_default.h" | 5 #include "content/child/webthemeengine_impl_default.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "skia/ext/platform_canvas.h" | 8 #include "skia/ext/platform_canvas.h" |
9 #include "third_party/WebKit/public/platform/WebRect.h" | 9 #include "third_party/WebKit/public/platform/WebRect.h" |
10 #include "third_party/WebKit/public/platform/WebSize.h" | 10 #include "third_party/WebKit/public/platform/WebSize.h" |
11 #include "ui/native_theme/native_theme.h" | |
12 | 11 |
13 using blink::WebCanvas; | 12 using blink::WebCanvas; |
14 using blink::WebColor; | 13 using blink::WebColor; |
15 using blink::WebRect; | 14 using blink::WebRect; |
16 using blink::WebThemeEngine; | 15 using blink::WebThemeEngine; |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 namespace { | 18 namespace { |
20 | 19 |
21 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 extra_params->progressBar.determinate; | 169 extra_params->progressBar.determinate; |
171 native_theme_extra_params->progress_bar.value_rect_x = | 170 native_theme_extra_params->progress_bar.value_rect_x = |
172 extra_params->progressBar.valueRectX; | 171 extra_params->progressBar.valueRectX; |
173 native_theme_extra_params->progress_bar.value_rect_y = | 172 native_theme_extra_params->progress_bar.value_rect_y = |
174 extra_params->progressBar.valueRectY; | 173 extra_params->progressBar.valueRectY; |
175 native_theme_extra_params->progress_bar.value_rect_width = | 174 native_theme_extra_params->progress_bar.value_rect_width = |
176 extra_params->progressBar.valueRectWidth; | 175 extra_params->progressBar.valueRectWidth; |
177 native_theme_extra_params->progress_bar.value_rect_height = | 176 native_theme_extra_params->progress_bar.value_rect_height = |
178 extra_params->progressBar.valueRectHeight; | 177 extra_params->progressBar.valueRectHeight; |
179 break; | 178 break; |
179 case WebThemeEngine::PartScrollbarHorizontalThumb: | |
180 case WebThemeEngine::PartScrollbarVerticalThumb: | |
181 if (extra_params) { | |
182 native_theme_extra_params->scrollbar_theme = | |
bokan
2016/10/21 16:57:14
These should be |native_theme_extra_params->scroll
| |
183 static_cast<ui::NativeTheme::ScrollbarOverlayColorTheme>( | |
184 extra_params->scrollbarTheme); | |
185 } else { | |
bokan
2016/10/21 16:57:14
The other cases here assume extra_params is always
| |
186 native_theme_extra_params->scrollbar_theme = ui::NativeTheme:: | |
187 ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeDefault; | |
188 } | |
189 break; | |
180 default: | 190 default: |
181 break; // Parts that have no extra params get here. | 191 break; // Parts that have no extra params get here. |
182 } | 192 } |
183 } | 193 } |
184 | 194 |
185 blink::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { | 195 blink::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { |
186 ui::NativeTheme::ExtraParams extra; | 196 ui::NativeTheme::ExtraParams extra; |
187 ui::NativeTheme::Part native_theme_part = NativeThemePart(part); | 197 ui::NativeTheme::Part native_theme_part = NativeThemePart(part); |
188 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
189 switch (native_theme_part) { | 199 switch (native_theme_part) { |
(...skipping 24 matching lines...) Expand all Loading... | |
214 const blink::WebRect& rect, | 224 const blink::WebRect& rect, |
215 const WebThemeEngine::ExtraParams* extra_params) { | 225 const WebThemeEngine::ExtraParams* extra_params) { |
216 ui::NativeTheme::ExtraParams native_theme_extra_params; | 226 ui::NativeTheme::ExtraParams native_theme_extra_params; |
217 GetNativeThemeExtraParams( | 227 GetNativeThemeExtraParams( |
218 part, state, extra_params, &native_theme_extra_params); | 228 part, state, extra_params, &native_theme_extra_params); |
219 ui::NativeTheme::GetInstanceForWeb()->Paint( | 229 ui::NativeTheme::GetInstanceForWeb()->Paint( |
220 canvas, NativeThemePart(part), NativeThemeState(state), gfx::Rect(rect), | 230 canvas, NativeThemePart(part), NativeThemeState(state), gfx::Rect(rect), |
221 native_theme_extra_params); | 231 native_theme_extra_params); |
222 } | 232 } |
223 | 233 |
224 void WebThemeEngineImpl::paintStateTransition(blink::WebCanvas* canvas, | 234 void WebThemeEngineImpl::paintStateTransition( |
225 WebThemeEngine::Part part, | 235 blink::WebCanvas* canvas, |
226 WebThemeEngine::State startState, | 236 WebThemeEngine::Part part, |
227 WebThemeEngine::State endState, | 237 WebThemeEngine::State startState, |
228 double progress, | 238 WebThemeEngine::State endState, |
229 const blink::WebRect& rect) { | 239 double progress, |
240 const blink::WebRect& rect, | |
241 ui::NativeTheme::ScrollbarOverlayColorTheme theme) { | |
230 ui::NativeTheme::GetInstanceForWeb()->PaintStateTransition( | 242 ui::NativeTheme::GetInstanceForWeb()->PaintStateTransition( |
231 canvas, NativeThemePart(part), NativeThemeState(startState), | 243 canvas, NativeThemePart(part), NativeThemeState(startState), |
232 NativeThemeState(endState), progress, gfx::Rect(rect)); | 244 NativeThemeState(endState), progress, gfx::Rect(rect), theme); |
233 } | 245 } |
234 | 246 |
235 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
236 // static | 248 // static |
237 void WebThemeEngineImpl::cacheScrollBarMetrics( | 249 void WebThemeEngineImpl::cacheScrollBarMetrics( |
238 int32_t vertical_scroll_bar_width, | 250 int32_t vertical_scroll_bar_width, |
239 int32_t horizontal_scroll_bar_height, | 251 int32_t horizontal_scroll_bar_height, |
240 int32_t vertical_arrow_bitmap_height, | 252 int32_t vertical_arrow_bitmap_height, |
241 int32_t horizontal_arrow_bitmap_width) { | 253 int32_t horizontal_arrow_bitmap_width) { |
242 g_vertical_scroll_bar_width = vertical_scroll_bar_width; | 254 g_vertical_scroll_bar_width = vertical_scroll_bar_width; |
243 g_horizontal_scroll_bar_height = horizontal_scroll_bar_height; | 255 g_horizontal_scroll_bar_height = horizontal_scroll_bar_height; |
244 g_vertical_arrow_bitmap_height = vertical_arrow_bitmap_height; | 256 g_vertical_arrow_bitmap_height = vertical_arrow_bitmap_height; |
245 g_horizontal_arrow_bitmap_width = horizontal_arrow_bitmap_width; | 257 g_horizontal_arrow_bitmap_width = horizontal_arrow_bitmap_width; |
246 } | 258 } |
247 #endif | 259 #endif |
248 | 260 |
249 } // namespace content | 261 } // namespace content |
OLD | NEW |