diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 18:21:08 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 18:21:08 +0000 |
commit | a12f7fbe12afffb4b1b31ec0d6b0988f1f9a6554 (patch) | |
tree | 09b9fafb2e1d1ce9acb0307aa5689d6cfe72a0ef /webkit | |
parent | f224f15fb2d55747c3faf6e5e304c2eebcca12ab (diff) | |
download | chromium_src-a12f7fbe12afffb4b1b31ec0d6b0988f1f9a6554.zip chromium_src-a12f7fbe12afffb4b1b31ec0d6b0988f1f9a6554.tar.gz chromium_src-a12f7fbe12afffb4b1b31ec0d6b0988f1f9a6554.tar.bz2 |
Move more web widgets painting from webkit to chrome.
- Move linux web widgets painting code from webkit;
- Move dependent resources from webkit_resources into gfx_resources and
follow the pattern in net package to add resource loading support to
gfx package;
- Update ChromeOS theme engine to follow mocks in chromium-os:9256.
BUG=chromium-os:9256
TEST=Verify default web widgets has desired look on ChromeOS.
Review URL: http://codereview.chromium.org/6254004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webthemeengine_impl_linux.cc | 100 | ||||
-rw-r--r-- | webkit/support/platform_support_gtk.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 9 |
8 files changed, 113 insertions, 27 deletions
diff --git a/webkit/glue/webthemeengine_impl_linux.cc b/webkit/glue/webthemeengine_impl_linux.cc index 518166e..067b203 100644 --- a/webkit/glue/webthemeengine_impl_linux.cc +++ b/webkit/glue/webthemeengine_impl_linux.cc @@ -38,6 +38,24 @@ static gfx::NativeThemeLinux::Part NativeThemePart( return gfx::NativeThemeLinux::kScrollbarHorizontalTrack; case WebKit::WebThemeEngine::PartScrollbarVerticalTrack: return gfx::NativeThemeLinux::kScrollbarVerticalTrack; + case WebKit::WebThemeEngine::PartCheckbox: + return gfx::NativeThemeLinux::kCheckbox; + case WebKit::WebThemeEngine::PartRadio: + return gfx::NativeThemeLinux::kRadio; + case WebKit::WebThemeEngine::PartButton: + return gfx::NativeThemeLinux::kPushButton; + case WebKit::WebThemeEngine::PartTextField: + return gfx::NativeThemeLinux::kTextField; + case WebKit::WebThemeEngine::PartMenuList: + return gfx::NativeThemeLinux::kMenuList; + case WebKit::WebThemeEngine::PartSliderTrack: + return gfx::NativeThemeLinux::kSliderTrack; + case WebKit::WebThemeEngine::PartSliderThumb: + return gfx::NativeThemeLinux::kSliderThumb; + case WebKit::WebThemeEngine::PartInnerSpinButton: + return gfx::NativeThemeLinux::kInnerSpinButton; + case WebKit::WebThemeEngine::PartProgressBar: + return gfx::NativeThemeLinux::kProgressBar; default: return gfx::NativeThemeLinux::kScrollbarDownArrow; } @@ -49,7 +67,7 @@ static gfx::NativeThemeLinux::State NativeThemeState( case WebKit::WebThemeEngine::StateDisabled: return gfx::NativeThemeLinux::kDisabled; case WebKit::WebThemeEngine::StateHover: - return gfx::NativeThemeLinux::kHover; + return gfx::NativeThemeLinux::kHovered; case WebKit::WebThemeEngine::StateNormal: return gfx::NativeThemeLinux::kNormal; case WebKit::WebThemeEngine::StatePressed: @@ -64,21 +82,79 @@ static void GetNativeThemeExtraParams( WebKit::WebThemeEngine::State state, const WebKit::WebThemeEngine::ExtraParams* extra_params, gfx::NativeThemeLinux::ExtraParams* native_theme_extra_params) { - if (part == WebKit::WebThemeEngine::PartScrollbarHorizontalTrack || - part == WebKit::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; + switch (part) { + case WebKit::WebThemeEngine::PartScrollbarHorizontalTrack: + case WebKit::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 WebKit::WebThemeEngine::PartCheckbox: + native_theme_extra_params->button.checked = extra_params->button.checked; + native_theme_extra_params->button.indeterminate = + extra_params->button.indeterminate; + break; + case WebKit::WebThemeEngine::PartRadio: + native_theme_extra_params->button.checked = extra_params->button.checked; + break; + case WebKit::WebThemeEngine::PartButton: + native_theme_extra_params->button.is_default = + extra_params->button.isDefault; + native_theme_extra_params->button.background_color = + extra_params->button.backgroundColor; + break; + case WebKit::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 WebKit::WebThemeEngine::PartMenuList: + 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 WebKit::WebThemeEngine::PartSliderTrack: + case WebKit::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 WebKit::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 WebKit::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(WebKit::WebThemeEngine::Part part) { - return gfx::NativeThemeLinux::instance()->GetSize(NativeThemePart(part)); + return gfx::NativeThemeLinux::instance()->GetPartSize(NativeThemePart(part)); } void WebThemeEngineImpl::paint( diff --git a/webkit/support/platform_support_gtk.cc b/webkit/support/platform_support_gtk.cc index 2ab9627..4defd31 100644 --- a/webkit/support/platform_support_gtk.cc +++ b/webkit/support/platform_support_gtk.cc @@ -11,6 +11,7 @@ #include "base/path_service.h" #include "base/string16.h" #include "base/string_piece.h" +#include "gfx/gfx_module.h" #include "grit/webkit_resources.h" namespace { @@ -18,6 +19,13 @@ namespace { // Data resources on linux. This is a pointer to the mmapped resources file. app::DataPack* g_resource_data_pack = NULL; +base::StringPiece TestResourceProvider(int resource_id) { + base::StringPiece res; + if (g_resource_data_pack) + g_resource_data_pack->GetStringPiece(resource_id, &res); + return res; +} + } namespace webkit_support { @@ -37,6 +45,9 @@ void AfterInitialize(bool unit_test_mode) { data_path = data_path.Append("DumpRenderTree.pak"); if (!g_resource_data_pack->Load(data_path)) LOG(FATAL) << "failed to load DumpRenderTree.pak"; + + // Config the modules that need access to a limited set of resources. + gfx::GfxModule::SetResourceProvider(TestResourceProvider); } void BeforeShutdown() { diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index e20e687..93fb40e 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -176,6 +176,7 @@ 'action_name': 'test_shell_repack', 'variables': { 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/gfx/gfx_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/test_shell/test_shell_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', @@ -331,6 +332,7 @@ ], }, { # OS != "mac" 'dependencies': [ + '<(DEPTH)/gfx/gfx.gyp:gfx_resources', '<(DEPTH)/net/net.gyp:net_resources', '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_resources', '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_strings', diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 9da615b..a3e441f 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -360,8 +360,8 @@ public: // Show the "attach to me" dialog, for debugging test shell startup. static void ShowStartupDebuggingDialog(); - // This is called indirectly by the network layer to access resources. - static base::StringPiece NetResourceProvider(int key); + // This is called indirectly by the modules that need access resources. + static base::StringPiece ResourceProvider(int key); TestShellDevToolsAgent* dev_tools_agent() { return dev_tools_agent_.get(); diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 4a04610..7c9b0cc 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -626,7 +626,7 @@ void TestShell::ShowStartupDebuggingDialog() { } // static -base::StringPiece TestShell::NetResourceProvider(int key) { +base::StringPiece TestShell::ResourceProvider(int key) { base::StringPiece res; g_resource_data_pack->GetStringPiece(key, &res); return res; @@ -655,7 +655,7 @@ base::StringPiece GetDataResource(int resource_id) { resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; break; } - return TestShell::NetResourceProvider(resource_id); + return TestShell::ResourceProvider(resource_id); } } // namespace webkit_glue diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index f669663..9378bea 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -654,7 +654,7 @@ void TestShell::ShowStartupDebuggingDialog() { [alert runModal]; } -base::StringPiece TestShell::NetResourceProvider(int key) { +base::StringPiece TestShell::ResourceProvider(int key) { base::StringPiece res; g_resource_data_pack->GetStringPiece(key, &res); return res; @@ -721,7 +721,7 @@ base::StringPiece GetDataResource(int resource_id) { case IDR_INPUT_SPEECH: case IDR_INPUT_SPEECH_RECORDING: case IDR_INPUT_SPEECH_WAITING: - return TestShell::NetResourceProvider(resource_id); + return TestShell::ResourceProvider(resource_id); default: break; diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 7f8dfab..916986f 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -22,6 +22,7 @@ #include "base/string_number_conversions.h" #include "base/sys_info.h" #include "base/utf_string_conversions.h" +#include "gfx/gfx_module.h" #include "net/base/cookie_monster.h" #include "net/base/net_module.h" #include "net/base/net_util.h" @@ -202,8 +203,9 @@ int main(int argc, char* argv[]) { // Load ICU data tables icu_util::Initialize(); - // Config the network module so it has access to a limited set of resources. - net::NetModule::SetResourceProvider(TestShell::NetResourceProvider); + // Config the modules that need access to a limited set of resources. + net::NetModule::SetResourceProvider(TestShell::ResourceProvider); + gfx::GfxModule::SetResourceProvider(TestShell::ResourceProvider); platform.InitializeGUI(); diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index b235981..a7c4d94 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -138,11 +138,6 @@ static base::StringPiece GetRawDataResource(HMODULE module, int resource_id) { : base::StringPiece(); } -// This is called indirectly by the network layer to access resources. -base::StringPiece NetResourceProvider(int key) { - return GetRawDataResource(::GetModuleHandle(NULL), key); -} - } // namespace // Initialize static member variable @@ -739,7 +734,7 @@ void TestShell::ShowStartupDebuggingDialog() { } // static -base::StringPiece TestShell::NetResourceProvider(int key) { +base::StringPiece TestShell::ResourceProvider(int key) { return GetRawDataResource(::GetModuleHandle(NULL), key); } @@ -806,7 +801,7 @@ base::StringPiece GetDataResource(int resource_id) { case IDR_INPUT_SPEECH: case IDR_INPUT_SPEECH_RECORDING: case IDR_INPUT_SPEECH_WAITING: - return NetResourceProvider(resource_id); + return TestShell::ResourceProvider(resource_id); default: break; |