From 4c5813a2cdc5b998bfcbb5cf9ca4a4e982893706 Mon Sep 17 00:00:00 2001 From: "scottmg@chromium.org" <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Mon, 17 Jun 2013 20:50:22 +0000 Subject: move webkit/glue/webthemeengine to webkit/child/ R=jamesr@chromium.org, sky@chromium.org BUG=239107 Review URL: https://codereview.chromium.org/17284002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206793 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/child/DEPS | 2 + webkit/child/webfallbackthemeengine_impl.cc | 191 ++++ webkit/child/webfallbackthemeengine_impl.h | 39 + webkit/child/webkitplatformsupport_child_impl.cc | 11 + webkit/child/webkitplatformsupport_child_impl.h | 17 + webkit/child/webthemeengine_impl_android.cc | 186 ++++ webkit/child/webthemeengine_impl_android.h | 26 + webkit/child/webthemeengine_impl_default.cc | 185 ++++ webkit/child/webthemeengine_impl_default.h | 26 + webkit/child/webthemeengine_impl_mac.cc | 61 ++ webkit/child/webthemeengine_impl_mac.h | 25 + webkit/child/webthemeengine_impl_win.cc | 1014 ++++++++++++++++++++++ webkit/child/webthemeengine_impl_win.h | 49 ++ webkit/glue/webfallbackthemeengine_impl.cc | 191 ---- webkit/glue/webfallbackthemeengine_impl.h | 39 - webkit/glue/webkit_glue.gypi | 67 +- webkit/glue/webkitplatformsupport_impl.cc | 10 - webkit/glue/webkitplatformsupport_impl.h | 15 +- webkit/glue/webthemeengine_impl_android.cc | 186 ---- webkit/glue/webthemeengine_impl_android.h | 26 - webkit/glue/webthemeengine_impl_default.cc | 185 ---- webkit/glue/webthemeengine_impl_default.h | 26 - webkit/glue/webthemeengine_impl_mac.cc | 61 -- webkit/glue/webthemeengine_impl_mac.h | 25 - webkit/glue/webthemeengine_impl_win.cc | 1014 ---------------------- webkit/glue/webthemeengine_impl_win.h | 49 -- 26 files changed, 1859 insertions(+), 1867 deletions(-) create mode 100644 webkit/child/webfallbackthemeengine_impl.cc create mode 100644 webkit/child/webfallbackthemeengine_impl.h create mode 100644 webkit/child/webthemeengine_impl_android.cc create mode 100644 webkit/child/webthemeengine_impl_android.h create mode 100644 webkit/child/webthemeengine_impl_default.cc create mode 100644 webkit/child/webthemeengine_impl_default.h create mode 100644 webkit/child/webthemeengine_impl_mac.cc create mode 100644 webkit/child/webthemeengine_impl_mac.h create mode 100644 webkit/child/webthemeengine_impl_win.cc create mode 100644 webkit/child/webthemeengine_impl_win.h delete mode 100644 webkit/glue/webfallbackthemeengine_impl.cc delete mode 100644 webkit/glue/webfallbackthemeengine_impl.h delete mode 100644 webkit/glue/webthemeengine_impl_android.cc delete mode 100644 webkit/glue/webthemeengine_impl_android.h delete mode 100644 webkit/glue/webthemeengine_impl_default.cc delete mode 100644 webkit/glue/webthemeengine_impl_default.h delete mode 100644 webkit/glue/webthemeengine_impl_mac.cc delete mode 100644 webkit/glue/webthemeengine_impl_mac.h delete mode 100644 webkit/glue/webthemeengine_impl_win.cc delete mode 100644 webkit/glue/webthemeengine_impl_win.h diff --git a/webkit/child/DEPS b/webkit/child/DEPS index b15a790..552b168 100644 --- a/webkit/child/DEPS +++ b/webkit/child/DEPS @@ -1,3 +1,5 @@ include_rules = [ "+jni", # Needed for Android's java-generated bindings. + "+ui/base", + "+ui/native_theme", ] diff --git a/webkit/child/webfallbackthemeengine_impl.cc b/webkit/child/webfallbackthemeengine_impl.cc new file mode 100644 index 0000000..e381ec3 --- /dev/null +++ b/webkit/child/webfallbackthemeengine_impl.cc @@ -0,0 +1,191 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/child/webfallbackthemeengine_impl.h" + +#include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebSize.h" +#include "ui/native_theme/fallback_theme.h" + +using WebKit::WebCanvas; +using WebKit::WebColor; +using WebKit::WebRect; +using WebKit::WebFallbackThemeEngine; + +namespace webkit_glue { + +static ui::NativeTheme::Part NativeThemePart( + WebFallbackThemeEngine::Part part) { + switch (part) { + case WebFallbackThemeEngine::PartScrollbarDownArrow: + return ui::NativeTheme::kScrollbarDownArrow; + case WebFallbackThemeEngine::PartScrollbarLeftArrow: + return ui::NativeTheme::kScrollbarLeftArrow; + case WebFallbackThemeEngine::PartScrollbarRightArrow: + return ui::NativeTheme::kScrollbarRightArrow; + case WebFallbackThemeEngine::PartScrollbarUpArrow: + return ui::NativeTheme::kScrollbarUpArrow; + case WebFallbackThemeEngine::PartScrollbarHorizontalThumb: + return ui::NativeTheme::kScrollbarHorizontalThumb; + case WebFallbackThemeEngine::PartScrollbarVerticalThumb: + return ui::NativeTheme::kScrollbarVerticalThumb; + case WebFallbackThemeEngine::PartScrollbarHorizontalTrack: + return ui::NativeTheme::kScrollbarHorizontalTrack; + case WebFallbackThemeEngine::PartScrollbarVerticalTrack: + return ui::NativeTheme::kScrollbarVerticalTrack; + case WebFallbackThemeEngine::PartCheckbox: + return ui::NativeTheme::kCheckbox; + case WebFallbackThemeEngine::PartRadio: + return ui::NativeTheme::kRadio; + case WebFallbackThemeEngine::PartButton: + return ui::NativeTheme::kPushButton; + case WebFallbackThemeEngine::PartTextField: + return ui::NativeTheme::kTextField; + case WebFallbackThemeEngine::PartMenuList: + return ui::NativeTheme::kMenuList; + case WebFallbackThemeEngine::PartSliderTrack: + return ui::NativeTheme::kSliderTrack; + case WebFallbackThemeEngine::PartSliderThumb: + return ui::NativeTheme::kSliderThumb; + case WebFallbackThemeEngine::PartInnerSpinButton: + return ui::NativeTheme::kInnerSpinButton; + case WebFallbackThemeEngine::PartProgressBar: + return ui::NativeTheme::kProgressBar; + default: + return ui::NativeTheme::kScrollbarDownArrow; + } +} + +static ui::NativeTheme::State NativeThemeState( + WebFallbackThemeEngine::State state) { + switch (state) { + case WebFallbackThemeEngine::StateDisabled: + return ui::NativeTheme::kDisabled; + case WebFallbackThemeEngine::StateHover: + return ui::NativeTheme::kHovered; + case WebFallbackThemeEngine::StateNormal: + return ui::NativeTheme::kNormal; + case WebFallbackThemeEngine::StatePressed: + return ui::NativeTheme::kPressed; + default: + return ui::NativeTheme::kDisabled; + } +} + +static void GetNativeThemeExtraParams( + WebFallbackThemeEngine::Part part, + WebFallbackThemeEngine::State state, + const WebFallbackThemeEngine::ExtraParams* extra_params, + ui::NativeTheme::ExtraParams* native_theme_extra_params) { + switch (part) { + case WebFallbackThemeEngine::PartScrollbarHorizontalTrack: + case WebFallbackThemeEngine::PartScrollbarVerticalTrack: + native_theme_extra_params->scrollbar_track.track_x = + extra_params->scrollbarTrack.trackX; + native_theme_extra_params->scrollbar_track.track_y = + extra_params->scrollbarTrack.trackY; + native_theme_extra_params->scrollbar_track.track_width = + extra_params->scrollbarTrack.trackWidth; + native_theme_extra_params->scrollbar_track.track_height = + extra_params->scrollbarTrack.trackHeight; + break; + case WebFallbackThemeEngine::PartCheckbox: + native_theme_extra_params->button.checked = extra_params->button.checked; + native_theme_extra_params->button.indeterminate = + extra_params->button.indeterminate; + break; + case WebFallbackThemeEngine::PartRadio: + native_theme_extra_params->button.checked = extra_params->button.checked; + break; + case WebFallbackThemeEngine::PartButton: + native_theme_extra_params->button.is_default = + extra_params->button.isDefault; + native_theme_extra_params->button.has_border = + extra_params->button.hasBorder; + // Native buttons have a different focus style. + native_theme_extra_params->button.is_focused = false; + native_theme_extra_params->button.background_color = + extra_params->button.backgroundColor; + break; + case WebFallbackThemeEngine::PartTextField: + native_theme_extra_params->text_field.is_text_area = + extra_params->textField.isTextArea; + native_theme_extra_params->text_field.is_listbox = + extra_params->textField.isListbox; + native_theme_extra_params->text_field.background_color = + extra_params->textField.backgroundColor; + break; + case WebFallbackThemeEngine::PartMenuList: + native_theme_extra_params->menu_list.has_border = + extra_params->menuList.hasBorder; + native_theme_extra_params->menu_list.has_border_radius = + extra_params->menuList.hasBorderRadius; + native_theme_extra_params->menu_list.arrow_x = + extra_params->menuList.arrowX; + native_theme_extra_params->menu_list.arrow_y = + extra_params->menuList.arrowY; + native_theme_extra_params->menu_list.background_color = + extra_params->menuList.backgroundColor; + break; + case WebFallbackThemeEngine::PartSliderTrack: + case WebFallbackThemeEngine::PartSliderThumb: + native_theme_extra_params->slider.vertical = + extra_params->slider.vertical; + native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; + break; + case WebFallbackThemeEngine::PartInnerSpinButton: + native_theme_extra_params->inner_spin.spin_up = + extra_params->innerSpin.spinUp; + native_theme_extra_params->inner_spin.read_only = + extra_params->innerSpin.readOnly; + break; + case WebFallbackThemeEngine::PartProgressBar: + native_theme_extra_params->progress_bar.determinate = + extra_params->progressBar.determinate; + native_theme_extra_params->progress_bar.value_rect_x = + extra_params->progressBar.valueRectX; + native_theme_extra_params->progress_bar.value_rect_y = + extra_params->progressBar.valueRectY; + native_theme_extra_params->progress_bar.value_rect_width = + extra_params->progressBar.valueRectWidth; + native_theme_extra_params->progress_bar.value_rect_height = + extra_params->progressBar.valueRectHeight; + break; + default: + break; // Parts that have no extra params get here. + } +} + +WebFallbackThemeEngineImpl::WebFallbackThemeEngineImpl() + : theme_(new ui::FallbackTheme()) { +} + +WebFallbackThemeEngineImpl::~WebFallbackThemeEngineImpl() {} + +WebKit::WebSize WebFallbackThemeEngineImpl::getSize( + WebFallbackThemeEngine::Part part) { + ui::NativeTheme::ExtraParams extra; + return theme_->GetPartSize(NativeThemePart(part), + ui::NativeTheme::kNormal, + extra); +} + +void WebFallbackThemeEngineImpl::paint( + WebKit::WebCanvas* canvas, + WebFallbackThemeEngine::Part part, + WebFallbackThemeEngine::State state, + const WebKit::WebRect& rect, + const WebFallbackThemeEngine::ExtraParams* extra_params) { + ui::NativeTheme::ExtraParams native_theme_extra_params; + GetNativeThemeExtraParams( + part, state, extra_params, &native_theme_extra_params); + theme_->Paint(canvas, + NativeThemePart(part), + NativeThemeState(state), + gfx::Rect(rect), + native_theme_extra_params); +} + +} // namespace webkit_glue diff --git a/webkit/child/webfallbackthemeengine_impl.h b/webkit/child/webfallbackthemeengine_impl.h new file mode 100644 index 0000000..947d43d --- /dev/null +++ b/webkit/child/webfallbackthemeengine_impl.h @@ -0,0 +1,39 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_CHILD_WEBFALLBACKTHEMEENGINE_IMPL_H_ +#define WEBKIT_CHILD_WEBFALLBACKTHEMEENGINE_IMPL_H_ + +#include "base/memory/scoped_ptr.h" +#include "third_party/WebKit/public/platform/WebFallbackThemeEngine.h" + +namespace ui { +class FallbackTheme; +} + +namespace webkit_glue { + +class WebFallbackThemeEngineImpl : public WebKit::WebFallbackThemeEngine { + public: + WebFallbackThemeEngineImpl(); + virtual ~WebFallbackThemeEngineImpl(); + + // WebFallbackThemeEngine methods: + virtual WebKit::WebSize getSize(WebKit::WebFallbackThemeEngine::Part); + virtual void paint( + WebKit::WebCanvas* canvas, + WebKit::WebFallbackThemeEngine::Part part, + WebKit::WebFallbackThemeEngine::State state, + const WebKit::WebRect& rect, + const WebKit::WebFallbackThemeEngine::ExtraParams* extra_params); + + private: + scoped_ptr<ui::FallbackTheme> theme_; + + DISALLOW_COPY_AND_ASSIGN(WebFallbackThemeEngineImpl); +}; + +} // namespace webkit_glue + +#endif // WEBKIT_CHILD_WEBFALLBACKTHEMEENGINE_IMPL_H_ diff --git a/webkit/child/webkitplatformsupport_child_impl.cc b/webkit/child/webkitplatformsupport_child_impl.cc index 9eb20c1..02ee5aa 100644 --- a/webkit/child/webkitplatformsupport_child_impl.cc +++ b/webkit/child/webkitplatformsupport_child_impl.cc @@ -13,6 +13,9 @@ #include "webkit/child/fling_animator_impl_android.h" #endif +using WebKit::WebFallbackThemeEngine; +using WebKit::WebThemeEngine; + namespace webkit_glue { WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() @@ -21,6 +24,14 @@ WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {} +WebThemeEngine* WebKitPlatformSupportChildImpl::themeEngine() { + return &native_theme_engine_; +} + +WebFallbackThemeEngine* WebKitPlatformSupportChildImpl::fallbackThemeEngine() { + return &fallback_theme_engine_; +} + void WebKitPlatformSupportChildImpl::SetFlingCurveParameters( const std::vector<float>& new_touchpad, const std::vector<float>& new_touchscreen) { diff --git a/webkit/child/webkitplatformsupport_child_impl.h b/webkit/child/webkitplatformsupport_child_impl.h index 1b18ebd..21812b2 100644 --- a/webkit/child/webkitplatformsupport_child_impl.h +++ b/webkit/child/webkitplatformsupport_child_impl.h @@ -6,9 +6,20 @@ #define WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_ #include "base/threading/thread_local_storage.h" +#include "webkit/child/webfallbackthemeengine_impl.h" #include "webkit/child/webkit_child_export.h" #include "webkit/glue/webkitplatformsupport_impl.h" +#if defined(USE_DEFAULT_RENDER_THEME) +#include "webkit/child/webthemeengine_impl_default.h" +#elif defined(OS_WIN) +#include "webkit/child/webthemeengine_impl_win.h" +#elif defined(OS_MACOSX) +#include "webkit/child/webthemeengine_impl_mac.h" +#elif defined(OS_ANDROID) +#include "webkit/child/webthemeengine_impl_android.h" +#endif + namespace webkit_glue { class FlingCurveConfiguration; @@ -19,6 +30,10 @@ class WEBKIT_CHILD_EXPORT WebKitPlatformSupportChildImpl : WebKitPlatformSupportChildImpl(); virtual ~WebKitPlatformSupportChildImpl(); + // Platform methods (partial implementation): + virtual WebKit::WebThemeEngine* themeEngine(); + virtual WebKit::WebFallbackThemeEngine* fallbackThemeEngine(); + void SetFlingCurveParameters( const std::vector<float>& new_touchpad, const std::vector<float>& new_touchscreen); @@ -39,6 +54,8 @@ class WEBKIT_CHILD_EXPORT WebKitPlatformSupportChildImpl : private: static void DestroyCurrentThread(void*); + WebThemeEngineImpl native_theme_engine_; + WebFallbackThemeEngineImpl fallback_theme_engine_; base::ThreadLocalStorage::Slot current_thread_slot_; scoped_ptr<FlingCurveConfiguration> fling_curve_configuration_; }; diff --git a/webkit/child/webthemeengine_impl_android.cc b/webkit/child/webthemeengine_impl_android.cc new file mode 100644 index 0000000..da139e5 --- /dev/null +++ b/webkit/child/webthemeengine_impl_android.cc @@ -0,0 +1,186 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/child/webthemeengine_impl_android.h" + +#include "base/logging.h" +#include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebSize.h" +#include "ui/native_theme/native_theme.h" + +using WebKit::WebCanvas; +using WebKit::WebColor; +using WebKit::WebRect; +using WebKit::WebThemeEngine; + +namespace webkit_glue { + +static ui::NativeTheme::Part NativeThemePart( + WebThemeEngine::Part part) { + switch (part) { + case WebThemeEngine::PartScrollbarDownArrow: + return ui::NativeTheme::kScrollbarDownArrow; + case WebThemeEngine::PartScrollbarLeftArrow: + return ui::NativeTheme::kScrollbarLeftArrow; + case WebThemeEngine::PartScrollbarRightArrow: + return ui::NativeTheme::kScrollbarRightArrow; + case WebThemeEngine::PartScrollbarUpArrow: + return ui::NativeTheme::kScrollbarUpArrow; + case WebThemeEngine::PartScrollbarHorizontalThumb: + // Android doesn't draw scrollbars. + NOTREACHED(); + return static_cast<ui::NativeTheme::Part>(0); + case WebThemeEngine::PartScrollbarVerticalThumb: + // Android doesn't draw scrollbars. + NOTREACHED(); + return static_cast<ui::NativeTheme::Part>(0); + case WebThemeEngine::PartScrollbarHorizontalTrack: + // Android doesn't draw scrollbars. + NOTREACHED(); + return static_cast<ui::NativeTheme::Part>(0); + case WebThemeEngine::PartScrollbarVerticalTrack: + // Android doesn't draw scrollbars. + NOTREACHED(); + return static_cast<ui::NativeTheme::Part>(0); + case WebThemeEngine::PartCheckbox: + return ui::NativeTheme::kCheckbox; + case WebThemeEngine::PartRadio: + return ui::NativeTheme::kRadio; + case WebThemeEngine::PartButton: + return ui::NativeTheme::kPushButton; + case WebThemeEngine::PartTextField: + return ui::NativeTheme::kTextField; + case WebThemeEngine::PartMenuList: + return ui::NativeTheme::kMenuList; + case WebThemeEngine::PartSliderTrack: + return ui::NativeTheme::kSliderTrack; + case WebThemeEngine::PartSliderThumb: + return ui::NativeTheme::kSliderThumb; + case WebThemeEngine::PartInnerSpinButton: + return ui::NativeTheme::kInnerSpinButton; + case WebThemeEngine::PartProgressBar: + return ui::NativeTheme::kProgressBar; + default: + return ui::NativeTheme::kScrollbarDownArrow; + } +} + +static ui::NativeTheme::State NativeThemeState( + WebThemeEngine::State state) { + switch (state) { + case WebThemeEngine::StateDisabled: + return ui::NativeTheme::kDisabled; + case WebThemeEngine::StateHover: + return ui::NativeTheme::kHovered; + case WebThemeEngine::StateNormal: + return ui::NativeTheme::kNormal; + case WebThemeEngine::StatePressed: + return ui::NativeTheme::kPressed; + default: + return ui::NativeTheme::kDisabled; + } +} + +static void GetNativeThemeExtraParams( + WebThemeEngine::Part part, + WebThemeEngine::State state, + const WebThemeEngine::ExtraParams* extra_params, + ui::NativeTheme::ExtraParams* native_theme_extra_params) { + switch (part) { + case WebThemeEngine::PartScrollbarHorizontalTrack: + case WebThemeEngine::PartScrollbarVerticalTrack: + // Android doesn't draw scrollbars. + NOTREACHED(); + break; + case WebThemeEngine::PartCheckbox: + native_theme_extra_params->button.checked = extra_params->button.checked; + native_theme_extra_params->button.indeterminate = + extra_params->button.indeterminate; + break; + case WebThemeEngine::PartRadio: + native_theme_extra_params->button.checked = extra_params->button.checked; + break; + case WebThemeEngine::PartButton: + native_theme_extra_params->button.is_default = + extra_params->button.isDefault; + native_theme_extra_params->button.has_border = + extra_params->button.hasBorder; + // Native buttons have a different focus style. + native_theme_extra_params->button.is_focused = false; + native_theme_extra_params->button.background_color = + extra_params->button.backgroundColor; + break; + case WebThemeEngine::PartTextField: + native_theme_extra_params->text_field.is_text_area = + extra_params->textField.isTextArea; + native_theme_extra_params->text_field.is_listbox = + extra_params->textField.isListbox; + native_theme_extra_params->text_field.background_color = + extra_params->textField.backgroundColor; + break; + case WebThemeEngine::PartMenuList: + native_theme_extra_params->menu_list.has_border = + extra_params->menuList.hasBorder; + native_theme_extra_params->menu_list.has_border_radius = + extra_params->menuList.hasBorderRadius; + native_theme_extra_params->menu_list.arrow_x = + extra_params->menuList.arrowX; + native_theme_extra_params->menu_list.arrow_y = + extra_params->menuList.arrowY; + native_theme_extra_params->menu_list.background_color = + extra_params->menuList.backgroundColor; + break; + case WebThemeEngine::PartSliderTrack: + case WebThemeEngine::PartSliderThumb: + native_theme_extra_params->slider.vertical = + extra_params->slider.vertical; + native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; + break; + case WebThemeEngine::PartInnerSpinButton: + native_theme_extra_params->inner_spin.spin_up = + extra_params->innerSpin.spinUp; + native_theme_extra_params->inner_spin.read_only = + extra_params->innerSpin.readOnly; + break; + case WebThemeEngine::PartProgressBar: + native_theme_extra_params->progress_bar.determinate = + extra_params->progressBar.determinate; + native_theme_extra_params->progress_bar.value_rect_x = + extra_params->progressBar.valueRectX; + native_theme_extra_params->progress_bar.value_rect_y = + extra_params->progressBar.valueRectY; + native_theme_extra_params->progress_bar.value_rect_width = + extra_params->progressBar.valueRectWidth; + native_theme_extra_params->progress_bar.value_rect_height = + extra_params->progressBar.valueRectHeight; + break; + default: + break; // Parts that have no extra params get here. + } +} + +WebKit::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { + ui::NativeTheme::ExtraParams extra; + return ui::NativeTheme::instance()->GetPartSize( + NativeThemePart(part), ui::NativeTheme::kNormal, extra); +} + +void WebThemeEngineImpl::paint( + WebKit::WebCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const WebKit::WebRect& rect, + const WebThemeEngine::ExtraParams* extra_params) { + ui::NativeTheme::ExtraParams native_theme_extra_params; + GetNativeThemeExtraParams( + part, state, extra_params, &native_theme_extra_params); + ui::NativeTheme::instance()->Paint( + canvas, + NativeThemePart(part), + NativeThemeState(state), + gfx::Rect(rect), + native_theme_extra_params); +} +} // namespace webkit_glue diff --git a/webkit/child/webthemeengine_impl_android.h b/webkit/child/webthemeengine_impl_android.h new file mode 100644 index 0000000..f475611 --- /dev/null +++ b/webkit/child/webthemeengine_impl_android.h @@ -0,0 +1,26 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ +#define WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ + +#include "third_party/WebKit/public/platform/android/WebThemeEngine.h" + +namespace webkit_glue { + +class WebThemeEngineImpl : public WebKit::WebThemeEngine { + public: + // WebThemeEngine methods: + virtual WebKit::WebSize getSize(WebKit::WebThemeEngine::Part); + virtual void paint( + WebKit::WebCanvas* canvas, + WebKit::WebThemeEngine::Part part, + WebKit::WebThemeEngine::State state, + const WebKit::WebRect& rect, + const WebKit::WebThemeEngine::ExtraParams* extra_params); +}; + +} // namespace webkit_glue + +#endif // WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ diff --git a/webkit/child/webthemeengine_impl_default.cc b/webkit/child/webthemeengine_impl_default.cc new file mode 100644 index 0000000..fc64094 --- /dev/null +++ b/webkit/child/webthemeengine_impl_default.cc @@ -0,0 +1,185 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/child/webthemeengine_impl_default.h" + +#include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebSize.h" +#include "ui/native_theme/native_theme.h" + +using WebKit::WebCanvas; +using WebKit::WebColor; +using WebKit::WebRect; +using WebKit::WebThemeEngine; + +namespace webkit_glue { + +static ui::NativeTheme::Part NativeThemePart( + WebThemeEngine::Part part) { + switch (part) { + case WebThemeEngine::PartScrollbarDownArrow: + return ui::NativeTheme::kScrollbarDownArrow; + case WebThemeEngine::PartScrollbarLeftArrow: + return ui::NativeTheme::kScrollbarLeftArrow; + case WebThemeEngine::PartScrollbarRightArrow: + return ui::NativeTheme::kScrollbarRightArrow; + case WebThemeEngine::PartScrollbarUpArrow: + return ui::NativeTheme::kScrollbarUpArrow; + case WebThemeEngine::PartScrollbarHorizontalThumb: + return ui::NativeTheme::kScrollbarHorizontalThumb; + case WebThemeEngine::PartScrollbarVerticalThumb: + return ui::NativeTheme::kScrollbarVerticalThumb; + case WebThemeEngine::PartScrollbarHorizontalTrack: + return ui::NativeTheme::kScrollbarHorizontalTrack; + case WebThemeEngine::PartScrollbarVerticalTrack: + return ui::NativeTheme::kScrollbarVerticalTrack; + case WebThemeEngine::PartCheckbox: + return ui::NativeTheme::kCheckbox; + case WebThemeEngine::PartRadio: + return ui::NativeTheme::kRadio; + case WebThemeEngine::PartButton: + return ui::NativeTheme::kPushButton; + case WebThemeEngine::PartTextField: + return ui::NativeTheme::kTextField; + case WebThemeEngine::PartMenuList: + return ui::NativeTheme::kMenuList; + case WebThemeEngine::PartSliderTrack: + return ui::NativeTheme::kSliderTrack; + case WebThemeEngine::PartSliderThumb: + return ui::NativeTheme::kSliderThumb; + case WebThemeEngine::PartInnerSpinButton: + return ui::NativeTheme::kInnerSpinButton; + case WebThemeEngine::PartProgressBar: + return ui::NativeTheme::kProgressBar; + default: + return ui::NativeTheme::kScrollbarDownArrow; + } +} + +static ui::NativeTheme::State NativeThemeState( + WebThemeEngine::State state) { + switch (state) { + case WebThemeEngine::StateDisabled: + return ui::NativeTheme::kDisabled; + case WebThemeEngine::StateHover: + return ui::NativeTheme::kHovered; + case WebThemeEngine::StateNormal: + return ui::NativeTheme::kNormal; + case WebThemeEngine::StatePressed: + return ui::NativeTheme::kPressed; + default: + return ui::NativeTheme::kDisabled; + } +} + +static void GetNativeThemeExtraParams( + WebThemeEngine::Part part, + WebThemeEngine::State state, + const WebThemeEngine::ExtraParams* extra_params, + ui::NativeTheme::ExtraParams* native_theme_extra_params) { + switch (part) { + case WebThemeEngine::PartScrollbarHorizontalTrack: + case WebThemeEngine::PartScrollbarVerticalTrack: + native_theme_extra_params->scrollbar_track.track_x = + extra_params->scrollbarTrack.trackX; + native_theme_extra_params->scrollbar_track.track_y = + extra_params->scrollbarTrack.trackY; + native_theme_extra_params->scrollbar_track.track_width = + extra_params->scrollbarTrack.trackWidth; + native_theme_extra_params->scrollbar_track.track_height = + extra_params->scrollbarTrack.trackHeight; + break; + case WebThemeEngine::PartCheckbox: + native_theme_extra_params->button.checked = extra_params->button.checked; + native_theme_extra_params->button.indeterminate = + extra_params->button.indeterminate; + break; + case WebThemeEngine::PartRadio: + native_theme_extra_params->button.checked = extra_params->button.checked; + break; + case WebThemeEngine::PartButton: + native_theme_extra_params->button.is_default = + extra_params->button.isDefault; + native_theme_extra_params->button.has_border = + extra_params->button.hasBorder; + // Native buttons have a different focus style. + native_theme_extra_params->button.is_focused = false; + native_theme_extra_params->button.background_color = + extra_params->button.backgroundColor; + break; + case WebThemeEngine::PartTextField: + native_theme_extra_params->text_field.is_text_area = + extra_params->textField.isTextArea; + native_theme_extra_params->text_field.is_listbox = + extra_params->textField.isListbox; + native_theme_extra_params->text_field.background_color = + extra_params->textField.backgroundColor; + break; + case WebThemeEngine::PartMenuList: + native_theme_extra_params->menu_list.has_border = + extra_params->menuList.hasBorder; + native_theme_extra_params->menu_list.has_border_radius = + extra_params->menuList.hasBorderRadius; + native_theme_extra_params->menu_list.arrow_x = + extra_params->menuList.arrowX; + native_theme_extra_params->menu_list.arrow_y = + extra_params->menuList.arrowY; + native_theme_extra_params->menu_list.background_color = + extra_params->menuList.backgroundColor; + break; + case WebThemeEngine::PartSliderTrack: + case WebThemeEngine::PartSliderThumb: + native_theme_extra_params->slider.vertical = + extra_params->slider.vertical; + native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; + break; + case WebThemeEngine::PartInnerSpinButton: + native_theme_extra_params->inner_spin.spin_up = + extra_params->innerSpin.spinUp; + native_theme_extra_params->inner_spin.read_only = + extra_params->innerSpin.readOnly; + break; + case WebThemeEngine::PartProgressBar: + native_theme_extra_params->progress_bar.determinate = + extra_params->progressBar.determinate; + native_theme_extra_params->progress_bar.value_rect_x = + extra_params->progressBar.valueRectX; + native_theme_extra_params->progress_bar.value_rect_y = + extra_params->progressBar.valueRectY; + native_theme_extra_params->progress_bar.value_rect_width = + extra_params->progressBar.valueRectWidth; + native_theme_extra_params->progress_bar.value_rect_height = + extra_params->progressBar.valueRectHeight; + break; + default: + break; // Parts that have no extra params get here. + } +} + +WebKit::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { + ui::NativeTheme::ExtraParams extra; + return ui::NativeTheme::instance()->GetPartSize(NativeThemePart(part), + ui::NativeTheme::kNormal, + extra); +} + +void WebThemeEngineImpl::paint( + WebKit::WebCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const WebKit::WebRect& rect, + const WebThemeEngine::ExtraParams* extra_params) { + ui::NativeTheme::ExtraParams native_theme_extra_params; + GetNativeThemeExtraParams( + part, state, extra_params, &native_theme_extra_params); + ui::NativeTheme::instance()->Paint( + canvas, + NativeThemePart(part), + NativeThemeState(state), + gfx::Rect(rect), + native_theme_extra_params); +} + +} // namespace webkit_glue diff --git a/webkit/child/webthemeengine_impl_default.h b/webkit/child/webthemeengine_impl_default.h new file mode 100644 index 0000000..2afaa7b --- /dev/null +++ b/webkit/child/webthemeengine_impl_default.h @@ -0,0 +1,26 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_DEFAULT_H_ +#define WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_DEFAULT_H_ + +#include "third_party/WebKit/public/platform/default/WebThemeEngine.h" + +namespace webkit_glue { + +class WebThemeEngineImpl : public WebKit::WebThemeEngine { + public: + // WebThemeEngine methods: + virtual WebKit::WebSize getSize(WebKit::WebThemeEngine::Part); + virtual void paint( + WebKit::WebCanvas* canvas, + WebKit::WebThemeEngine::Part part, + WebKit::WebThemeEngine::State state, + const WebKit::WebRect& rect, + const WebKit::WebThemeEngine::ExtraParams* extra_params); +}; + +} // namespace webkit_glue + +#endif // WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_DEFAULT_H_ diff --git a/webkit/child/webthemeengine_impl_mac.cc b/webkit/child/webthemeengine_impl_mac.cc new file mode 100644 index 0000000..9852502 --- /dev/null +++ b/webkit/child/webthemeengine_impl_mac.cc @@ -0,0 +1,61 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/child/webthemeengine_impl_mac.h" + +#include <Carbon/Carbon.h> + +#include "skia/ext/skia_utils_mac.h" +#include "third_party/WebKit/public/platform/WebCanvas.h" +#include "third_party/WebKit/public/platform/WebRect.h" + +using WebKit::WebCanvas; +using WebKit::WebRect; +using WebKit::WebThemeEngine; + +namespace webkit_glue { + +static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) { + switch (state) { + case WebThemeEngine::StateDisabled: + return kThemeTrackDisabled; + case WebThemeEngine::StateInactive: + return kThemeTrackInactive; + default: + return kThemeTrackActive; + } +} + +void WebThemeEngineImpl::paintScrollbarThumb( + WebCanvas* canvas, + WebThemeEngine::State state, + WebThemeEngine::Size size, + const WebRect& rect, + const WebThemeEngine::ScrollbarInfo& scrollbarInfo) { + HIThemeTrackDrawInfo trackInfo; + trackInfo.version = 0; + trackInfo.kind = size == WebThemeEngine::SizeRegular ? + kThemeMediumScrollBar : kThemeSmallScrollBar; + trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height); + trackInfo.min = 0; + trackInfo.max = scrollbarInfo.maxValue; + trackInfo.value = scrollbarInfo.currentValue; + trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize; + trackInfo.attributes = 0; + if (scrollbarInfo.orientation == + WebThemeEngine::ScrollbarOrientationHorizontal) { + trackInfo.attributes |= kThemeTrackHorizontal; + } + + trackInfo.enableState = stateToHIEnableState(state); + + trackInfo.trackInfo.scrollbar.pressState = + state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; + trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); + gfx::SkiaBitLocker bitLocker(canvas); + CGContextRef cgContext = bitLocker.cgContext(); + HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); +} + +} // namespace webkit_glue diff --git a/webkit/child/webthemeengine_impl_mac.h b/webkit/child/webthemeengine_impl_mac.h new file mode 100644 index 0000000..77c6598 --- /dev/null +++ b/webkit/child/webthemeengine_impl_mac.h @@ -0,0 +1,25 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ +#define WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ + +#include "third_party/WebKit/public/platform/mac/WebThemeEngine.h" + +namespace webkit_glue { + +class WebThemeEngineImpl : public WebKit::WebThemeEngine { + public: + // WebKit::WebThemeEngine implementation. + virtual void paintScrollbarThumb( + WebKit::WebCanvas* canvas, + WebKit::WebThemeEngine::State part, + WebKit::WebThemeEngine::Size state, + const WebKit::WebRect& rect, + const WebKit::WebThemeEngine::ScrollbarInfo& extra_params); +}; + +} // namespace webkit_glue + +#endif // WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ diff --git a/webkit/child/webthemeengine_impl_win.cc b/webkit/child/webthemeengine_impl_win.cc new file mode 100644 index 0000000..e4d05b3 --- /dev/null +++ b/webkit/child/webthemeengine_impl_win.cc @@ -0,0 +1,1014 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/child/webthemeengine_impl_win.h" + +#include <vsstyle.h> // To convert to ui::NativeTheme::State + +#include "base/logging.h" +#include "skia/ext/platform_canvas.h" +#include "skia/ext/skia_utils_win.h" +#include "third_party/WebKit/public/platform/WebRect.h" +#include "ui/base/win/dpi.h" +#include "ui/native_theme/native_theme.h" + +using WebKit::WebCanvas; +using WebKit::WebColor; +using WebKit::WebRect; +using WebKit::WebSize; + +namespace webkit_glue { + +static RECT WebRectToRECT(const WebRect& rect) { + RECT result; + result.left = rect.x; + result.top = rect.y; + result.right = rect.x + rect.width; + result.bottom = rect.y + rect.height; + return result; +} + +static ui::NativeTheme::State WebButtonStateToGfx( + int part, int state, ui::NativeTheme::ButtonExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + // Native buttons have a different focus style. + extra->is_focused = false; + extra->has_border = false; + extra->background_color = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_ButtonBackgroundColor); + + if (part == BP_PUSHBUTTON) { + switch (state) { + case PBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case PBS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case PBS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case PBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case PBS_DEFAULTED: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = true; + break; + case PBS_DEFAULTED_ANIMATING: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = true; + break; + default: + NOTREACHED() << "Invalid state: " << state; + } + } else if (part == BP_RADIOBUTTON) { + switch (state) { + case RBS_UNCHECKEDNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_UNCHECKEDHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_UNCHECKEDPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_UNCHECKEDDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_CHECKEDNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_CHECKEDHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_CHECKEDPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case RBS_CHECKEDDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + } else if (part == BP_CHECKBOX) { + switch (state) { + case CBS_UNCHECKEDNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_UNCHECKEDHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_UNCHECKEDPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_UNCHECKEDDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_CHECKEDNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_CHECKEDHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_CHECKEDPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_CHECKEDDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = true; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_MIXEDNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = true; + extra->is_default = false; + break; + case CBS_MIXEDHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = true; + extra->is_default = false; + break; + case CBS_MIXEDPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = true; + extra->is_default = false; + break; + case CBS_MIXEDDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = true; + extra->is_default = false; + break; + case CBS_IMPLICITNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_IMPLICITHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_IMPLICITPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_IMPLICITDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_EXCLUDEDNORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_EXCLUDEDHOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_EXCLUDEDPRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CBS_EXCLUDEDDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + } else if (part == BP_GROUPBOX) { + switch (state) { + case GBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case GBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + } else if (part == BP_COMMANDLINK) { + switch (state) { + case CMDLS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLS_DEFAULTED: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = true; + break; + case CMDLS_DEFAULTED_ANIMATING: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = true; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + } else if (part == BP_COMMANDLINKGLYPH) { + switch (state) { + case CMDLGS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLGS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLGS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLGS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = false; + break; + case CMDLGS_DEFAULTED: + gfx_state = ui::NativeTheme::kNormal; + extra->checked = false; + extra->indeterminate = false; + extra->is_default = true; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + } + return gfx_state; +} + +void WebThemeEngineImpl::paintButton( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + ui::NativeTheme::Part native_part = ui::NativeTheme::kPushButton; + switch (part) { + case BP_PUSHBUTTON: + native_part = ui::NativeTheme::kPushButton; + break; + case BP_CHECKBOX: + native_part = ui::NativeTheme::kCheckbox; + break; + case BP_RADIOBUTTON: + native_part = ui::NativeTheme::kRadio; + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebButtonStateToGfx(part, state, + &extra.button); + extra.button.classic_state = classic_state; + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + ui::NativeTheme::instance()->Paint(canvas, native_part, + native_state, gfx_rect, extra); +} + +static ui::NativeTheme::State WebListMenuStateToGfx(int part, int state) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + + switch (part) { + case CP_DROPDOWNBUTTON: + switch (state) { + case CBXS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + break; + case CBXS_HOT: + gfx_state = ui::NativeTheme::kHovered; + break; + case CBXS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + break; + case CBXS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + return gfx_state; +} + +void WebThemeEngineImpl::paintMenuList( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + ui::NativeTheme::Part native_part = ui::NativeTheme::kMenuList; + switch (part) { + case CP_DROPDOWNBUTTON: + native_part = ui::NativeTheme::kMenuList; + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + ui::NativeTheme::State native_state = WebListMenuStateToGfx(part, state); + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + ui::NativeTheme::ExtraParams extra; + extra.menu_list.classic_state = classic_state; + ui::NativeTheme::instance()->Paint(canvas, native_part, + native_state, gfx_rect, extra); +} + +static ui::NativeTheme::State WebScrollbarArrowStateToGfx( + int state, ui::NativeTheme::Part* part, + ui::NativeTheme::ScrollbarArrowExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + switch (state) { + case ABS_UPNORMAL: + gfx_state = ui::NativeTheme::kNormal; + *part = ui::NativeTheme::kScrollbarUpArrow; + extra->is_hovering = false; + break; + case ABS_UPHOT: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarUpArrow; + extra->is_hovering = false; + break; + case ABS_UPPRESSED: + gfx_state = ui::NativeTheme::kPressed; + *part = ui::NativeTheme::kScrollbarUpArrow; + extra->is_hovering = false; + break; + case ABS_UPDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *part = ui::NativeTheme::kScrollbarUpArrow; + extra->is_hovering = false; + break; + case ABS_DOWNNORMAL: + gfx_state = ui::NativeTheme::kNormal; + *part = ui::NativeTheme::kScrollbarDownArrow; + extra->is_hovering = false; + break; + case ABS_DOWNHOT: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarDownArrow; + extra->is_hovering = false; + break; + case ABS_DOWNPRESSED: + gfx_state = ui::NativeTheme::kPressed; + *part = ui::NativeTheme::kScrollbarDownArrow; + extra->is_hovering = false; + break; + case ABS_DOWNDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *part = ui::NativeTheme::kScrollbarDownArrow; + extra->is_hovering = false; + break; + case ABS_LEFTNORMAL: + gfx_state = ui::NativeTheme::kNormal; + *part = ui::NativeTheme::kScrollbarLeftArrow; + extra->is_hovering = false; + break; + case ABS_LEFTHOT: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarLeftArrow; + extra->is_hovering = false; + break; + case ABS_LEFTPRESSED: + gfx_state = ui::NativeTheme::kPressed; + *part = ui::NativeTheme::kScrollbarLeftArrow; + extra->is_hovering = false; + break; + case ABS_LEFTDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *part = ui::NativeTheme::kScrollbarLeftArrow; + extra->is_hovering = false; + break; + case ABS_RIGHTNORMAL: + gfx_state = ui::NativeTheme::kNormal; + *part = ui::NativeTheme::kScrollbarRightArrow; + extra->is_hovering = false; + break; + case ABS_RIGHTHOT: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarRightArrow; + extra->is_hovering = false; + break; + case ABS_RIGHTPRESSED: + gfx_state = ui::NativeTheme::kPressed; + *part = ui::NativeTheme::kScrollbarRightArrow; + extra->is_hovering = false; + break; + case ABS_RIGHTDISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *part = ui::NativeTheme::kScrollbarRightArrow; + extra->is_hovering = false; + break; + case ABS_UPHOVER: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarUpArrow; + extra->is_hovering = true; + break; + case ABS_DOWNHOVER: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarDownArrow; + extra->is_hovering = true; + break; + case ABS_LEFTHOVER: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarLeftArrow; + extra->is_hovering = true; + break; + case ABS_RIGHTHOVER: + gfx_state = ui::NativeTheme::kHovered; + *part = ui::NativeTheme::kScrollbarRightArrow; + extra->is_hovering = true; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + return gfx_state; +} + +void WebThemeEngineImpl::paintScrollbarArrow( + WebCanvas* canvas, int state, int classic_state, const WebRect& rect) { + ui::NativeTheme::Part native_part; + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebScrollbarArrowStateToGfx( + state, &native_part, &extra.scrollbar_arrow); + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + ui::NativeTheme::instance()->Paint(canvas, native_part, + native_state, gfx_rect, extra); +} + +static ui::NativeTheme::State WebScrollbarThumbStateToGfx( + int state, ui::NativeTheme::ScrollbarThumbExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + switch (state) { + case SCRBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->is_hovering = false; + break; + case SCRBS_HOVER: + gfx_state = ui::NativeTheme::kHovered; + extra->is_hovering = true; + break; + case SCRBS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->is_hovering = false; + break; + case SCRBS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->is_hovering = false; + break; + case SCRBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->is_hovering = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + return gfx_state; +} + +void WebThemeEngineImpl::paintScrollbarThumb( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + ui::NativeTheme::Part native_part; + if (part == SBP_THUMBBTNHORZ) { + native_part = ui::NativeTheme::kScrollbarHorizontalThumb; + } else if (part == SBP_THUMBBTNVERT) { + native_part = ui::NativeTheme::kScrollbarVerticalThumb; + } else if (part == SBP_GRIPPERHORZ) { + native_part = ui::NativeTheme::kScrollbarHorizontalGripper; + } else if (part == SBP_GRIPPERVERT) { + native_part = ui::NativeTheme::kScrollbarVerticalGripper; + } else { + NOTREACHED() << "Invalid part: " << part; + } + + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebScrollbarThumbStateToGfx( + state, &extra.scrollbar_thumb); + + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + ui::NativeTheme::instance()->Paint(canvas, native_part, + native_state, gfx_rect, extra); +} + +static ui::NativeTheme::State WebScrollbarTrackStateToGfx( + int part, int state, ui::NativeTheme::Part* gfx_part, + ui::NativeTheme::ScrollbarTrackExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + switch (part) { + case SBP_LOWERTRACKHORZ: + switch (state) { + case SCRBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = false; + break; + case SCRBS_HOVER: + case SCRBS_HOT: + gfx_state = ui::NativeTheme::kHovered; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = false; + break; + case SCRBS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = false; + break; + case SCRBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + case SBP_UPPERTRACKHORZ: + switch (state) { + case SCRBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = true; + break; + case SCRBS_HOVER: + case SCRBS_HOT: + gfx_state = ui::NativeTheme::kHovered; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = true; + break; + case SCRBS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = true; + break; + case SCRBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; + extra->is_upper = true; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + case SBP_LOWERTRACKVERT: + switch (state) { + case SCRBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = false; + break; + case SCRBS_HOVER: + case SCRBS_HOT: + gfx_state = ui::NativeTheme::kHovered; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = false; + break; + case SCRBS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = false; + break; + case SCRBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + case SBP_UPPERTRACKVERT: + switch (state) { + case SCRBS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = true; + break; + case SCRBS_HOVER: + case SCRBS_HOT: + gfx_state = ui::NativeTheme::kHovered; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = true; + break; + case SCRBS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = true; + break; + case SCRBS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; + extra->is_upper = true; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + return gfx_state; +} + +void WebThemeEngineImpl::paintScrollbarTrack( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect, const WebRect& align_rect) { + ui::NativeTheme::Part native_part; + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebScrollbarTrackStateToGfx( + part, state, &native_part, &extra.scrollbar_track); + extra.scrollbar_track.classic_state = classic_state; + extra.scrollbar_track.track_x = align_rect.x; + extra.scrollbar_track.track_y = align_rect.y; + extra.scrollbar_track.track_width = align_rect.width; + extra.scrollbar_track.track_height = align_rect.height; + + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + ui::NativeTheme::instance()->Paint(canvas, native_part, + native_state, gfx_rect, extra); +} + +static ui::NativeTheme::State WebSpinButtonStateToGfx( + int part, int state, ui::NativeTheme::InnerSpinButtonExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + switch (part) { + case SPNP_UP: + switch (state) { + case UPS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->spin_up = true; + extra->read_only = false; + break; + case UPS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->spin_up = true; + extra->read_only = false; + break; + case UPS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->spin_up = true; + extra->read_only = false; + break; + case UPS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->spin_up = true; + extra->read_only = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + case SPNP_DOWN: + switch (state) { + case DNS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->spin_up = false; + extra->read_only = false; + break; + case DNS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->spin_up = false; + extra->read_only = false; + break; + case DNS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + extra->spin_up = false; + extra->read_only = false; + break; + case DNS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->spin_up = false; + extra->read_only = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + return gfx_state; +} + +void WebThemeEngineImpl::paintSpinButton( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebSpinButtonStateToGfx( + part, state, &extra.inner_spin); + extra.inner_spin.classic_state = classic_state; + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + ui::NativeTheme::instance()->Paint(canvas, + ui::NativeTheme::kInnerSpinButton, + native_state, + gfx_rect, + extra); +} + +static ui::NativeTheme::State WebTextFieldStateToGfx( + int part, int state, ui::NativeTheme::TextFieldExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + switch (part) { + case EP_EDITTEXT: + switch (state) { + case ETS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + extra->is_read_only = false; + extra->is_focused = false; + break; + case ETS_HOT: + gfx_state = ui::NativeTheme::kHovered; + extra->is_read_only = false; + extra->is_focused = false; + break; + case ETS_SELECTED: + gfx_state = ui::NativeTheme::kPressed; + extra->is_read_only = false; + extra->is_focused = false; + break; + case ETS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + extra->is_read_only = false; + extra->is_focused = false; + break; + case ETS_FOCUSED: + gfx_state = ui::NativeTheme::kNormal; + extra->is_read_only = false; + extra->is_focused = true; + break; + case ETS_READONLY: + gfx_state = ui::NativeTheme::kNormal; + extra->is_read_only = true; + extra->is_focused = false; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + return gfx_state; +} + +void WebThemeEngineImpl::paintTextField( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect, WebColor color, bool fill_content_area, + bool draw_edges) { + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebTextFieldStateToGfx( + part, state, &extra.text_field); + extra.text_field.fill_content_area = fill_content_area; + extra.text_field.draw_edges = draw_edges; + extra.text_field.background_color = color; + extra.text_field.classic_state = classic_state; + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + + ui::NativeTheme::instance()->Paint(canvas, + ui::NativeTheme::kTextField, native_state, gfx_rect, extra); +} + +static ui::NativeTheme::State WebTrackbarStateToGfx( + int part, + int state, + ui::NativeTheme::TrackbarExtraParams* extra) { + ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; + switch (state) { + case TUS_NORMAL: + gfx_state = ui::NativeTheme::kNormal; + break; + case TUS_HOT: + gfx_state = ui::NativeTheme::kHovered; + break; + case TUS_PRESSED: + gfx_state = ui::NativeTheme::kPressed; + break; + case TUS_DISABLED: + gfx_state = ui::NativeTheme::kDisabled; + break; + default: + NOTREACHED() << "Invalid state: " << state; + break; + } + + switch (part) { + case TKP_TRACK: + case TKP_THUMBBOTTOM: + extra->vertical = false; + break; + case TKP_TRACKVERT: + case TKP_THUMBVERT: + extra->vertical = true; + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + + return gfx_state; +} + +void WebThemeEngineImpl::paintTrackbar( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + ui::NativeTheme::Part native_part = ui::NativeTheme::kTrackbarTrack; + switch (part) { + case TKP_TRACK: + case TKP_TRACKVERT: + native_part = ui::NativeTheme::kTrackbarTrack; + break; + case TKP_THUMBBOTTOM: + case TKP_THUMBVERT: + native_part = ui::NativeTheme::kTrackbarThumb; + break; + default: + NOTREACHED() << "Invalid part: " << part; + break; + } + + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State native_state = WebTrackbarStateToGfx(part, state, + &extra.trackbar); + gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); + extra.trackbar.classic_state = classic_state; + ui::NativeTheme::instance()->Paint(canvas, native_part, + native_state, gfx_rect, extra); +} + +void WebThemeEngineImpl::paintProgressBar( + WebCanvas* canvas, const WebRect& barRect, const WebRect& valueRect, + bool determinate, double animatedSeconds) +{ + gfx::Rect gfx_rect(barRect.x, barRect.y, barRect.width, barRect.height); + ui::NativeTheme::ExtraParams extra; + extra.progress_bar.animated_seconds = animatedSeconds; + extra.progress_bar.determinate = determinate; + extra.progress_bar.value_rect_x = valueRect.x; + extra.progress_bar.value_rect_y = valueRect.y; + extra.progress_bar.value_rect_width = valueRect.width; + extra.progress_bar.value_rect_height = valueRect.height; + ui::NativeTheme::instance()->Paint(canvas, ui::NativeTheme::kProgressBar, + ui::NativeTheme::kNormal, gfx_rect, + extra); +} + +WebSize WebThemeEngineImpl::getSize(int part) { + switch (part) { + case SBP_ARROWBTN: { + gfx::Size size = ui::NativeTheme::instance()->GetPartSize( + ui::NativeTheme::kScrollbarUpArrow, + ui::NativeTheme::kNormal, + ui::NativeTheme::ExtraParams()); + // GetPartSize returns a size of (0, 0) when not using a themed style + // (i.e. Windows Classic). Returning a non-zero size in this context + // creates repaint conflicts, particularly in the window titlebar area + // which significantly degrades performance. Fallback to using a system + // metric if required. + if (size.width() == 0) { + int width = static_cast<int>(GetSystemMetrics(SM_CXVSCROLL) / + ui::win::GetDeviceScaleFactor()); + size = gfx::Size(width, width); + } + return WebSize(size.width(), size.height()); + } + default: + NOTREACHED() << "Unhandled part: " << part; + } + return WebSize(); +} + +} // namespace webkit_glue diff --git a/webkit/child/webthemeengine_impl_win.h b/webkit/child/webthemeengine_impl_win.h new file mode 100644 index 0000000..860a111 --- /dev/null +++ b/webkit/child/webthemeengine_impl_win.h @@ -0,0 +1,49 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_WIN_H_ +#define WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_WIN_H_ + +#include "third_party/WebKit/public/platform/win/WebThemeEngine.h" + +namespace webkit_glue { + +class WebThemeEngineImpl : public WebKit::WebThemeEngine { + public: + // WebThemeEngine methods: + virtual void paintButton( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect); + virtual void paintMenuList( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect); + virtual void paintScrollbarArrow( + WebKit::WebCanvas* canvas, int state, int classic_state, + const WebKit::WebRect& rect); + virtual void paintScrollbarThumb( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect); + virtual void paintScrollbarTrack( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect, const WebKit::WebRect& align_rect); + virtual void paintSpinButton( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect); + virtual void paintTextField( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect, WebKit::WebColor color, + bool fill_content_area, bool draw_edges); + virtual void paintTrackbar( + WebKit::WebCanvas* canvas, int part, int state, int classic_state, + const WebKit::WebRect& rect); + virtual void paintProgressBar( + WebKit::WebCanvas* canvas, const WebKit::WebRect& barRect, + const WebKit::WebRect& valueRect, bool determinate, + double animatedSeconds); + virtual WebKit::WebSize getSize(int part); +}; + +} // namespace webkit_glue + +#endif // WEBKIT_CHILD_WEBTHEMEENGINE_IMPL_WIN_H_ diff --git a/webkit/glue/webfallbackthemeengine_impl.cc b/webkit/glue/webfallbackthemeengine_impl.cc deleted file mode 100644 index 6a7319e..0000000 --- a/webkit/glue/webfallbackthemeengine_impl.cc +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/webfallbackthemeengine_impl.h" - -#include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "ui/native_theme/fallback_theme.h" - -using WebKit::WebCanvas; -using WebKit::WebColor; -using WebKit::WebRect; -using WebKit::WebFallbackThemeEngine; - -namespace webkit_glue { - -static ui::NativeTheme::Part NativeThemePart( - WebFallbackThemeEngine::Part part) { - switch (part) { - case WebFallbackThemeEngine::PartScrollbarDownArrow: - return ui::NativeTheme::kScrollbarDownArrow; - case WebFallbackThemeEngine::PartScrollbarLeftArrow: - return ui::NativeTheme::kScrollbarLeftArrow; - case WebFallbackThemeEngine::PartScrollbarRightArrow: - return ui::NativeTheme::kScrollbarRightArrow; - case WebFallbackThemeEngine::PartScrollbarUpArrow: - return ui::NativeTheme::kScrollbarUpArrow; - case WebFallbackThemeEngine::PartScrollbarHorizontalThumb: - return ui::NativeTheme::kScrollbarHorizontalThumb; - case WebFallbackThemeEngine::PartScrollbarVerticalThumb: - return ui::NativeTheme::kScrollbarVerticalThumb; - case WebFallbackThemeEngine::PartScrollbarHorizontalTrack: - return ui::NativeTheme::kScrollbarHorizontalTrack; - case WebFallbackThemeEngine::PartScrollbarVerticalTrack: - return ui::NativeTheme::kScrollbarVerticalTrack; - case WebFallbackThemeEngine::PartCheckbox: - return ui::NativeTheme::kCheckbox; - case WebFallbackThemeEngine::PartRadio: - return ui::NativeTheme::kRadio; - case WebFallbackThemeEngine::PartButton: - return ui::NativeTheme::kPushButton; - case WebFallbackThemeEngine::PartTextField: - return ui::NativeTheme::kTextField; - case WebFallbackThemeEngine::PartMenuList: - return ui::NativeTheme::kMenuList; - case WebFallbackThemeEngine::PartSliderTrack: - return ui::NativeTheme::kSliderTrack; - case WebFallbackThemeEngine::PartSliderThumb: - return ui::NativeTheme::kSliderThumb; - case WebFallbackThemeEngine::PartInnerSpinButton: - return ui::NativeTheme::kInnerSpinButton; - case WebFallbackThemeEngine::PartProgressBar: - return ui::NativeTheme::kProgressBar; - default: - return ui::NativeTheme::kScrollbarDownArrow; - } -} - -static ui::NativeTheme::State NativeThemeState( - WebFallbackThemeEngine::State state) { - switch (state) { - case WebFallbackThemeEngine::StateDisabled: - return ui::NativeTheme::kDisabled; - case WebFallbackThemeEngine::StateHover: - return ui::NativeTheme::kHovered; - case WebFallbackThemeEngine::StateNormal: - return ui::NativeTheme::kNormal; - case WebFallbackThemeEngine::StatePressed: - return ui::NativeTheme::kPressed; - default: - return ui::NativeTheme::kDisabled; - } -} - -static void GetNativeThemeExtraParams( - WebFallbackThemeEngine::Part part, - WebFallbackThemeEngine::State state, - const WebFallbackThemeEngine::ExtraParams* extra_params, - ui::NativeTheme::ExtraParams* native_theme_extra_params) { - switch (part) { - case WebFallbackThemeEngine::PartScrollbarHorizontalTrack: - case WebFallbackThemeEngine::PartScrollbarVerticalTrack: - native_theme_extra_params->scrollbar_track.track_x = - extra_params->scrollbarTrack.trackX; - native_theme_extra_params->scrollbar_track.track_y = - extra_params->scrollbarTrack.trackY; - native_theme_extra_params->scrollbar_track.track_width = - extra_params->scrollbarTrack.trackWidth; - native_theme_extra_params->scrollbar_track.track_height = - extra_params->scrollbarTrack.trackHeight; - break; - case WebFallbackThemeEngine::PartCheckbox: - native_theme_extra_params->button.checked = extra_params->button.checked; - native_theme_extra_params->button.indeterminate = - extra_params->button.indeterminate; - break; - case WebFallbackThemeEngine::PartRadio: - native_theme_extra_params->button.checked = extra_params->button.checked; - break; - case WebFallbackThemeEngine::PartButton: - native_theme_extra_params->button.is_default = - extra_params->button.isDefault; - native_theme_extra_params->button.has_border = - extra_params->button.hasBorder; - // Native buttons have a different focus style. - native_theme_extra_params->button.is_focused = false; - native_theme_extra_params->button.background_color = - extra_params->button.backgroundColor; - break; - case WebFallbackThemeEngine::PartTextField: - native_theme_extra_params->text_field.is_text_area = - extra_params->textField.isTextArea; - native_theme_extra_params->text_field.is_listbox = - extra_params->textField.isListbox; - native_theme_extra_params->text_field.background_color = - extra_params->textField.backgroundColor; - break; - case WebFallbackThemeEngine::PartMenuList: - native_theme_extra_params->menu_list.has_border = - extra_params->menuList.hasBorder; - native_theme_extra_params->menu_list.has_border_radius = - extra_params->menuList.hasBorderRadius; - native_theme_extra_params->menu_list.arrow_x = - extra_params->menuList.arrowX; - native_theme_extra_params->menu_list.arrow_y = - extra_params->menuList.arrowY; - native_theme_extra_params->menu_list.background_color = - extra_params->menuList.backgroundColor; - break; - case WebFallbackThemeEngine::PartSliderTrack: - case WebFallbackThemeEngine::PartSliderThumb: - native_theme_extra_params->slider.vertical = - extra_params->slider.vertical; - native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; - break; - case WebFallbackThemeEngine::PartInnerSpinButton: - native_theme_extra_params->inner_spin.spin_up = - extra_params->innerSpin.spinUp; - native_theme_extra_params->inner_spin.read_only = - extra_params->innerSpin.readOnly; - break; - case WebFallbackThemeEngine::PartProgressBar: - native_theme_extra_params->progress_bar.determinate = - extra_params->progressBar.determinate; - native_theme_extra_params->progress_bar.value_rect_x = - extra_params->progressBar.valueRectX; - native_theme_extra_params->progress_bar.value_rect_y = - extra_params->progressBar.valueRectY; - native_theme_extra_params->progress_bar.value_rect_width = - extra_params->progressBar.valueRectWidth; - native_theme_extra_params->progress_bar.value_rect_height = - extra_params->progressBar.valueRectHeight; - break; - default: - break; // Parts that have no extra params get here. - } -} - -WebFallbackThemeEngineImpl::WebFallbackThemeEngineImpl() - : theme_(new ui::FallbackTheme()) { -} - -WebFallbackThemeEngineImpl::~WebFallbackThemeEngineImpl() {} - -WebKit::WebSize WebFallbackThemeEngineImpl::getSize( - WebFallbackThemeEngine::Part part) { - ui::NativeTheme::ExtraParams extra; - return theme_->GetPartSize(NativeThemePart(part), - ui::NativeTheme::kNormal, - extra); -} - -void WebFallbackThemeEngineImpl::paint( - WebKit::WebCanvas* canvas, - WebFallbackThemeEngine::Part part, - WebFallbackThemeEngine::State state, - const WebKit::WebRect& rect, - const WebFallbackThemeEngine::ExtraParams* extra_params) { - ui::NativeTheme::ExtraParams native_theme_extra_params; - GetNativeThemeExtraParams( - part, state, extra_params, &native_theme_extra_params); - theme_->Paint(canvas, - NativeThemePart(part), - NativeThemeState(state), - gfx::Rect(rect), - native_theme_extra_params); -} - -} // namespace webkit_glue diff --git a/webkit/glue/webfallbackthemeengine_impl.h b/webkit/glue/webfallbackthemeengine_impl.h deleted file mode 100644 index fbdcb8c..0000000 --- a/webkit/glue/webfallbackthemeengine_impl.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_WEBFALLBACKTHEMEENGINE_IMPL_H_ -#define WEBKIT_GLUE_WEBFALLBACKTHEMEENGINE_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebFallbackThemeEngine.h" - -namespace ui { -class FallbackTheme; -} - -namespace webkit_glue { - -class WebFallbackThemeEngineImpl : public WebKit::WebFallbackThemeEngine { - public: - WebFallbackThemeEngineImpl(); - virtual ~WebFallbackThemeEngineImpl(); - - // WebFallbackThemeEngine methods: - virtual WebKit::WebSize getSize(WebKit::WebFallbackThemeEngine::Part); - virtual void paint( - WebKit::WebCanvas* canvas, - WebKit::WebFallbackThemeEngine::Part part, - WebKit::WebFallbackThemeEngine::State state, - const WebKit::WebRect& rect, - const WebKit::WebFallbackThemeEngine::ExtraParams* extra_params); - - private: - scoped_ptr<ui::FallbackTheme> theme_; - - DISALLOW_COPY_AND_ASSIGN(WebFallbackThemeEngineImpl); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_WEBFALLBACKTHEMEENGINE_IMPL_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 8ac783e..0af16f2 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -65,7 +65,9 @@ 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink', + '<(DEPTH)/ui/native_theme/native_theme.gyp:native_theme', '<(DEPTH)/ui/ui.gyp:ui', # TODO(scottmg): crbug.com/237249 @@ -84,9 +86,19 @@ '../child/fling_curve_configuration.h', '../child/touch_fling_gesture_curve.cc', '../child/touch_fling_gesture_curve.h', + '../child/webfallbackthemeengine_impl.cc', + '../child/webfallbackthemeengine_impl.h', '../child/webkit_child_export.h', '../child/webkitplatformsupport_child_impl.cc', '../child/webkitplatformsupport_child_impl.h', + '../child/webthemeengine_impl_android.cc', + '../child/webthemeengine_impl_android.h', + '../child/webthemeengine_impl_default.cc', + '../child/webthemeengine_impl_default.h', + '../child/webthemeengine_impl_mac.cc', + '../child/webthemeengine_impl_mac.h', + '../child/webthemeengine_impl_win.cc', + '../child/webthemeengine_impl_win.h', '../child/webthread_impl.cc', '../child/webthread_impl.h', '../child/worker_task_runner.cc', @@ -94,6 +106,19 @@ ], 'conditions': [ + ['use_default_render_theme==0', { + 'sources/': [ + ['exclude', 'webthemeengine_impl_default.cc'], + ['exclude', 'webthemeengine_impl_default.h'], + ], + }], + ['OS=="mac"', { + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', + ], + }, + }], ['OS=="android"', { 'dependencies': [ 'overscroller_jni_headers', @@ -220,7 +245,6 @@ '<(DEPTH)/third_party/icu/icu.gyp:icuuc', '<(DEPTH)/third_party/npapi/npapi.gyp:npapi', '<(DEPTH)/ui/gl/gl.gyp:gl', - '<(DEPTH)/ui/native_theme/native_theme.gyp:native_theme', '<(DEPTH)/ui/ui.gyp:ui', '<(DEPTH)/ui/ui.gyp:ui_resources', '<(DEPTH)/url/url.gyp:url_lib', @@ -269,8 +293,6 @@ 'webclipboard_impl.h', 'webcookie.cc', 'webcookie.h', - 'webfallbackthemeengine_impl.cc', - 'webfallbackthemeengine_impl.h', 'webfileutilities_impl.cc', 'webfileutilities_impl.h', 'webkit_glue.cc', @@ -284,14 +306,6 @@ 'websocketstreamhandle_delegate.h', 'websocketstreamhandle_impl.cc', 'websocketstreamhandle_impl.h', - 'webthemeengine_impl_android.cc', - 'webthemeengine_impl_android.h', - 'webthemeengine_impl_default.cc', - 'webthemeengine_impl_default.h', - 'webthemeengine_impl_mac.cc', - 'webthemeengine_impl_mac.h', - 'webthemeengine_impl_win.cc', - 'webthemeengine_impl_win.h', 'weburlloader_impl.cc', 'weburlloader_impl.h', ], @@ -300,17 +314,6 @@ # own hard dependencies. 'hard_dependency': 1, 'conditions': [ - ['use_default_render_theme==0', { - 'sources/': [ - ['exclude', 'webthemeengine_impl_default.cc'], - ['exclude', 'webthemeengine_impl_default.h'], - ], - }, { # else: use_default_render_theme==1 - 'sources/': [ - ['exclude', 'webthemeengine_impl_win.cc'], - ['exclude', 'webthemeengine_impl_win.h'], - ], - }], ['toolkit_uses_gtk == 1', { 'dependencies': [ '<(DEPTH)/build/linux/system.gyp:gtk', @@ -322,25 +325,7 @@ 'libraries': [ '-lXcursor', ], }, }], - ['OS!="mac"', { - 'sources/': [['exclude', '_mac\\.(cc|mm)$']], - 'sources!': [ - 'webthemeengine_impl_mac.cc', - ], - }, { # else: OS=="mac" - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - ], - }, - }], - ['OS!="win"', { - 'sources/': [['exclude', '_win\\.cc$']], - 'sources!': [ - 'webthemeengine_impl_win.cc', - ], - }, { # else: OS=="win" - 'sources/': [['exclude', '_posix\\.cc$']], + ['OS=="win"', { 'include_dirs': [ '<(DEPTH)/third_party/wtl/include', ], diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc index 466c4c9..8a150fa 100644 --- a/webkit/glue/webkitplatformsupport_impl.cc +++ b/webkit/glue/webkitplatformsupport_impl.cc @@ -56,12 +56,10 @@ using WebKit::WebAudioBus; using WebKit::WebCookie; using WebKit::WebData; -using WebKit::WebFallbackThemeEngine; using WebKit::WebLocalizedString; using WebKit::WebPluginListBuilder; using WebKit::WebString; using WebKit::WebSocketStreamHandle; -using WebKit::WebThemeEngine; using WebKit::WebURL; using WebKit::WebURLError; using WebKit::WebURLLoader; @@ -369,14 +367,6 @@ WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { } -WebThemeEngine* WebKitPlatformSupportImpl::themeEngine() { - return &native_theme_engine_; -} - -WebFallbackThemeEngine* WebKitPlatformSupportImpl::fallbackThemeEngine() { - return &fallback_theme_engine_; -} - WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() { return new WebURLLoaderImpl(this); } diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h index a56c2b1..75400b8 100644 --- a/webkit/glue/webkitplatformsupport_impl.h +++ b/webkit/glue/webkitplatformsupport_impl.h @@ -13,17 +13,9 @@ #include "third_party/WebKit/public/platform/WebURLError.h" #include "ui/base/layout.h" #include "webkit/glue/resource_loader_bridge.h" -#include "webkit/glue/webfallbackthemeengine_impl.h" #include "webkit/glue/webkit_glue_export.h" -#if defined(USE_DEFAULT_RENDER_THEME) -#include "webkit/glue/webthemeengine_impl_default.h" -#elif defined(OS_WIN) -#include "webkit/glue/webthemeengine_impl_win.h" -#elif defined(OS_MACOSX) -#include "webkit/glue/webthemeengine_impl_mac.h" -#elif defined(OS_ANDROID) -#include "webkit/glue/webthemeengine_impl_android.h" +#if defined(OS_ANDROID) #include "webkit/renderer/media/audio_decoder.h" #endif @@ -51,9 +43,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : virtual ~WebKitPlatformSupportImpl(); // Platform methods (partial implementation): - virtual WebKit::WebThemeEngine* themeEngine(); - virtual WebKit::WebFallbackThemeEngine* fallbackThemeEngine(); - virtual base::PlatformFile databaseOpenFile( const WebKit::WebString& vfs_file_name, int desired_flags); virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, @@ -172,8 +161,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : double shared_timer_fire_time_; bool shared_timer_fire_time_was_set_while_suspended_; int shared_timer_suspended_; // counter - WebThemeEngineImpl native_theme_engine_; - WebFallbackThemeEngineImpl fallback_theme_engine_; }; } // namespace webkit_glue diff --git a/webkit/glue/webthemeengine_impl_android.cc b/webkit/glue/webthemeengine_impl_android.cc deleted file mode 100644 index ee46493..0000000 --- a/webkit/glue/webthemeengine_impl_android.cc +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/webthemeengine_impl_android.h" - -#include "base/logging.h" -#include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "ui/native_theme/native_theme.h" - -using WebKit::WebCanvas; -using WebKit::WebColor; -using WebKit::WebRect; -using WebKit::WebThemeEngine; - -namespace webkit_glue { - -static ui::NativeTheme::Part NativeThemePart( - WebThemeEngine::Part part) { - switch (part) { - case WebThemeEngine::PartScrollbarDownArrow: - return ui::NativeTheme::kScrollbarDownArrow; - case WebThemeEngine::PartScrollbarLeftArrow: - return ui::NativeTheme::kScrollbarLeftArrow; - case WebThemeEngine::PartScrollbarRightArrow: - return ui::NativeTheme::kScrollbarRightArrow; - case WebThemeEngine::PartScrollbarUpArrow: - return ui::NativeTheme::kScrollbarUpArrow; - case WebThemeEngine::PartScrollbarHorizontalThumb: - // Android doesn't draw scrollbars. - NOTREACHED(); - return static_cast<ui::NativeTheme::Part>(0); - case WebThemeEngine::PartScrollbarVerticalThumb: - // Android doesn't draw scrollbars. - NOTREACHED(); - return static_cast<ui::NativeTheme::Part>(0); - case WebThemeEngine::PartScrollbarHorizontalTrack: - // Android doesn't draw scrollbars. - NOTREACHED(); - return static_cast<ui::NativeTheme::Part>(0); - case WebThemeEngine::PartScrollbarVerticalTrack: - // Android doesn't draw scrollbars. - NOTREACHED(); - return static_cast<ui::NativeTheme::Part>(0); - case WebThemeEngine::PartCheckbox: - return ui::NativeTheme::kCheckbox; - case WebThemeEngine::PartRadio: - return ui::NativeTheme::kRadio; - case WebThemeEngine::PartButton: - return ui::NativeTheme::kPushButton; - case WebThemeEngine::PartTextField: - return ui::NativeTheme::kTextField; - case WebThemeEngine::PartMenuList: - return ui::NativeTheme::kMenuList; - case WebThemeEngine::PartSliderTrack: - return ui::NativeTheme::kSliderTrack; - case WebThemeEngine::PartSliderThumb: - return ui::NativeTheme::kSliderThumb; - case WebThemeEngine::PartInnerSpinButton: - return ui::NativeTheme::kInnerSpinButton; - case WebThemeEngine::PartProgressBar: - return ui::NativeTheme::kProgressBar; - default: - return ui::NativeTheme::kScrollbarDownArrow; - } -} - -static ui::NativeTheme::State NativeThemeState( - WebThemeEngine::State state) { - switch (state) { - case WebThemeEngine::StateDisabled: - return ui::NativeTheme::kDisabled; - case WebThemeEngine::StateHover: - return ui::NativeTheme::kHovered; - case WebThemeEngine::StateNormal: - return ui::NativeTheme::kNormal; - case WebThemeEngine::StatePressed: - return ui::NativeTheme::kPressed; - default: - return ui::NativeTheme::kDisabled; - } -} - -static void GetNativeThemeExtraParams( - WebThemeEngine::Part part, - WebThemeEngine::State state, - const WebThemeEngine::ExtraParams* extra_params, - ui::NativeTheme::ExtraParams* native_theme_extra_params) { - switch (part) { - case WebThemeEngine::PartScrollbarHorizontalTrack: - case WebThemeEngine::PartScrollbarVerticalTrack: - // Android doesn't draw scrollbars. - NOTREACHED(); - break; - case WebThemeEngine::PartCheckbox: - native_theme_extra_params->button.checked = extra_params->button.checked; - native_theme_extra_params->button.indeterminate = - extra_params->button.indeterminate; - break; - case WebThemeEngine::PartRadio: - native_theme_extra_params->button.checked = extra_params->button.checked; - break; - case WebThemeEngine::PartButton: - native_theme_extra_params->button.is_default = - extra_params->button.isDefault; - native_theme_extra_params->button.has_border = - extra_params->button.hasBorder; - // Native buttons have a different focus style. - native_theme_extra_params->button.is_focused = false; - native_theme_extra_params->button.background_color = - extra_params->button.backgroundColor; - break; - case WebThemeEngine::PartTextField: - native_theme_extra_params->text_field.is_text_area = - extra_params->textField.isTextArea; - native_theme_extra_params->text_field.is_listbox = - extra_params->textField.isListbox; - native_theme_extra_params->text_field.background_color = - extra_params->textField.backgroundColor; - break; - case WebThemeEngine::PartMenuList: - native_theme_extra_params->menu_list.has_border = - extra_params->menuList.hasBorder; - native_theme_extra_params->menu_list.has_border_radius = - extra_params->menuList.hasBorderRadius; - native_theme_extra_params->menu_list.arrow_x = - extra_params->menuList.arrowX; - native_theme_extra_params->menu_list.arrow_y = - extra_params->menuList.arrowY; - native_theme_extra_params->menu_list.background_color = - extra_params->menuList.backgroundColor; - break; - case WebThemeEngine::PartSliderTrack: - case WebThemeEngine::PartSliderThumb: - native_theme_extra_params->slider.vertical = - extra_params->slider.vertical; - native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; - break; - case WebThemeEngine::PartInnerSpinButton: - native_theme_extra_params->inner_spin.spin_up = - extra_params->innerSpin.spinUp; - native_theme_extra_params->inner_spin.read_only = - extra_params->innerSpin.readOnly; - break; - case WebThemeEngine::PartProgressBar: - native_theme_extra_params->progress_bar.determinate = - extra_params->progressBar.determinate; - native_theme_extra_params->progress_bar.value_rect_x = - extra_params->progressBar.valueRectX; - native_theme_extra_params->progress_bar.value_rect_y = - extra_params->progressBar.valueRectY; - native_theme_extra_params->progress_bar.value_rect_width = - extra_params->progressBar.valueRectWidth; - native_theme_extra_params->progress_bar.value_rect_height = - extra_params->progressBar.valueRectHeight; - break; - default: - break; // Parts that have no extra params get here. - } -} - -WebKit::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { - ui::NativeTheme::ExtraParams extra; - return ui::NativeTheme::instance()->GetPartSize( - NativeThemePart(part), ui::NativeTheme::kNormal, extra); -} - -void WebThemeEngineImpl::paint( - WebKit::WebCanvas* canvas, - WebThemeEngine::Part part, - WebThemeEngine::State state, - const WebKit::WebRect& rect, - const WebThemeEngine::ExtraParams* extra_params) { - ui::NativeTheme::ExtraParams native_theme_extra_params; - GetNativeThemeExtraParams( - part, state, extra_params, &native_theme_extra_params); - ui::NativeTheme::instance()->Paint( - canvas, - NativeThemePart(part), - NativeThemeState(state), - gfx::Rect(rect), - native_theme_extra_params); -} -} // namespace webkit_glue diff --git a/webkit/glue/webthemeengine_impl_android.h b/webkit/glue/webthemeengine_impl_android.h deleted file mode 100644 index e2b071e..0000000 --- a/webkit/glue/webthemeengine_impl_android.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_ANDROID_H_ -#define WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_ANDROID_H_ - -#include "third_party/WebKit/public/platform/android/WebThemeEngine.h" - -namespace webkit_glue { - -class WebThemeEngineImpl : public WebKit::WebThemeEngine { - public: - // WebThemeEngine methods: - virtual WebKit::WebSize getSize(WebKit::WebThemeEngine::Part); - virtual void paint( - WebKit::WebCanvas* canvas, - WebKit::WebThemeEngine::Part part, - WebKit::WebThemeEngine::State state, - const WebKit::WebRect& rect, - const WebKit::WebThemeEngine::ExtraParams* extra_params); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_ANDROID_H_ diff --git a/webkit/glue/webthemeengine_impl_default.cc b/webkit/glue/webthemeengine_impl_default.cc deleted file mode 100644 index 9be9ea8..0000000 --- a/webkit/glue/webthemeengine_impl_default.cc +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/webthemeengine_impl_default.h" - -#include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "ui/native_theme/native_theme.h" - -using WebKit::WebCanvas; -using WebKit::WebColor; -using WebKit::WebRect; -using WebKit::WebThemeEngine; - -namespace webkit_glue { - -static ui::NativeTheme::Part NativeThemePart( - WebThemeEngine::Part part) { - switch (part) { - case WebThemeEngine::PartScrollbarDownArrow: - return ui::NativeTheme::kScrollbarDownArrow; - case WebThemeEngine::PartScrollbarLeftArrow: - return ui::NativeTheme::kScrollbarLeftArrow; - case WebThemeEngine::PartScrollbarRightArrow: - return ui::NativeTheme::kScrollbarRightArrow; - case WebThemeEngine::PartScrollbarUpArrow: - return ui::NativeTheme::kScrollbarUpArrow; - case WebThemeEngine::PartScrollbarHorizontalThumb: - return ui::NativeTheme::kScrollbarHorizontalThumb; - case WebThemeEngine::PartScrollbarVerticalThumb: - return ui::NativeTheme::kScrollbarVerticalThumb; - case WebThemeEngine::PartScrollbarHorizontalTrack: - return ui::NativeTheme::kScrollbarHorizontalTrack; - case WebThemeEngine::PartScrollbarVerticalTrack: - return ui::NativeTheme::kScrollbarVerticalTrack; - case WebThemeEngine::PartCheckbox: - return ui::NativeTheme::kCheckbox; - case WebThemeEngine::PartRadio: - return ui::NativeTheme::kRadio; - case WebThemeEngine::PartButton: - return ui::NativeTheme::kPushButton; - case WebThemeEngine::PartTextField: - return ui::NativeTheme::kTextField; - case WebThemeEngine::PartMenuList: - return ui::NativeTheme::kMenuList; - case WebThemeEngine::PartSliderTrack: - return ui::NativeTheme::kSliderTrack; - case WebThemeEngine::PartSliderThumb: - return ui::NativeTheme::kSliderThumb; - case WebThemeEngine::PartInnerSpinButton: - return ui::NativeTheme::kInnerSpinButton; - case WebThemeEngine::PartProgressBar: - return ui::NativeTheme::kProgressBar; - default: - return ui::NativeTheme::kScrollbarDownArrow; - } -} - -static ui::NativeTheme::State NativeThemeState( - WebThemeEngine::State state) { - switch (state) { - case WebThemeEngine::StateDisabled: - return ui::NativeTheme::kDisabled; - case WebThemeEngine::StateHover: - return ui::NativeTheme::kHovered; - case WebThemeEngine::StateNormal: - return ui::NativeTheme::kNormal; - case WebThemeEngine::StatePressed: - return ui::NativeTheme::kPressed; - default: - return ui::NativeTheme::kDisabled; - } -} - -static void GetNativeThemeExtraParams( - WebThemeEngine::Part part, - WebThemeEngine::State state, - const WebThemeEngine::ExtraParams* extra_params, - ui::NativeTheme::ExtraParams* native_theme_extra_params) { - switch (part) { - case WebThemeEngine::PartScrollbarHorizontalTrack: - case WebThemeEngine::PartScrollbarVerticalTrack: - native_theme_extra_params->scrollbar_track.track_x = - extra_params->scrollbarTrack.trackX; - native_theme_extra_params->scrollbar_track.track_y = - extra_params->scrollbarTrack.trackY; - native_theme_extra_params->scrollbar_track.track_width = - extra_params->scrollbarTrack.trackWidth; - native_theme_extra_params->scrollbar_track.track_height = - extra_params->scrollbarTrack.trackHeight; - break; - case WebThemeEngine::PartCheckbox: - native_theme_extra_params->button.checked = extra_params->button.checked; - native_theme_extra_params->button.indeterminate = - extra_params->button.indeterminate; - break; - case WebThemeEngine::PartRadio: - native_theme_extra_params->button.checked = extra_params->button.checked; - break; - case WebThemeEngine::PartButton: - native_theme_extra_params->button.is_default = - extra_params->button.isDefault; - native_theme_extra_params->button.has_border = - extra_params->button.hasBorder; - // Native buttons have a different focus style. - native_theme_extra_params->button.is_focused = false; - native_theme_extra_params->button.background_color = - extra_params->button.backgroundColor; - break; - case WebThemeEngine::PartTextField: - native_theme_extra_params->text_field.is_text_area = - extra_params->textField.isTextArea; - native_theme_extra_params->text_field.is_listbox = - extra_params->textField.isListbox; - native_theme_extra_params->text_field.background_color = - extra_params->textField.backgroundColor; - break; - case WebThemeEngine::PartMenuList: - native_theme_extra_params->menu_list.has_border = - extra_params->menuList.hasBorder; - native_theme_extra_params->menu_list.has_border_radius = - extra_params->menuList.hasBorderRadius; - native_theme_extra_params->menu_list.arrow_x = - extra_params->menuList.arrowX; - native_theme_extra_params->menu_list.arrow_y = - extra_params->menuList.arrowY; - native_theme_extra_params->menu_list.background_color = - extra_params->menuList.backgroundColor; - break; - case WebThemeEngine::PartSliderTrack: - case WebThemeEngine::PartSliderThumb: - native_theme_extra_params->slider.vertical = - extra_params->slider.vertical; - native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; - break; - case WebThemeEngine::PartInnerSpinButton: - native_theme_extra_params->inner_spin.spin_up = - extra_params->innerSpin.spinUp; - native_theme_extra_params->inner_spin.read_only = - extra_params->innerSpin.readOnly; - break; - case WebThemeEngine::PartProgressBar: - native_theme_extra_params->progress_bar.determinate = - extra_params->progressBar.determinate; - native_theme_extra_params->progress_bar.value_rect_x = - extra_params->progressBar.valueRectX; - native_theme_extra_params->progress_bar.value_rect_y = - extra_params->progressBar.valueRectY; - native_theme_extra_params->progress_bar.value_rect_width = - extra_params->progressBar.valueRectWidth; - native_theme_extra_params->progress_bar.value_rect_height = - extra_params->progressBar.valueRectHeight; - break; - default: - break; // Parts that have no extra params get here. - } -} - -WebKit::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) { - ui::NativeTheme::ExtraParams extra; - return ui::NativeTheme::instance()->GetPartSize(NativeThemePart(part), - ui::NativeTheme::kNormal, - extra); -} - -void WebThemeEngineImpl::paint( - WebKit::WebCanvas* canvas, - WebThemeEngine::Part part, - WebThemeEngine::State state, - const WebKit::WebRect& rect, - const WebThemeEngine::ExtraParams* extra_params) { - ui::NativeTheme::ExtraParams native_theme_extra_params; - GetNativeThemeExtraParams( - part, state, extra_params, &native_theme_extra_params); - ui::NativeTheme::instance()->Paint( - canvas, - NativeThemePart(part), - NativeThemeState(state), - gfx::Rect(rect), - native_theme_extra_params); -} - -} // namespace webkit_glue diff --git a/webkit/glue/webthemeengine_impl_default.h b/webkit/glue/webthemeengine_impl_default.h deleted file mode 100644 index df97812..0000000 --- a/webkit/glue/webthemeengine_impl_default.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_DEFAULT_H_ -#define WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_DEFAULT_H_ - -#include "third_party/WebKit/public/platform/default/WebThemeEngine.h" - -namespace webkit_glue { - -class WebThemeEngineImpl : public WebKit::WebThemeEngine { - public: - // WebThemeEngine methods: - virtual WebKit::WebSize getSize(WebKit::WebThemeEngine::Part); - virtual void paint( - WebKit::WebCanvas* canvas, - WebKit::WebThemeEngine::Part part, - WebKit::WebThemeEngine::State state, - const WebKit::WebRect& rect, - const WebKit::WebThemeEngine::ExtraParams* extra_params); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_DEFAULT_H_ diff --git a/webkit/glue/webthemeengine_impl_mac.cc b/webkit/glue/webthemeengine_impl_mac.cc deleted file mode 100644 index c640bd6..0000000 --- a/webkit/glue/webthemeengine_impl_mac.cc +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/webthemeengine_impl_mac.h" - -#include <Carbon/Carbon.h> - -#include "skia/ext/skia_utils_mac.h" -#include "third_party/WebKit/public/platform/WebCanvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" - -using WebKit::WebCanvas; -using WebKit::WebRect; -using WebKit::WebThemeEngine; - -namespace webkit_glue { - -static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) { - switch (state) { - case WebThemeEngine::StateDisabled: - return kThemeTrackDisabled; - case WebThemeEngine::StateInactive: - return kThemeTrackInactive; - default: - return kThemeTrackActive; - } -} - -void WebThemeEngineImpl::paintScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) { - HIThemeTrackDrawInfo trackInfo; - trackInfo.version = 0; - trackInfo.kind = size == WebThemeEngine::SizeRegular ? - kThemeMediumScrollBar : kThemeSmallScrollBar; - trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height); - trackInfo.min = 0; - trackInfo.max = scrollbarInfo.maxValue; - trackInfo.value = scrollbarInfo.currentValue; - trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize; - trackInfo.attributes = 0; - if (scrollbarInfo.orientation == - WebThemeEngine::ScrollbarOrientationHorizontal) { - trackInfo.attributes |= kThemeTrackHorizontal; - } - - trackInfo.enableState = stateToHIEnableState(state); - - trackInfo.trackInfo.scrollbar.pressState = - state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; - trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); - gfx::SkiaBitLocker bitLocker(canvas); - CGContextRef cgContext = bitLocker.cgContext(); - HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); -} - -} // namespace webkit_glue diff --git a/webkit/glue/webthemeengine_impl_mac.h b/webkit/glue/webthemeengine_impl_mac.h deleted file mode 100644 index 1d952cc..0000000 --- a/webkit/glue/webthemeengine_impl_mac.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_ -#define WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_ - -#include "third_party/WebKit/public/platform/mac/WebThemeEngine.h" - -namespace webkit_glue { - -class WebThemeEngineImpl : public WebKit::WebThemeEngine { - public: - // WebKit::WebThemeEngine implementation. - virtual void paintScrollbarThumb( - WebKit::WebCanvas* canvas, - WebKit::WebThemeEngine::State part, - WebKit::WebThemeEngine::Size state, - const WebKit::WebRect& rect, - const WebKit::WebThemeEngine::ScrollbarInfo& extra_params); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_ diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc deleted file mode 100644 index c4dde227..0000000 --- a/webkit/glue/webthemeengine_impl_win.cc +++ /dev/null @@ -1,1014 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/webthemeengine_impl_win.h" - -#include <vsstyle.h> // To convert to ui::NativeTheme::State - -#include "base/logging.h" -#include "skia/ext/platform_canvas.h" -#include "skia/ext/skia_utils_win.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "ui/base/win/dpi.h" -#include "ui/native_theme/native_theme.h" - -using WebKit::WebCanvas; -using WebKit::WebColor; -using WebKit::WebRect; -using WebKit::WebSize; - -namespace webkit_glue { - -static RECT WebRectToRECT(const WebRect& rect) { - RECT result; - result.left = rect.x; - result.top = rect.y; - result.right = rect.x + rect.width; - result.bottom = rect.y + rect.height; - return result; -} - -static ui::NativeTheme::State WebButtonStateToGfx( - int part, int state, ui::NativeTheme::ButtonExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - // Native buttons have a different focus style. - extra->is_focused = false; - extra->has_border = false; - extra->background_color = ui::NativeTheme::instance()->GetSystemColor( - ui::NativeTheme::kColorId_ButtonBackgroundColor); - - if (part == BP_PUSHBUTTON) { - switch (state) { - case PBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case PBS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case PBS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case PBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case PBS_DEFAULTED: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = true; - break; - case PBS_DEFAULTED_ANIMATING: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = true; - break; - default: - NOTREACHED() << "Invalid state: " << state; - } - } else if (part == BP_RADIOBUTTON) { - switch (state) { - case RBS_UNCHECKEDNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_UNCHECKEDHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_UNCHECKEDPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_UNCHECKEDDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_CHECKEDNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_CHECKEDHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_CHECKEDPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case RBS_CHECKEDDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - } else if (part == BP_CHECKBOX) { - switch (state) { - case CBS_UNCHECKEDNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_UNCHECKEDHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_UNCHECKEDPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_UNCHECKEDDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_CHECKEDNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_CHECKEDHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_CHECKEDPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_CHECKEDDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = true; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_MIXEDNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = true; - extra->is_default = false; - break; - case CBS_MIXEDHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = true; - extra->is_default = false; - break; - case CBS_MIXEDPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = true; - extra->is_default = false; - break; - case CBS_MIXEDDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = true; - extra->is_default = false; - break; - case CBS_IMPLICITNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_IMPLICITHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_IMPLICITPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_IMPLICITDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_EXCLUDEDNORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_EXCLUDEDHOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_EXCLUDEDPRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CBS_EXCLUDEDDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - } else if (part == BP_GROUPBOX) { - switch (state) { - case GBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case GBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - } else if (part == BP_COMMANDLINK) { - switch (state) { - case CMDLS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLS_DEFAULTED: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = true; - break; - case CMDLS_DEFAULTED_ANIMATING: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = true; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - } else if (part == BP_COMMANDLINKGLYPH) { - switch (state) { - case CMDLGS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLGS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLGS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLGS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = false; - break; - case CMDLGS_DEFAULTED: - gfx_state = ui::NativeTheme::kNormal; - extra->checked = false; - extra->indeterminate = false; - extra->is_default = true; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - } - return gfx_state; -} - -void WebThemeEngineImpl::paintButton( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect) { - ui::NativeTheme::Part native_part = ui::NativeTheme::kPushButton; - switch (part) { - case BP_PUSHBUTTON: - native_part = ui::NativeTheme::kPushButton; - break; - case BP_CHECKBOX: - native_part = ui::NativeTheme::kCheckbox; - break; - case BP_RADIOBUTTON: - native_part = ui::NativeTheme::kRadio; - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebButtonStateToGfx(part, state, - &extra.button); - extra.button.classic_state = classic_state; - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - ui::NativeTheme::instance()->Paint(canvas, native_part, - native_state, gfx_rect, extra); -} - -static ui::NativeTheme::State WebListMenuStateToGfx(int part, int state) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - - switch (part) { - case CP_DROPDOWNBUTTON: - switch (state) { - case CBXS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - break; - case CBXS_HOT: - gfx_state = ui::NativeTheme::kHovered; - break; - case CBXS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - break; - case CBXS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - return gfx_state; -} - -void WebThemeEngineImpl::paintMenuList( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect) { - ui::NativeTheme::Part native_part = ui::NativeTheme::kMenuList; - switch (part) { - case CP_DROPDOWNBUTTON: - native_part = ui::NativeTheme::kMenuList; - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - ui::NativeTheme::State native_state = WebListMenuStateToGfx(part, state); - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - ui::NativeTheme::ExtraParams extra; - extra.menu_list.classic_state = classic_state; - ui::NativeTheme::instance()->Paint(canvas, native_part, - native_state, gfx_rect, extra); -} - -static ui::NativeTheme::State WebScrollbarArrowStateToGfx( - int state, ui::NativeTheme::Part* part, - ui::NativeTheme::ScrollbarArrowExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - switch (state) { - case ABS_UPNORMAL: - gfx_state = ui::NativeTheme::kNormal; - *part = ui::NativeTheme::kScrollbarUpArrow; - extra->is_hovering = false; - break; - case ABS_UPHOT: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarUpArrow; - extra->is_hovering = false; - break; - case ABS_UPPRESSED: - gfx_state = ui::NativeTheme::kPressed; - *part = ui::NativeTheme::kScrollbarUpArrow; - extra->is_hovering = false; - break; - case ABS_UPDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *part = ui::NativeTheme::kScrollbarUpArrow; - extra->is_hovering = false; - break; - case ABS_DOWNNORMAL: - gfx_state = ui::NativeTheme::kNormal; - *part = ui::NativeTheme::kScrollbarDownArrow; - extra->is_hovering = false; - break; - case ABS_DOWNHOT: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarDownArrow; - extra->is_hovering = false; - break; - case ABS_DOWNPRESSED: - gfx_state = ui::NativeTheme::kPressed; - *part = ui::NativeTheme::kScrollbarDownArrow; - extra->is_hovering = false; - break; - case ABS_DOWNDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *part = ui::NativeTheme::kScrollbarDownArrow; - extra->is_hovering = false; - break; - case ABS_LEFTNORMAL: - gfx_state = ui::NativeTheme::kNormal; - *part = ui::NativeTheme::kScrollbarLeftArrow; - extra->is_hovering = false; - break; - case ABS_LEFTHOT: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarLeftArrow; - extra->is_hovering = false; - break; - case ABS_LEFTPRESSED: - gfx_state = ui::NativeTheme::kPressed; - *part = ui::NativeTheme::kScrollbarLeftArrow; - extra->is_hovering = false; - break; - case ABS_LEFTDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *part = ui::NativeTheme::kScrollbarLeftArrow; - extra->is_hovering = false; - break; - case ABS_RIGHTNORMAL: - gfx_state = ui::NativeTheme::kNormal; - *part = ui::NativeTheme::kScrollbarRightArrow; - extra->is_hovering = false; - break; - case ABS_RIGHTHOT: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarRightArrow; - extra->is_hovering = false; - break; - case ABS_RIGHTPRESSED: - gfx_state = ui::NativeTheme::kPressed; - *part = ui::NativeTheme::kScrollbarRightArrow; - extra->is_hovering = false; - break; - case ABS_RIGHTDISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *part = ui::NativeTheme::kScrollbarRightArrow; - extra->is_hovering = false; - break; - case ABS_UPHOVER: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarUpArrow; - extra->is_hovering = true; - break; - case ABS_DOWNHOVER: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarDownArrow; - extra->is_hovering = true; - break; - case ABS_LEFTHOVER: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarLeftArrow; - extra->is_hovering = true; - break; - case ABS_RIGHTHOVER: - gfx_state = ui::NativeTheme::kHovered; - *part = ui::NativeTheme::kScrollbarRightArrow; - extra->is_hovering = true; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - return gfx_state; -} - -void WebThemeEngineImpl::paintScrollbarArrow( - WebCanvas* canvas, int state, int classic_state, const WebRect& rect) { - ui::NativeTheme::Part native_part; - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebScrollbarArrowStateToGfx( - state, &native_part, &extra.scrollbar_arrow); - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - ui::NativeTheme::instance()->Paint(canvas, native_part, - native_state, gfx_rect, extra); -} - -static ui::NativeTheme::State WebScrollbarThumbStateToGfx( - int state, ui::NativeTheme::ScrollbarThumbExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - switch (state) { - case SCRBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->is_hovering = false; - break; - case SCRBS_HOVER: - gfx_state = ui::NativeTheme::kHovered; - extra->is_hovering = true; - break; - case SCRBS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->is_hovering = false; - break; - case SCRBS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->is_hovering = false; - break; - case SCRBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->is_hovering = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - return gfx_state; -} - -void WebThemeEngineImpl::paintScrollbarThumb( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect) { - ui::NativeTheme::Part native_part; - if (part == SBP_THUMBBTNHORZ) { - native_part = ui::NativeTheme::kScrollbarHorizontalThumb; - } else if (part == SBP_THUMBBTNVERT) { - native_part = ui::NativeTheme::kScrollbarVerticalThumb; - } else if (part == SBP_GRIPPERHORZ) { - native_part = ui::NativeTheme::kScrollbarHorizontalGripper; - } else if (part == SBP_GRIPPERVERT) { - native_part = ui::NativeTheme::kScrollbarVerticalGripper; - } else { - NOTREACHED() << "Invalid part: " << part; - } - - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebScrollbarThumbStateToGfx( - state, &extra.scrollbar_thumb); - - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - ui::NativeTheme::instance()->Paint(canvas, native_part, - native_state, gfx_rect, extra); -} - -static ui::NativeTheme::State WebScrollbarTrackStateToGfx( - int part, int state, ui::NativeTheme::Part* gfx_part, - ui::NativeTheme::ScrollbarTrackExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - switch (part) { - case SBP_LOWERTRACKHORZ: - switch (state) { - case SCRBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = false; - break; - case SCRBS_HOVER: - case SCRBS_HOT: - gfx_state = ui::NativeTheme::kHovered; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = false; - break; - case SCRBS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = false; - break; - case SCRBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - case SBP_UPPERTRACKHORZ: - switch (state) { - case SCRBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = true; - break; - case SCRBS_HOVER: - case SCRBS_HOT: - gfx_state = ui::NativeTheme::kHovered; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = true; - break; - case SCRBS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = true; - break; - case SCRBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *gfx_part = ui::NativeTheme::kScrollbarHorizontalTrack; - extra->is_upper = true; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - case SBP_LOWERTRACKVERT: - switch (state) { - case SCRBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = false; - break; - case SCRBS_HOVER: - case SCRBS_HOT: - gfx_state = ui::NativeTheme::kHovered; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = false; - break; - case SCRBS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = false; - break; - case SCRBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - case SBP_UPPERTRACKVERT: - switch (state) { - case SCRBS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = true; - break; - case SCRBS_HOVER: - case SCRBS_HOT: - gfx_state = ui::NativeTheme::kHovered; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = true; - break; - case SCRBS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = true; - break; - case SCRBS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - *gfx_part = ui::NativeTheme::kScrollbarVerticalTrack; - extra->is_upper = true; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - return gfx_state; -} - -void WebThemeEngineImpl::paintScrollbarTrack( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect, const WebRect& align_rect) { - ui::NativeTheme::Part native_part; - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebScrollbarTrackStateToGfx( - part, state, &native_part, &extra.scrollbar_track); - extra.scrollbar_track.classic_state = classic_state; - extra.scrollbar_track.track_x = align_rect.x; - extra.scrollbar_track.track_y = align_rect.y; - extra.scrollbar_track.track_width = align_rect.width; - extra.scrollbar_track.track_height = align_rect.height; - - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - ui::NativeTheme::instance()->Paint(canvas, native_part, - native_state, gfx_rect, extra); -} - -static ui::NativeTheme::State WebSpinButtonStateToGfx( - int part, int state, ui::NativeTheme::InnerSpinButtonExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - switch (part) { - case SPNP_UP: - switch (state) { - case UPS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->spin_up = true; - extra->read_only = false; - break; - case UPS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->spin_up = true; - extra->read_only = false; - break; - case UPS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->spin_up = true; - extra->read_only = false; - break; - case UPS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->spin_up = true; - extra->read_only = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - case SPNP_DOWN: - switch (state) { - case DNS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->spin_up = false; - extra->read_only = false; - break; - case DNS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->spin_up = false; - extra->read_only = false; - break; - case DNS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - extra->spin_up = false; - extra->read_only = false; - break; - case DNS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->spin_up = false; - extra->read_only = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - return gfx_state; -} - -void WebThemeEngineImpl::paintSpinButton( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect) { - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebSpinButtonStateToGfx( - part, state, &extra.inner_spin); - extra.inner_spin.classic_state = classic_state; - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - ui::NativeTheme::instance()->Paint(canvas, - ui::NativeTheme::kInnerSpinButton, - native_state, - gfx_rect, - extra); -} - -static ui::NativeTheme::State WebTextFieldStateToGfx( - int part, int state, ui::NativeTheme::TextFieldExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - switch (part) { - case EP_EDITTEXT: - switch (state) { - case ETS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - extra->is_read_only = false; - extra->is_focused = false; - break; - case ETS_HOT: - gfx_state = ui::NativeTheme::kHovered; - extra->is_read_only = false; - extra->is_focused = false; - break; - case ETS_SELECTED: - gfx_state = ui::NativeTheme::kPressed; - extra->is_read_only = false; - extra->is_focused = false; - break; - case ETS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - extra->is_read_only = false; - extra->is_focused = false; - break; - case ETS_FOCUSED: - gfx_state = ui::NativeTheme::kNormal; - extra->is_read_only = false; - extra->is_focused = true; - break; - case ETS_READONLY: - gfx_state = ui::NativeTheme::kNormal; - extra->is_read_only = true; - extra->is_focused = false; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - return gfx_state; -} - -void WebThemeEngineImpl::paintTextField( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect, WebColor color, bool fill_content_area, - bool draw_edges) { - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebTextFieldStateToGfx( - part, state, &extra.text_field); - extra.text_field.fill_content_area = fill_content_area; - extra.text_field.draw_edges = draw_edges; - extra.text_field.background_color = color; - extra.text_field.classic_state = classic_state; - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - - ui::NativeTheme::instance()->Paint(canvas, - ui::NativeTheme::kTextField, native_state, gfx_rect, extra); -} - -static ui::NativeTheme::State WebTrackbarStateToGfx( - int part, - int state, - ui::NativeTheme::TrackbarExtraParams* extra) { - ui::NativeTheme::State gfx_state = ui::NativeTheme::kNormal; - switch (state) { - case TUS_NORMAL: - gfx_state = ui::NativeTheme::kNormal; - break; - case TUS_HOT: - gfx_state = ui::NativeTheme::kHovered; - break; - case TUS_PRESSED: - gfx_state = ui::NativeTheme::kPressed; - break; - case TUS_DISABLED: - gfx_state = ui::NativeTheme::kDisabled; - break; - default: - NOTREACHED() << "Invalid state: " << state; - break; - } - - switch (part) { - case TKP_TRACK: - case TKP_THUMBBOTTOM: - extra->vertical = false; - break; - case TKP_TRACKVERT: - case TKP_THUMBVERT: - extra->vertical = true; - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - - return gfx_state; -} - -void WebThemeEngineImpl::paintTrackbar( - WebCanvas* canvas, int part, int state, int classic_state, - const WebRect& rect) { - ui::NativeTheme::Part native_part = ui::NativeTheme::kTrackbarTrack; - switch (part) { - case TKP_TRACK: - case TKP_TRACKVERT: - native_part = ui::NativeTheme::kTrackbarTrack; - break; - case TKP_THUMBBOTTOM: - case TKP_THUMBVERT: - native_part = ui::NativeTheme::kTrackbarThumb; - break; - default: - NOTREACHED() << "Invalid part: " << part; - break; - } - - ui::NativeTheme::ExtraParams extra; - ui::NativeTheme::State native_state = WebTrackbarStateToGfx(part, state, - &extra.trackbar); - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); - extra.trackbar.classic_state = classic_state; - ui::NativeTheme::instance()->Paint(canvas, native_part, - native_state, gfx_rect, extra); -} - -void WebThemeEngineImpl::paintProgressBar( - WebCanvas* canvas, const WebRect& barRect, const WebRect& valueRect, - bool determinate, double animatedSeconds) -{ - gfx::Rect gfx_rect(barRect.x, barRect.y, barRect.width, barRect.height); - ui::NativeTheme::ExtraParams extra; - extra.progress_bar.animated_seconds = animatedSeconds; - extra.progress_bar.determinate = determinate; - extra.progress_bar.value_rect_x = valueRect.x; - extra.progress_bar.value_rect_y = valueRect.y; - extra.progress_bar.value_rect_width = valueRect.width; - extra.progress_bar.value_rect_height = valueRect.height; - ui::NativeTheme::instance()->Paint(canvas, ui::NativeTheme::kProgressBar, - ui::NativeTheme::kNormal, gfx_rect, - extra); -} - -WebSize WebThemeEngineImpl::getSize(int part) { - switch (part) { - case SBP_ARROWBTN: { - gfx::Size size = ui::NativeTheme::instance()->GetPartSize( - ui::NativeTheme::kScrollbarUpArrow, - ui::NativeTheme::kNormal, - ui::NativeTheme::ExtraParams()); - // GetPartSize returns a size of (0, 0) when not using a themed style - // (i.e. Windows Classic). Returning a non-zero size in this context - // creates repaint conflicts, particularly in the window titlebar area - // which significantly degrades performance. Fallback to using a system - // metric if required. - if (size.width() == 0) { - int width = static_cast<int>(GetSystemMetrics(SM_CXVSCROLL) / - ui::win::GetDeviceScaleFactor()); - size = gfx::Size(width, width); - } - return WebSize(size.width(), size.height()); - } - default: - NOTREACHED() << "Unhandled part: " << part; - } - return WebSize(); -} - -} // namespace webkit_glue diff --git a/webkit/glue/webthemeengine_impl_win.h b/webkit/glue/webthemeengine_impl_win.h deleted file mode 100644 index 8635cc8..0000000 --- a/webkit/glue/webthemeengine_impl_win.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_WIN_H_ -#define WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_WIN_H_ - -#include "third_party/WebKit/public/platform/win/WebThemeEngine.h" - -namespace webkit_glue { - -class WebThemeEngineImpl : public WebKit::WebThemeEngine { - public: - // WebThemeEngine methods: - virtual void paintButton( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect); - virtual void paintMenuList( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect); - virtual void paintScrollbarArrow( - WebKit::WebCanvas* canvas, int state, int classic_state, - const WebKit::WebRect& rect); - virtual void paintScrollbarThumb( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect); - virtual void paintScrollbarTrack( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect, const WebKit::WebRect& align_rect); - virtual void paintSpinButton( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect); - virtual void paintTextField( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect, WebKit::WebColor color, - bool fill_content_area, bool draw_edges); - virtual void paintTrackbar( - WebKit::WebCanvas* canvas, int part, int state, int classic_state, - const WebKit::WebRect& rect); - virtual void paintProgressBar( - WebKit::WebCanvas* canvas, const WebKit::WebRect& barRect, - const WebKit::WebRect& valueRect, bool determinate, - double animatedSeconds); - virtual WebKit::WebSize getSize(int part); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_WIN_H_ -- cgit v1.1