diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 00:03:25 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 00:03:25 +0000 |
commit | 723c89891d26c497afc8ba9b6316d06819d38a52 (patch) | |
tree | 4a2cc473c05353820e254b50bf55aae47c0d1faa | |
parent | d19c6c3c2ad3cbadb0ef60236613cbc0cb4ef00a (diff) | |
download | chromium_src-723c89891d26c497afc8ba9b6316d06819d38a52.zip chromium_src-723c89891d26c497afc8ba9b6316d06819d38a52.tar.gz chromium_src-723c89891d26c497afc8ba9b6316d06819d38a52.tar.bz2 |
Fix vertical range slider.
BUG=88017
TEST=Load a web page that should display a vertical slider and make sure it
appears vertical and correctly instead of horizonatally. Note that the
thumb part appears too far to the right; I have confirmed this on all platforms
(win,linux,mac). Since bug was was about a windows specific rendering issue,
I have opened another bug (89616) to keep track of the right offset.
Review URL: http://codereview.chromium.org/7400024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92927 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/gfx/native_theme.h | 1 | ||||
-rw-r--r-- | ui/gfx/native_theme_win.cc | 3 | ||||
-rw-r--r-- | webkit/glue/webthemeengine_impl_win.cc | 29 |
3 files changed, 29 insertions, 4 deletions
diff --git a/ui/gfx/native_theme.h b/ui/gfx/native_theme.h index 665b78e..2f1ba70 100644 --- a/ui/gfx/native_theme.h +++ b/ui/gfx/native_theme.h @@ -172,6 +172,7 @@ class UI_API NativeTheme { }; struct TrackbarExtraParams { + bool vertical; int classic_state; // Used on Windows when uxtheme is not available. }; diff --git a/ui/gfx/native_theme_win.cc b/ui/gfx/native_theme_win.cc index 29e1faf..1fade35 100644 --- a/ui/gfx/native_theme_win.cc +++ b/ui/gfx/native_theme_win.cc @@ -931,6 +931,9 @@ HRESULT NativeThemeWin::PaintTrackbar( const gfx::Rect& rect, const TrackbarExtraParams& extra) const { int part_id = part == kTrackbarTrack ? TKP_TRACK : TKP_THUMBBOTTOM; + if (extra.vertical) + part_id = part == kTrackbarTrack ? TKP_TRACKVERT : TKP_THUMBVERT; + int state_id = 0; switch(state) { case kDisabled: diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc index abbfa1f..7a39649 100644 --- a/webkit/glue/webthemeengine_impl_win.cc +++ b/webkit/glue/webthemeengine_impl_win.cc @@ -895,7 +895,10 @@ void WebThemeEngineImpl::paintTextField( gfx::NativeTheme::kTextField, native_state, gfx_rect, extra); } -static gfx::NativeTheme::State WebTrackbarStateToGfx(int part, int state) { +static gfx::NativeTheme::State WebTrackbarStateToGfx( + int part, + int state, + gfx::NativeTheme::TrackbarExtraParams* extra) { gfx::NativeTheme::State gfx_state = gfx::NativeTheme::kNormal; switch (state) { case TUS_NORMAL: @@ -914,6 +917,21 @@ static gfx::NativeTheme::State WebTrackbarStateToGfx(int part, int state) { 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; } @@ -923,9 +941,11 @@ void WebThemeEngineImpl::paintTrackbar( gfx::NativeTheme::Part native_part = gfx::NativeTheme::kTrackbarTrack; switch (part) { case TKP_TRACK: + case TKP_TRACKVERT: native_part = gfx::NativeTheme::kTrackbarTrack; break; case TKP_THUMBBOTTOM: + case TKP_THUMBVERT: native_part = gfx::NativeTheme::kTrackbarThumb; break; default: @@ -933,10 +953,11 @@ void WebThemeEngineImpl::paintTrackbar( break; } - gfx::NativeTheme::State native_state = WebTrackbarStateToGfx(part, state); - gfx::Rect gfx_rect(rect.x, rect.y, rect.width, rect.height); gfx::NativeTheme::ExtraParams extra; - extra.button.classic_state = classic_state; + gfx::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; gfx::NativeTheme::instance()->Paint(canvas, native_part, native_state, gfx_rect, extra); } |