| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /* |
| 6 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 7 * |
| 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions are |
| 10 * met: |
| 11 * |
| 12 * * Redistributions of source code must retain the above copyright |
| 13 * notice, this list of conditions and the following disclaimer. |
| 14 * * Redistributions in binary form must reproduce the above |
| 15 * copyright notice, this list of conditions and the following disclaimer |
| 16 * in the documentation and/or other materials provided with the |
| 17 * distribution. |
| 18 * * Neither the name of Google Inc. nor the names of its |
| 19 * contributors may be used to endorse or promote products derived from |
| 20 * this software without specific prior written permission. |
| 21 * |
| 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 */ |
| 34 |
| 35 #include "content/test/layout_tests/runner/WebTestThemeEngineWin.h" |
| 36 |
| 37 #include "content/test/layout_tests/runner/TestCommon.h" |
| 38 #include "content/test/layout_tests/runner/WebTestThemeControlWin.h" |
| 39 #include "third_party/skia/include/core/SkRect.h" |
| 40 #include "third_party/WebKit/public/platform/WebRect.h" |
| 41 |
| 42 // Although all this code is generic, we include these headers |
| 43 // to pull in the Windows #defines for the parts and states of |
| 44 // the controls. |
| 45 #include <vsstyle.h> |
| 46 #include <windows.h> |
| 47 |
| 48 using namespace blink; |
| 49 |
| 50 namespace WebTestRunner { |
| 51 |
| 52 namespace { |
| 53 |
| 54 // We define this for clarity, although there really should be a DFCS_NORMAL in
winuser.h. |
| 55 const int dfcsNormal = 0x0000; |
| 56 |
| 57 SkIRect webRectToSkIRect(const WebRect& webRect) |
| 58 { |
| 59 SkIRect irect; |
| 60 irect.set(webRect.x, webRect.y, webRect.x + webRect.width - 1, webRect.y + w
ebRect.height - 1); |
| 61 return irect; |
| 62 } |
| 63 |
| 64 void drawControl(WebCanvas* canvas, const WebRect& rect, WebTestThemeControlWin:
:Type ctype, WebTestThemeControlWin::State cstate) |
| 65 { |
| 66 WebTestThemeControlWin control(canvas, webRectToSkIRect(rect), ctype, cstate
); |
| 67 control.draw(); |
| 68 } |
| 69 |
| 70 void drawTextField(WebCanvas* canvas, const WebRect& rect, WebTestThemeControlWi
n::Type ctype, WebTestThemeControlWin::State cstate, bool drawEdges, bool fillCo
ntentArea, WebColor color) |
| 71 { |
| 72 WebTestThemeControlWin control(canvas, webRectToSkIRect(rect), ctype, cstate
); |
| 73 control.drawTextField(drawEdges, fillContentArea, color); |
| 74 } |
| 75 |
| 76 void drawProgressBar(WebCanvas* canvas, WebTestThemeControlWin::Type ctype, WebT
estThemeControlWin::State cstate, const WebRect& barRect, const WebRect& fillRec
t) |
| 77 { |
| 78 WebTestThemeControlWin control(canvas, webRectToSkIRect(barRect), ctype, cst
ate); |
| 79 control.drawProgressBar(webRectToSkIRect(fillRect)); |
| 80 } |
| 81 |
| 82 } |
| 83 |
| 84 void WebTestThemeEngineWin::paintButton(WebCanvas* canvas, int part, int state,
int classicState, const WebRect& rect) |
| 85 { |
| 86 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 87 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 88 |
| 89 if (part == BP_CHECKBOX) { |
| 90 switch (state) { |
| 91 case CBS_UNCHECKEDNORMAL: |
| 92 BLINK_ASSERT(classicState == dfcsNormal); |
| 93 ctype = WebTestThemeControlWin::UncheckedBoxType; |
| 94 cstate = WebTestThemeControlWin::NormalState; |
| 95 break; |
| 96 |
| 97 case CBS_UNCHECKEDHOT: |
| 98 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT)); |
| 99 ctype = WebTestThemeControlWin::UncheckedBoxType; |
| 100 cstate = WebTestThemeControlWin::HotState; |
| 101 break; |
| 102 |
| 103 case CBS_UNCHECKEDPRESSED: |
| 104 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED)); |
| 105 ctype = WebTestThemeControlWin::UncheckedBoxType; |
| 106 cstate = WebTestThemeControlWin::PressedState; |
| 107 break; |
| 108 |
| 109 case CBS_UNCHECKEDDISABLED: |
| 110 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE)); |
| 111 ctype = WebTestThemeControlWin::UncheckedBoxType; |
| 112 cstate = WebTestThemeControlWin::DisabledState; |
| 113 break; |
| 114 |
| 115 case CBS_CHECKEDNORMAL: |
| 116 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED)); |
| 117 ctype = WebTestThemeControlWin::CheckedBoxType; |
| 118 cstate = WebTestThemeControlWin::NormalState; |
| 119 break; |
| 120 |
| 121 case CBS_CHECKEDHOT: |
| 122 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS
_HOT)); |
| 123 ctype = WebTestThemeControlWin::CheckedBoxType; |
| 124 cstate = WebTestThemeControlWin::HotState; |
| 125 break; |
| 126 |
| 127 case CBS_CHECKEDPRESSED: |
| 128 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS
_PUSHED)); |
| 129 ctype = WebTestThemeControlWin::CheckedBoxType; |
| 130 cstate = WebTestThemeControlWin::PressedState; |
| 131 break; |
| 132 |
| 133 case CBS_CHECKEDDISABLED: |
| 134 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS
_INACTIVE)); |
| 135 ctype = WebTestThemeControlWin::CheckedBoxType; |
| 136 cstate = WebTestThemeControlWin::DisabledState; |
| 137 break; |
| 138 |
| 139 case CBS_MIXEDNORMAL: |
| 140 // Classic theme can't represent mixed state checkbox. We assume |
| 141 // it's equivalent to unchecked. |
| 142 BLINK_ASSERT(classicState == DFCS_BUTTONCHECK); |
| 143 ctype = WebTestThemeControlWin::IndeterminateCheckboxType; |
| 144 cstate = WebTestThemeControlWin::NormalState; |
| 145 break; |
| 146 |
| 147 case CBS_MIXEDHOT: |
| 148 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT)); |
| 149 ctype = WebTestThemeControlWin::IndeterminateCheckboxType; |
| 150 cstate = WebTestThemeControlWin::HotState; |
| 151 break; |
| 152 |
| 153 case CBS_MIXEDPRESSED: |
| 154 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED)); |
| 155 ctype = WebTestThemeControlWin::IndeterminateCheckboxType; |
| 156 cstate = WebTestThemeControlWin::PressedState; |
| 157 break; |
| 158 |
| 159 case CBS_MIXEDDISABLED: |
| 160 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE)); |
| 161 ctype = WebTestThemeControlWin::IndeterminateCheckboxType; |
| 162 cstate = WebTestThemeControlWin::DisabledState; |
| 163 break; |
| 164 |
| 165 default: |
| 166 BLINK_ASSERT_NOT_REACHED(); |
| 167 break; |
| 168 } |
| 169 } else if (BP_RADIOBUTTON == part) { |
| 170 switch (state) { |
| 171 case RBS_UNCHECKEDNORMAL: |
| 172 BLINK_ASSERT(classicState == DFCS_BUTTONRADIO); |
| 173 ctype = WebTestThemeControlWin::UncheckedRadioType; |
| 174 cstate = WebTestThemeControlWin::NormalState; |
| 175 break; |
| 176 |
| 177 case RBS_UNCHECKEDHOT: |
| 178 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT)); |
| 179 ctype = WebTestThemeControlWin::UncheckedRadioType; |
| 180 cstate = WebTestThemeControlWin::HotState; |
| 181 break; |
| 182 |
| 183 case RBS_UNCHECKEDPRESSED: |
| 184 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED)); |
| 185 ctype = WebTestThemeControlWin::UncheckedRadioType; |
| 186 cstate = WebTestThemeControlWin::PressedState; |
| 187 break; |
| 188 |
| 189 case RBS_UNCHECKEDDISABLED: |
| 190 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE)); |
| 191 ctype = WebTestThemeControlWin::UncheckedRadioType; |
| 192 cstate = WebTestThemeControlWin::DisabledState; |
| 193 break; |
| 194 |
| 195 case RBS_CHECKEDNORMAL: |
| 196 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED)); |
| 197 ctype = WebTestThemeControlWin::CheckedRadioType; |
| 198 cstate = WebTestThemeControlWin::NormalState; |
| 199 break; |
| 200 |
| 201 case RBS_CHECKEDHOT: |
| 202 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS
_HOT)); |
| 203 ctype = WebTestThemeControlWin::CheckedRadioType; |
| 204 cstate = WebTestThemeControlWin::HotState; |
| 205 break; |
| 206 |
| 207 case RBS_CHECKEDPRESSED: |
| 208 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS
_PUSHED)); |
| 209 ctype = WebTestThemeControlWin::CheckedRadioType; |
| 210 cstate = WebTestThemeControlWin::PressedState; |
| 211 break; |
| 212 |
| 213 case RBS_CHECKEDDISABLED: |
| 214 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS
_INACTIVE)); |
| 215 ctype = WebTestThemeControlWin::CheckedRadioType; |
| 216 cstate = WebTestThemeControlWin::DisabledState; |
| 217 break; |
| 218 |
| 219 default: |
| 220 BLINK_ASSERT_NOT_REACHED(); |
| 221 break; |
| 222 } |
| 223 } else if (BP_PUSHBUTTON == part) { |
| 224 switch (state) { |
| 225 case PBS_NORMAL: |
| 226 BLINK_ASSERT(classicState == DFCS_BUTTONPUSH); |
| 227 ctype = WebTestThemeControlWin::PushButtonType; |
| 228 cstate = WebTestThemeControlWin::NormalState; |
| 229 break; |
| 230 |
| 231 case PBS_HOT: |
| 232 BLINK_ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT)); |
| 233 ctype = WebTestThemeControlWin::PushButtonType; |
| 234 cstate = WebTestThemeControlWin::HotState; |
| 235 break; |
| 236 |
| 237 case PBS_PRESSED: |
| 238 BLINK_ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED)); |
| 239 ctype = WebTestThemeControlWin::PushButtonType; |
| 240 cstate = WebTestThemeControlWin::PressedState; |
| 241 break; |
| 242 |
| 243 case PBS_DISABLED: |
| 244 BLINK_ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE)); |
| 245 ctype = WebTestThemeControlWin::PushButtonType; |
| 246 cstate = WebTestThemeControlWin::DisabledState; |
| 247 break; |
| 248 |
| 249 case PBS_DEFAULTED: |
| 250 BLINK_ASSERT(classicState == DFCS_BUTTONPUSH); |
| 251 ctype = WebTestThemeControlWin::PushButtonType; |
| 252 cstate = WebTestThemeControlWin::FocusedState; |
| 253 break; |
| 254 |
| 255 default: |
| 256 BLINK_ASSERT_NOT_REACHED(); |
| 257 break; |
| 258 } |
| 259 } else |
| 260 BLINK_ASSERT_NOT_REACHED(); |
| 261 |
| 262 drawControl(canvas, rect, ctype, cstate); |
| 263 } |
| 264 |
| 265 void WebTestThemeEngineWin::paintMenuList(WebCanvas* canvas, int part, int state
, int classicState, const WebRect& rect) |
| 266 { |
| 267 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 268 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 269 |
| 270 if (CP_DROPDOWNBUTTON == part) { |
| 271 ctype = WebTestThemeControlWin::DropDownButtonType; |
| 272 switch (state) { |
| 273 case CBXS_NORMAL: |
| 274 BLINK_ASSERT(classicState == DFCS_MENUARROW); |
| 275 cstate = WebTestThemeControlWin::NormalState; |
| 276 break; |
| 277 |
| 278 case CBXS_HOT: |
| 279 BLINK_ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT)); |
| 280 cstate = WebTestThemeControlWin::HoverState; |
| 281 break; |
| 282 |
| 283 case CBXS_PRESSED: |
| 284 BLINK_ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED)); |
| 285 cstate = WebTestThemeControlWin::PressedState; |
| 286 break; |
| 287 |
| 288 case CBXS_DISABLED: |
| 289 BLINK_ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE)); |
| 290 cstate = WebTestThemeControlWin::DisabledState; |
| 291 break; |
| 292 |
| 293 default: |
| 294 BLINK_ASSERT_NOT_REACHED(); |
| 295 break; |
| 296 } |
| 297 } else |
| 298 BLINK_ASSERT_NOT_REACHED(); |
| 299 |
| 300 drawControl(canvas, rect, ctype, cstate); |
| 301 } |
| 302 |
| 303 void WebTestThemeEngineWin::paintScrollbarArrow(WebCanvas* canvas, int state, in
t classicState, const WebRect& rect) |
| 304 { |
| 305 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 306 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 307 |
| 308 switch (state) { |
| 309 case ABS_UPNORMAL: |
| 310 BLINK_ASSERT(classicState == DFCS_SCROLLUP); |
| 311 ctype = WebTestThemeControlWin::UpArrowType; |
| 312 cstate = WebTestThemeControlWin::NormalState; |
| 313 break; |
| 314 |
| 315 case ABS_DOWNNORMAL: |
| 316 BLINK_ASSERT(classicState == DFCS_SCROLLDOWN); |
| 317 ctype = WebTestThemeControlWin::DownArrowType; |
| 318 cstate = WebTestThemeControlWin::NormalState; |
| 319 break; |
| 320 |
| 321 case ABS_LEFTNORMAL: |
| 322 BLINK_ASSERT(classicState == DFCS_SCROLLLEFT); |
| 323 ctype = WebTestThemeControlWin::LeftArrowType; |
| 324 cstate = WebTestThemeControlWin::NormalState; |
| 325 break; |
| 326 |
| 327 case ABS_RIGHTNORMAL: |
| 328 BLINK_ASSERT(classicState == DFCS_SCROLLRIGHT); |
| 329 ctype = WebTestThemeControlWin::RightArrowType; |
| 330 cstate = WebTestThemeControlWin::NormalState; |
| 331 break; |
| 332 |
| 333 case ABS_UPHOT: |
| 334 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT)); |
| 335 ctype = WebTestThemeControlWin::UpArrowType; |
| 336 cstate = WebTestThemeControlWin::HotState; |
| 337 break; |
| 338 |
| 339 case ABS_DOWNHOT: |
| 340 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT)); |
| 341 ctype = WebTestThemeControlWin::DownArrowType; |
| 342 cstate = WebTestThemeControlWin::HotState; |
| 343 break; |
| 344 |
| 345 case ABS_LEFTHOT: |
| 346 BLINK_ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT)); |
| 347 ctype = WebTestThemeControlWin::LeftArrowType; |
| 348 cstate = WebTestThemeControlWin::HotState; |
| 349 break; |
| 350 |
| 351 case ABS_RIGHTHOT: |
| 352 BLINK_ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT)); |
| 353 ctype = WebTestThemeControlWin::RightArrowType; |
| 354 cstate = WebTestThemeControlWin::HotState; |
| 355 break; |
| 356 |
| 357 case ABS_UPHOVER: |
| 358 BLINK_ASSERT(classicState == DFCS_SCROLLUP); |
| 359 ctype = WebTestThemeControlWin::UpArrowType; |
| 360 cstate = WebTestThemeControlWin::HoverState; |
| 361 break; |
| 362 |
| 363 case ABS_DOWNHOVER: |
| 364 BLINK_ASSERT(classicState == DFCS_SCROLLDOWN); |
| 365 ctype = WebTestThemeControlWin::DownArrowType; |
| 366 cstate = WebTestThemeControlWin::HoverState; |
| 367 break; |
| 368 |
| 369 case ABS_LEFTHOVER: |
| 370 BLINK_ASSERT(classicState == DFCS_SCROLLLEFT); |
| 371 ctype = WebTestThemeControlWin::LeftArrowType; |
| 372 cstate = WebTestThemeControlWin::HoverState; |
| 373 break; |
| 374 |
| 375 case ABS_RIGHTHOVER: |
| 376 BLINK_ASSERT(classicState == DFCS_SCROLLRIGHT); |
| 377 ctype = WebTestThemeControlWin::RightArrowType; |
| 378 cstate = WebTestThemeControlWin::HoverState; |
| 379 break; |
| 380 |
| 381 case ABS_UPPRESSED: |
| 382 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT)); |
| 383 ctype = WebTestThemeControlWin::UpArrowType; |
| 384 cstate = WebTestThemeControlWin::PressedState; |
| 385 break; |
| 386 |
| 387 case ABS_DOWNPRESSED: |
| 388 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT)
); |
| 389 ctype = WebTestThemeControlWin::DownArrowType; |
| 390 cstate = WebTestThemeControlWin::PressedState; |
| 391 break; |
| 392 |
| 393 case ABS_LEFTPRESSED: |
| 394 BLINK_ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT)
); |
| 395 ctype = WebTestThemeControlWin::LeftArrowType; |
| 396 cstate = WebTestThemeControlWin::PressedState; |
| 397 break; |
| 398 |
| 399 case ABS_RIGHTPRESSED: |
| 400 BLINK_ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT
)); |
| 401 ctype = WebTestThemeControlWin::RightArrowType; |
| 402 cstate = WebTestThemeControlWin::PressedState; |
| 403 break; |
| 404 |
| 405 case ABS_UPDISABLED: |
| 406 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE)); |
| 407 ctype = WebTestThemeControlWin::UpArrowType; |
| 408 cstate = WebTestThemeControlWin::DisabledState; |
| 409 break; |
| 410 |
| 411 case ABS_DOWNDISABLED: |
| 412 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE)); |
| 413 ctype = WebTestThemeControlWin::DownArrowType; |
| 414 cstate = WebTestThemeControlWin::DisabledState; |
| 415 break; |
| 416 |
| 417 case ABS_LEFTDISABLED: |
| 418 BLINK_ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE)); |
| 419 ctype = WebTestThemeControlWin::LeftArrowType; |
| 420 cstate = WebTestThemeControlWin::DisabledState; |
| 421 break; |
| 422 |
| 423 case ABS_RIGHTDISABLED: |
| 424 BLINK_ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE)); |
| 425 ctype = WebTestThemeControlWin::RightArrowType; |
| 426 cstate = WebTestThemeControlWin::DisabledState; |
| 427 break; |
| 428 |
| 429 default: |
| 430 BLINK_ASSERT_NOT_REACHED(); |
| 431 break; |
| 432 } |
| 433 |
| 434 drawControl(canvas, rect, ctype, cstate); |
| 435 } |
| 436 |
| 437 void WebTestThemeEngineWin::paintScrollbarThumb(WebCanvas* canvas, int part, int
state, int classicState, const WebRect& rect) |
| 438 { |
| 439 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 440 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 441 |
| 442 switch (part) { |
| 443 case SBP_THUMBBTNHORZ: |
| 444 ctype = WebTestThemeControlWin::HorizontalScrollThumbType; |
| 445 break; |
| 446 |
| 447 case SBP_THUMBBTNVERT: |
| 448 ctype = WebTestThemeControlWin::VerticalScrollThumbType; |
| 449 break; |
| 450 |
| 451 case SBP_GRIPPERHORZ: |
| 452 ctype = WebTestThemeControlWin::HorizontalScrollGripType; |
| 453 break; |
| 454 |
| 455 case SBP_GRIPPERVERT: |
| 456 ctype = WebTestThemeControlWin::VerticalScrollGripType; |
| 457 break; |
| 458 |
| 459 default: |
| 460 BLINK_ASSERT_NOT_REACHED(); |
| 461 break; |
| 462 } |
| 463 |
| 464 switch (state) { |
| 465 case SCRBS_NORMAL: |
| 466 BLINK_ASSERT(classicState == dfcsNormal); |
| 467 cstate = WebTestThemeControlWin::NormalState; |
| 468 break; |
| 469 |
| 470 case SCRBS_HOT: |
| 471 BLINK_ASSERT(classicState == DFCS_HOT); |
| 472 cstate = WebTestThemeControlWin::HotState; |
| 473 break; |
| 474 |
| 475 case SCRBS_HOVER: |
| 476 BLINK_ASSERT(classicState == dfcsNormal); |
| 477 cstate = WebTestThemeControlWin::HoverState; |
| 478 break; |
| 479 |
| 480 case SCRBS_PRESSED: |
| 481 BLINK_ASSERT(classicState == dfcsNormal); |
| 482 cstate = WebTestThemeControlWin::PressedState; |
| 483 break; |
| 484 |
| 485 case SCRBS_DISABLED: |
| 486 BLINK_ASSERT_NOT_REACHED(); // This should never happen in practice. |
| 487 break; |
| 488 |
| 489 default: |
| 490 BLINK_ASSERT_NOT_REACHED(); |
| 491 break; |
| 492 } |
| 493 |
| 494 drawControl(canvas, rect, ctype, cstate); |
| 495 } |
| 496 |
| 497 void WebTestThemeEngineWin::paintScrollbarTrack(WebCanvas* canvas, int part, int
state, int classicState, const WebRect& rect, const WebRect& alignRect) |
| 498 { |
| 499 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 500 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 501 |
| 502 switch (part) { |
| 503 case SBP_UPPERTRACKHORZ: |
| 504 ctype = WebTestThemeControlWin::HorizontalScrollTrackBackType; |
| 505 break; |
| 506 |
| 507 case SBP_LOWERTRACKHORZ: |
| 508 ctype = WebTestThemeControlWin::HorizontalScrollTrackForwardType; |
| 509 break; |
| 510 |
| 511 case SBP_UPPERTRACKVERT: |
| 512 ctype = WebTestThemeControlWin::VerticalScrollTrackBackType; |
| 513 break; |
| 514 |
| 515 case SBP_LOWERTRACKVERT: |
| 516 ctype = WebTestThemeControlWin::VerticalScrollTrackForwardType; |
| 517 break; |
| 518 |
| 519 default: |
| 520 BLINK_ASSERT_NOT_REACHED(); |
| 521 break; |
| 522 } |
| 523 |
| 524 switch (state) { |
| 525 case SCRBS_NORMAL: |
| 526 BLINK_ASSERT(classicState == dfcsNormal); |
| 527 cstate = WebTestThemeControlWin::NormalState; |
| 528 break; |
| 529 |
| 530 case SCRBS_HOT: |
| 531 BLINK_ASSERT_NOT_REACHED(); // This should never happen in practice. |
| 532 break; |
| 533 |
| 534 case SCRBS_HOVER: |
| 535 BLINK_ASSERT(classicState == dfcsNormal); |
| 536 cstate = WebTestThemeControlWin::HoverState; |
| 537 break; |
| 538 |
| 539 case SCRBS_PRESSED: |
| 540 BLINK_ASSERT_NOT_REACHED(); // This should never happen in practice. |
| 541 break; |
| 542 |
| 543 case SCRBS_DISABLED: |
| 544 BLINK_ASSERT(classicState == DFCS_INACTIVE); |
| 545 cstate = WebTestThemeControlWin::DisabledState; |
| 546 break; |
| 547 |
| 548 default: |
| 549 BLINK_ASSERT_NOT_REACHED(); |
| 550 break; |
| 551 } |
| 552 |
| 553 drawControl(canvas, rect, ctype, cstate); |
| 554 } |
| 555 |
| 556 void WebTestThemeEngineWin::paintSpinButton(WebCanvas* canvas, int part, int sta
te, int classicState, const WebRect& rect) |
| 557 { |
| 558 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 559 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 560 |
| 561 if (part == SPNP_UP) { |
| 562 ctype = WebTestThemeControlWin::UpArrowType; |
| 563 switch (state) { |
| 564 case UPS_NORMAL: |
| 565 BLINK_ASSERT(classicState == DFCS_SCROLLUP); |
| 566 cstate = WebTestThemeControlWin::NormalState; |
| 567 break; |
| 568 case UPS_DISABLED: |
| 569 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE)); |
| 570 cstate = WebTestThemeControlWin::DisabledState; |
| 571 break; |
| 572 case UPS_PRESSED: |
| 573 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED)); |
| 574 cstate = WebTestThemeControlWin::PressedState; |
| 575 break; |
| 576 case UPS_HOT: |
| 577 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT)); |
| 578 cstate = WebTestThemeControlWin::HoverState; |
| 579 break; |
| 580 default: |
| 581 BLINK_ASSERT_NOT_REACHED(); |
| 582 } |
| 583 } else if (part == SPNP_DOWN) { |
| 584 ctype = WebTestThemeControlWin::DownArrowType; |
| 585 switch (state) { |
| 586 case DNS_NORMAL: |
| 587 BLINK_ASSERT(classicState == DFCS_SCROLLDOWN); |
| 588 cstate = WebTestThemeControlWin::NormalState; |
| 589 break; |
| 590 case DNS_DISABLED: |
| 591 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE)); |
| 592 cstate = WebTestThemeControlWin::DisabledState; |
| 593 break; |
| 594 case DNS_PRESSED: |
| 595 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED)); |
| 596 cstate = WebTestThemeControlWin::PressedState; |
| 597 break; |
| 598 case DNS_HOT: |
| 599 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT)); |
| 600 cstate = WebTestThemeControlWin::HoverState; |
| 601 break; |
| 602 default: |
| 603 BLINK_ASSERT_NOT_REACHED(); |
| 604 } |
| 605 } else |
| 606 BLINK_ASSERT_NOT_REACHED(); |
| 607 drawControl(canvas, rect, ctype, cstate); |
| 608 } |
| 609 |
| 610 void WebTestThemeEngineWin::paintTextField(WebCanvas* canvas, int part, int stat
e, int classicState, const WebRect& rect, WebColor color, bool fillContentArea,
bool drawEdges) |
| 611 { |
| 612 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 613 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 614 |
| 615 BLINK_ASSERT(EP_EDITTEXT == part); |
| 616 ctype = WebTestThemeControlWin::TextFieldType; |
| 617 |
| 618 switch (state) { |
| 619 case ETS_NORMAL: |
| 620 BLINK_ASSERT(classicState == dfcsNormal); |
| 621 cstate = WebTestThemeControlWin::NormalState; |
| 622 break; |
| 623 |
| 624 case ETS_HOT: |
| 625 BLINK_ASSERT(classicState == DFCS_HOT); |
| 626 cstate = WebTestThemeControlWin::HotState; |
| 627 break; |
| 628 |
| 629 case ETS_DISABLED: |
| 630 BLINK_ASSERT(classicState == DFCS_INACTIVE); |
| 631 cstate = WebTestThemeControlWin::DisabledState; |
| 632 break; |
| 633 |
| 634 case ETS_SELECTED: |
| 635 BLINK_ASSERT(classicState == DFCS_PUSHED); |
| 636 cstate = WebTestThemeControlWin::PressedState; |
| 637 break; |
| 638 |
| 639 case ETS_FOCUSED: |
| 640 BLINK_ASSERT(classicState == dfcsNormal); |
| 641 cstate = WebTestThemeControlWin::FocusedState; |
| 642 break; |
| 643 |
| 644 case ETS_READONLY: |
| 645 BLINK_ASSERT(classicState == dfcsNormal); |
| 646 cstate = WebTestThemeControlWin::ReadOnlyState; |
| 647 break; |
| 648 |
| 649 default: |
| 650 BLINK_ASSERT_NOT_REACHED(); |
| 651 break; |
| 652 } |
| 653 |
| 654 drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color
); |
| 655 } |
| 656 |
| 657 void WebTestThemeEngineWin::paintTrackbar(WebCanvas* canvas, int part, int state
, int classicState, const WebRect& rect) |
| 658 { |
| 659 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType; |
| 660 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState; |
| 661 |
| 662 if (TKP_THUMBBOTTOM == part) { |
| 663 ctype = WebTestThemeControlWin::HorizontalSliderThumbType; |
| 664 switch (state) { |
| 665 case TUS_NORMAL: |
| 666 BLINK_ASSERT(classicState == dfcsNormal); |
| 667 cstate = WebTestThemeControlWin::NormalState; |
| 668 break; |
| 669 |
| 670 case TUS_HOT: |
| 671 BLINK_ASSERT(classicState == DFCS_HOT); |
| 672 cstate = WebTestThemeControlWin::HotState; |
| 673 break; |
| 674 |
| 675 case TUS_DISABLED: |
| 676 BLINK_ASSERT(classicState == DFCS_INACTIVE); |
| 677 cstate = WebTestThemeControlWin::DisabledState; |
| 678 break; |
| 679 |
| 680 case TUS_PRESSED: |
| 681 BLINK_ASSERT(classicState == DFCS_PUSHED); |
| 682 cstate = WebTestThemeControlWin::PressedState; |
| 683 break; |
| 684 |
| 685 default: |
| 686 BLINK_ASSERT_NOT_REACHED(); |
| 687 break; |
| 688 } |
| 689 } else if (TKP_THUMBVERT == part) { |
| 690 ctype = WebTestThemeControlWin::VerticalSliderThumbType; |
| 691 switch (state) { |
| 692 case TUS_NORMAL: |
| 693 BLINK_ASSERT(classicState == dfcsNormal); |
| 694 cstate = WebTestThemeControlWin::NormalState; |
| 695 break; |
| 696 |
| 697 case TUS_HOT: |
| 698 BLINK_ASSERT(classicState == DFCS_HOT); |
| 699 cstate = WebTestThemeControlWin::HotState; |
| 700 break; |
| 701 |
| 702 case TUS_DISABLED: |
| 703 BLINK_ASSERT(classicState == DFCS_INACTIVE); |
| 704 cstate = WebTestThemeControlWin::DisabledState; |
| 705 break; |
| 706 |
| 707 case TUS_PRESSED: |
| 708 BLINK_ASSERT(classicState == DFCS_PUSHED); |
| 709 cstate = WebTestThemeControlWin::PressedState; |
| 710 break; |
| 711 |
| 712 default: |
| 713 BLINK_ASSERT_NOT_REACHED(); |
| 714 break; |
| 715 } |
| 716 } else if (TKP_TRACK == part) { |
| 717 ctype = WebTestThemeControlWin::HorizontalSliderTrackType; |
| 718 BLINK_ASSERT(state == TRS_NORMAL); |
| 719 BLINK_ASSERT(classicState == dfcsNormal); |
| 720 cstate = WebTestThemeControlWin::NormalState; |
| 721 } else if (TKP_TRACKVERT == part) { |
| 722 ctype = WebTestThemeControlWin::VerticalSliderTrackType; |
| 723 BLINK_ASSERT(state == TRVS_NORMAL); |
| 724 BLINK_ASSERT(classicState == dfcsNormal); |
| 725 cstate = WebTestThemeControlWin::NormalState; |
| 726 } else |
| 727 BLINK_ASSERT_NOT_REACHED(); |
| 728 |
| 729 drawControl(canvas, rect, ctype, cstate); |
| 730 } |
| 731 |
| 732 |
| 733 void WebTestThemeEngineWin::paintProgressBar(blink::WebCanvas* canvas, const bli
nk::WebRect& barRect, const blink::WebRect& valueRect, bool determinate, double) |
| 734 { |
| 735 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::ProgressBarType
; |
| 736 WebTestThemeControlWin::State cstate = determinate ? WebTestThemeControlWin:
:NormalState : WebTestThemeControlWin::IndeterminateState; |
| 737 drawProgressBar(canvas, ctype, cstate, barRect, valueRect); |
| 738 } |
| 739 |
| 740 |
| 741 blink::WebSize WebTestThemeEngineWin::getSize(int part) |
| 742 { |
| 743 return blink::WebSize(); |
| 744 } |
| 745 |
| 746 } |
| OLD | NEW |