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_style = |
| 183 static_cast<ui::NativeTheme::ScrollbarOverlayStyle>( |
| 184 extra_params->scrollbarStyle); |
| 185 } else { |
| 186 native_theme_extra_params->scrollbar_style = ui::NativeTheme:: |
| 187 ScrollbarOverlayStyle::ScrollbarOverlayStyleDefault; |
| 188 } |
| 189 |
| 190 break; |
180 default: | 191 default: |
181 break; // Parts that have no extra params get here. | 192 break; // Parts that have no extra params get here. |
182 } | 193 } |
183 } | 194 } |
184 | 195 |
185 blink::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { | 196 blink::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { |
186 ui::NativeTheme::ExtraParams extra; | 197 ui::NativeTheme::ExtraParams extra; |
187 ui::NativeTheme::Part native_theme_part = NativeThemePart(part); | 198 ui::NativeTheme::Part native_theme_part = NativeThemePart(part); |
188 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
189 switch (native_theme_part) { | 200 switch (native_theme_part) { |
(...skipping 24 matching lines...) Expand all Loading... |
214 const blink::WebRect& rect, | 225 const blink::WebRect& rect, |
215 const WebThemeEngine::ExtraParams* extra_params) { | 226 const WebThemeEngine::ExtraParams* extra_params) { |
216 ui::NativeTheme::ExtraParams native_theme_extra_params; | 227 ui::NativeTheme::ExtraParams native_theme_extra_params; |
217 GetNativeThemeExtraParams( | 228 GetNativeThemeExtraParams( |
218 part, state, extra_params, &native_theme_extra_params); | 229 part, state, extra_params, &native_theme_extra_params); |
219 ui::NativeTheme::GetInstanceForWeb()->Paint( | 230 ui::NativeTheme::GetInstanceForWeb()->Paint( |
220 canvas, NativeThemePart(part), NativeThemeState(state), gfx::Rect(rect), | 231 canvas, NativeThemePart(part), NativeThemeState(state), gfx::Rect(rect), |
221 native_theme_extra_params); | 232 native_theme_extra_params); |
222 } | 233 } |
223 | 234 |
224 void WebThemeEngineImpl::paintStateTransition(blink::WebCanvas* canvas, | 235 void WebThemeEngineImpl::paintStateTransition( |
225 WebThemeEngine::Part part, | 236 blink::WebCanvas* canvas, |
226 WebThemeEngine::State startState, | 237 WebThemeEngine::Part part, |
227 WebThemeEngine::State endState, | 238 WebThemeEngine::State startState, |
228 double progress, | 239 WebThemeEngine::State endState, |
229 const blink::WebRect& rect) { | 240 double progress, |
| 241 const blink::WebRect& rect, |
| 242 ui::NativeTheme::ScrollbarOverlayStyle style) { |
230 ui::NativeTheme::GetInstanceForWeb()->PaintStateTransition( | 243 ui::NativeTheme::GetInstanceForWeb()->PaintStateTransition( |
231 canvas, NativeThemePart(part), NativeThemeState(startState), | 244 canvas, NativeThemePart(part), NativeThemeState(startState), |
232 NativeThemeState(endState), progress, gfx::Rect(rect)); | 245 NativeThemeState(endState), progress, gfx::Rect(rect), style); |
233 } | 246 } |
234 | 247 |
235 #if defined(OS_WIN) | 248 #if defined(OS_WIN) |
236 // static | 249 // static |
237 void WebThemeEngineImpl::cacheScrollBarMetrics( | 250 void WebThemeEngineImpl::cacheScrollBarMetrics( |
238 int32_t vertical_scroll_bar_width, | 251 int32_t vertical_scroll_bar_width, |
239 int32_t horizontal_scroll_bar_height, | 252 int32_t horizontal_scroll_bar_height, |
240 int32_t vertical_arrow_bitmap_height, | 253 int32_t vertical_arrow_bitmap_height, |
241 int32_t horizontal_arrow_bitmap_width) { | 254 int32_t horizontal_arrow_bitmap_width) { |
242 g_vertical_scroll_bar_width = vertical_scroll_bar_width; | 255 g_vertical_scroll_bar_width = vertical_scroll_bar_width; |
243 g_horizontal_scroll_bar_height = horizontal_scroll_bar_height; | 256 g_horizontal_scroll_bar_height = horizontal_scroll_bar_height; |
244 g_vertical_arrow_bitmap_height = vertical_arrow_bitmap_height; | 257 g_vertical_arrow_bitmap_height = vertical_arrow_bitmap_height; |
245 g_horizontal_arrow_bitmap_width = horizontal_arrow_bitmap_width; | 258 g_horizontal_arrow_bitmap_width = horizontal_arrow_bitmap_width; |
246 } | 259 } |
247 #endif | 260 #endif |
248 | 261 |
249 } // namespace content | 262 } // namespace content |
OLD | NEW |