Chromium Code Reviews| 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 if(irect.fLeft < extraParams->menuList.arrowX - |
| 486 irect.fLeft = extraParams->menuList.arrowX - 4; | 486 (extraParams->menuList.arrowSize + 1) / 2) |
|
oshima
2016/09/17 01:31:21
can you use std::max ?
malaykeshav
2016/09/19 18:09:27
Done
| |
| 487 if (extraParams->menuList.arrowX + 12 < irect.fRight) | 487 irect.fLeft = extraParams->menuList.arrowX - |
| 488 irect.fRight = extraParams->menuList.arrowX + 12; | 488 (extraParams->menuList.arrowSize + 1) / 2; |
| 489 if(irect.fLeft + extraParams->menuList.arrowSize < irect.fRight) | |
| 490 irect.fRight = irect.fLeft + extraParams->menuList.arrowSize; | |
|
oshima
2016/09/17 01:31:21
ditto
malaykeshav
2016/09/19 18:09:27
Done
| |
| 489 | 491 |
| 490 irect.fTop = extraParams->menuList.arrowY - | 492 irect.fTop = extraParams->menuList.arrowY - |
| 491 (extraParams->menuList.arrowSize) / 2; | 493 (extraParams->menuList.arrowSize) / 2; |
| 492 irect.fBottom = extraParams->menuList.arrowY + | 494 irect.fBottom = irect.fTop + (extraParams->menuList.arrowSize); |
| 493 (extraParams->menuList.arrowSize - 1) / 2; | 495 |
| 494 halfWidth = irect.width() / 2; | 496 halfWidth = irect.width() / 2; |
| 495 quarterWidth = irect.width() / 4; | 497 quarterWidth = irect.width() / 4; |
| 496 | 498 |
| 497 if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty? | 499 if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty? |
| 498 state = WebThemeEngine::StateNormal; | 500 state = WebThemeEngine::StateNormal; |
| 499 box(canvas, irect, bgColors(state)); | 501 box(canvas, irect, bgColors(state)); |
| 500 triangle(canvas, irect.fLeft + quarterWidth, irect.fTop, | 502 triangle(canvas, irect.fLeft + quarterWidth, irect.fTop + quarterWidth, |
| 501 irect.fRight - quarterWidth, irect.fTop, irect.fLeft + halfWidth, | 503 irect.fRight - quarterWidth, irect.fTop + quarterWidth, |
| 502 irect.fBottom, edgeColor); | 504 irect.fLeft + halfWidth, |
| 505 irect.fBottom - quarterWidth, edgeColor); | |
| 503 | 506 |
| 504 break; | 507 break; |
| 505 | 508 |
| 506 case WebThemeEngine::PartSliderTrack: { | 509 case WebThemeEngine::PartSliderTrack: { |
| 507 SkIRect lirect = irect; | 510 SkIRect lirect = irect; |
| 508 | 511 |
| 509 // Draw a narrow rect for the track plus box hatches on the ends. | 512 // Draw a narrow rect for the track plus box hatches on the ends. |
| 510 if (state == WebThemeEngine::StateFocused) // FIXME: draw differently? | 513 if (state == WebThemeEngine::StateFocused) // FIXME: draw differently? |
| 511 state = WebThemeEngine::StateNormal; | 514 state = WebThemeEngine::StateNormal; |
| 512 if (extraParams->slider.vertical) { | 515 if (extraParams->slider.vertical) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 // part? | 591 // part? |
| 589 // Unfortunately, we can't assert because we don't have access to WTF or | 592 // Unfortunately, we can't assert because we don't have access to WTF or |
| 590 // base. | 593 // base. |
| 591 break; | 594 break; |
| 592 } | 595 } |
| 593 } | 596 } |
| 594 | 597 |
| 595 } // namespace test_runner | 598 } // namespace test_runner |
| 596 | 599 |
| 597 #endif // !defined(OS_MACOSX) | 600 #endif // !defined(OS_MACOSX) |
| OLD | NEW |