Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp

Issue 2340633002: Modifies logic for computing drop down menu arrow's dimensions and how it is drawn. (Closed)
Patch Set: Modifies logic for computing drop down menu arrow's dimensions and how it is drawn. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
diff --git a/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp b/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
index a135ca7abb8d42bd35bb38473458c5b827d1aebd..63d90258608c3141f32305742ec1d607a04b80d5 100644
--- a/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
+++ b/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
@@ -42,6 +42,7 @@ namespace blink {
namespace {
const unsigned defaultButtonBackgroundColor = 0xffdddddd;
+const unsigned dropdownMenuListArrowPadding = 3;
bool useMockTheme()
{
@@ -262,11 +263,13 @@ void ThemePainterDefault::setupMenuListArrow(const LayoutBox& box, const IntRect
if (useMockTheme()) {
// The size and position of the drop-down button is different between
// the mock theme and the regular aura theme.
- int spacingTop = (box.borderTop() + box.paddingTop()).toInt();
- int spacingBottom = (box.borderBottom() + box.paddingBottom()).toInt();
- int spacingRight = (box.borderRight() + box.paddingRight()).toInt();
- extraParams.menuList.arrowX = (box.styleRef().direction() == RTL) ? rect.x() + 4 + spacingRight: right - 10 - spacingRight;
- extraParams.menuList.arrowSize = rect.height() - spacingBottom - spacingTop;
+ int extraPadding = dropdownMenuListArrowPadding * box.styleRef().effectiveZoom();
+ // The width available for the arrow is based on the padding provided
+ // in the child LayoutBox.
+ int arrowBoxWidth = ((box.styleRef().direction() == RTL) ? box.firstChildBox()->paddingLeft() : box.firstChildBox()->paddingRight()).toInt();
+ int arrowSize = std::min(arrowBoxWidth, rect.height()) - 2 * extraPadding;
+ extraParams.menuList.arrowX = (box.styleRef().direction() == RTL) ? rect.x() + extraPadding + (arrowSize / 2) : right - (arrowSize / 2) - extraPadding;
+ extraParams.menuList.arrowSize = arrowSize;
} else {
const int arrowSize = 6;
const int arrowPadding = 6;

Powered by Google App Engine
This is Rietveld 408576698