diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 01:01:17 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 01:01:17 +0000 |
commit | e1151e9dcd127f075623d67935d80c1115b682e5 (patch) | |
tree | 461be45bcd2f777e9781c736e4121d5fb9f52a4d /webkit/tools/test_shell/test_shell_webthemecontrol.cc | |
parent | 6222bee655845e6e4573fa7408014075d80947f2 (diff) | |
download | chromium_src-e1151e9dcd127f075623d67935d80c1115b682e5.zip chromium_src-e1151e9dcd127f075623d67935d80c1115b682e5.tar.gz chromium_src-e1151e9dcd127f075623d67935d80c1115b682e5.tar.bz2 |
Test shell: Fix Windows custom render theme so that checkboxes and radio buttons are drawn at a fixed size (13x13).
This matches system windows themes.
Also add expectations.
BUG=32307
TEST=fast/css/non-standard-checkbox-size.html
Review URL: http://codereview.chromium.org/565045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_shell_webthemecontrol.cc')
-rw-r--r-- | webkit/tools/test_shell/test_shell_webthemecontrol.cc | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/webkit/tools/test_shell/test_shell_webthemecontrol.cc b/webkit/tools/test_shell/test_shell_webthemecontrol.cc index f3071c1..742a295 100644 --- a/webkit/tools/test_shell/test_shell_webthemecontrol.cc +++ b/webkit/tools/test_shell/test_shell_webthemecontrol.cc @@ -33,18 +33,38 @@ const SkColor kBgColors[] = { SkColorSetRGB(0xa9, 0xff, 0x12) // Pressed }; +SkIRect Validate(const SkIRect& rect, Control::Type ctype) { + SkIRect retval = rect; + if (ctype == Control::kUncheckedBox_Type || + ctype == Control::kCheckedBox_Type || + ctype == Control::kUncheckedRadio_Type || + ctype == Control::kCheckedRadio_Type) { + // The maximum width and height is 13. Center the square in the passed + // rectangle. + const int kMaxControlSize = 13; + int control_size = std::min(rect.width(), rect.height()); + control_size = std::min(control_size, kMaxControlSize); + + retval.fLeft = rect.fLeft + (rect.width() / 2) - (control_size / 2); + retval.fRight = retval.fLeft + control_size - 1; + retval.fTop = rect.fTop + (rect.height() / 2) - (control_size / 2); + retval.fBottom = retval.fTop + control_size - 1; + } + return retval; +} + Control::Control(skia::PlatformCanvas *canvas, const SkIRect &irect, Type ctype, State cstate) : canvas_(canvas), - irect_(irect), + irect_(Validate(irect, ctype)), type_(ctype), state_(cstate), - left_(irect.fLeft), - right_(irect.fRight), - top_(irect.fTop), - bottom_(irect.fBottom), - height_(irect.height()), - width_(irect.width()), + left_(irect_.fLeft), + right_(irect_.fRight), + top_(irect_.fTop), + bottom_(irect_.fBottom), + height_(irect_.height()), + width_(irect_.width()), edge_color_(kEdgeColor), bg_color_(kBgColors[cstate]), fg_color_(kFgColor) { |