OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/test_runner/mock_web_theme_engine.h" | 5 #include "components/test_runner/mock_web_theme_engine.h" |
6 | 6 |
7 #if !defined(OS_MACOSX) | 7 #if !defined(OS_MACOSX) |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (extraParams->menuList.fillContentArea) { | 475 if (extraParams->menuList.fillContentArea) { |
476 box(canvas, irect, extraParams->menuList.backgroundColor); | 476 box(canvas, irect, extraParams->menuList.backgroundColor); |
477 } else { | 477 } else { |
478 SkPaint paint; | 478 SkPaint paint; |
479 paint.setColor(edgeColor); | 479 paint.setColor(edgeColor); |
480 paint.setStyle(SkPaint::kStroke_Style); | 480 paint.setStyle(SkPaint::kStroke_Style); |
481 canvas->drawIRect(irect, paint); | 481 canvas->drawIRect(irect, paint); |
482 } | 482 } |
483 | 483 |
484 // clip the drop-down arrow to be inside the select box | 484 // clip the drop-down arrow to be inside the select box |
485 if (extraParams->menuList.arrowX - 4 > irect.fLeft) | 485 irect.fLeft = |
486 irect.fLeft = extraParams->menuList.arrowX - 4; | 486 std::max(irect.fLeft, extraParams->menuList.arrowX - |
487 if (extraParams->menuList.arrowX + 12 < irect.fRight) | 487 (extraParams->menuList.arrowSize + 1) / 2); |
488 irect.fRight = extraParams->menuList.arrowX + 12; | 488 irect.fRight = |
| 489 std::min(irect.fLeft + extraParams->menuList.arrowSize, irect.fRight); |
489 | 490 |
490 irect.fTop = extraParams->menuList.arrowY - | 491 irect.fTop = extraParams->menuList.arrowY - |
491 (extraParams->menuList.arrowSize) / 2; | 492 (extraParams->menuList.arrowSize) / 2; |
492 irect.fBottom = extraParams->menuList.arrowY + | 493 irect.fBottom = irect.fTop + (extraParams->menuList.arrowSize); |
493 (extraParams->menuList.arrowSize - 1) / 2; | 494 |
494 halfWidth = irect.width() / 2; | 495 halfWidth = irect.width() / 2; |
495 quarterWidth = irect.width() / 4; | 496 quarterWidth = irect.width() / 4; |
496 | 497 |
497 if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty? | 498 if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty? |
498 state = WebThemeEngine::StateNormal; | 499 state = WebThemeEngine::StateNormal; |
499 box(canvas, irect, bgColors(state)); | 500 box(canvas, irect, bgColors(state)); |
500 triangle(canvas, irect.fLeft + quarterWidth, irect.fTop, | 501 triangle(canvas, irect.fLeft + quarterWidth, irect.fTop + quarterWidth, |
501 irect.fRight - quarterWidth, irect.fTop, irect.fLeft + halfWidth, | 502 irect.fRight - quarterWidth, irect.fTop + quarterWidth, |
502 irect.fBottom, edgeColor); | 503 irect.fLeft + halfWidth, irect.fBottom - quarterWidth, |
| 504 edgeColor); |
503 | 505 |
504 break; | 506 break; |
505 | 507 |
506 case WebThemeEngine::PartSliderTrack: { | 508 case WebThemeEngine::PartSliderTrack: { |
507 SkIRect lirect = irect; | 509 SkIRect lirect = irect; |
508 | 510 |
509 // Draw a narrow rect for the track plus box hatches on the ends. | 511 // Draw a narrow rect for the track plus box hatches on the ends. |
510 if (state == WebThemeEngine::StateFocused) // FIXME: draw differently? | 512 if (state == WebThemeEngine::StateFocused) // FIXME: draw differently? |
511 state = WebThemeEngine::StateNormal; | 513 state = WebThemeEngine::StateNormal; |
512 if (extraParams->slider.vertical) { | 514 if (extraParams->slider.vertical) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // part? | 590 // part? |
589 // Unfortunately, we can't assert because we don't have access to WTF or | 591 // Unfortunately, we can't assert because we don't have access to WTF or |
590 // base. | 592 // base. |
591 break; | 593 break; |
592 } | 594 } |
593 } | 595 } |
594 | 596 |
595 } // namespace test_runner | 597 } // namespace test_runner |
596 | 598 |
597 #endif // !defined(OS_MACOSX) | 599 #endif // !defined(OS_MACOSX) |
OLD | NEW |