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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp

Issue 2224063003: LayoutTheme: Clean up popupInternalPadding* functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/layout/LayoutThemeDefault.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp
index 4e581c6e04339fdbcbc4696b20800905e8c4b9de..18b4856241a24adea6b7cdd41fab5121f948679c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp
@@ -37,15 +37,6 @@
namespace blink {
-enum PaddingType {
- TopPadding,
- RightPadding,
- BottomPadding,
- LeftPadding
-};
-
-static const int styledMenuListInternalPadding[4] = { 1, 4, 1, 4 };
-
// These values all match Safari/Win.
static const float defaultControlFontPixelSize = 13;
static const float defaultCancelButtonSize = 9;
@@ -340,24 +331,27 @@ void LayoutThemeDefault::adjustMenuListButtonStyle(ComputedStyle& style, Element
adjustMenuListStyle(style, e);
}
-int LayoutThemeDefault::popupInternalPaddingLeft(const ComputedStyle& style) const
+// The following internal paddings are in addition to the user-supplied padding.
+// Matches the Firefox behavior.
+
+int LayoutThemeDefault::popupInternalPaddingStart(const ComputedStyle& style) const
{
- return menuListInternalPadding(style, LeftPadding);
+ return menuListInternalPadding(style, 4);
}
-int LayoutThemeDefault::popupInternalPaddingRight(const ComputedStyle& style) const
+int LayoutThemeDefault::popupInternalPaddingEnd(const ComputedStyle& style) const
{
- return menuListInternalPadding(style, RightPadding);
+ return menuListInternalPadding(style, 4 + menuListArrowPaddingSize);
}
int LayoutThemeDefault::popupInternalPaddingTop(const ComputedStyle& style) const
{
- return menuListInternalPadding(style, TopPadding);
+ return menuListInternalPadding(style, 1);
}
int LayoutThemeDefault::popupInternalPaddingBottom(const ComputedStyle& style) const
{
- return menuListInternalPadding(style, BottomPadding);
+ return menuListInternalPadding(style, 1);
}
// static
@@ -366,21 +360,10 @@ void LayoutThemeDefault::setDefaultFontSize(int fontSize)
LayoutThemeFontProvider::setDefaultFontSize(fontSize);
}
-int LayoutThemeDefault::menuListInternalPadding(const ComputedStyle& style, int paddingType) const
+int LayoutThemeDefault::menuListInternalPadding(const ComputedStyle& style, int padding) const
{
if (style.appearance() == NoControlPart)
return 0;
- // This internal padding is in addition to the user-supplied padding.
- // Matches the FF behavior.
- int padding = styledMenuListInternalPadding[paddingType];
-
- // Reserve the space for right arrow here. The rest of the padding is
- // set by adjustMenuListStyle, since PopMenuWin.cpp uses the padding from
- // LayoutMenuList to lay out the individual items in the popup.
- const int barType = style.direction() == LTR ? RightPadding : LeftPadding;
- if (paddingType == barType)
- padding += menuListArrowPaddingSize;
-
return padding * style.effectiveZoom();
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutThemeDefault.h ('k') | third_party/WebKit/Source/core/layout/LayoutThemeMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698