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

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

Issue 2359753003: Security fix while computing dropdown menu arrow width (Closed)
Patch Set: Updated test expectations 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63d90258608c3141f32305742ec1d607a04b80d5..c93382b273c77ec672689989340c0634fad83b4d 100644
--- a/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
+++ b/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
@@ -42,7 +42,10 @@ namespace blink {
namespace {
const unsigned defaultButtonBackgroundColor = 0xffdddddd;
-const unsigned dropdownMenuListArrowPadding = 3;
+const unsigned mockDropdownMenuListArrowPadding = 3;
+// This is equal to the padding provided by the LayoutMenuList which is
+// calculated based on |menuListArrowPaddingSize| in LayoutThemeDefault.
+const unsigned mockDropdownMenuListArrowWidth = 18;
bool useMockTheme()
{
@@ -263,10 +266,8 @@ 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 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 extraPadding = mockDropdownMenuListArrowPadding * box.styleRef().effectiveZoom();
+ int arrowBoxWidth = mockDropdownMenuListArrowWidth * box.styleRef().effectiveZoom();
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;
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698