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

Side by Side Diff: third_party/WebKit/Source/core/paint/ThemePainterMac.mm

Issue 2224883002: Fix RTL rendering of SELECT on macOS and input[type=color] on all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix RTL rendering of SELECT on macOS and input[type=color] on all platforms. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google, Inc. 3 * Copyright (C) 2008, 2009 Google, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 r.y() + o.styleRef().borderTopWidth(), 253 r.y() + o.styleRef().borderTopWidth(),
254 r.width() - o.styleRef().borderLeftWidth() - o.styl eRef().borderRightWidth(), 254 r.width() - o.styleRef().borderLeftWidth() - o.styl eRef().borderRightWidth(),
255 r.height() - o.styleRef().borderTopWidth() - o.styl eRef().borderBottomWidth()); 255 r.height() - o.styleRef().borderTopWidth() - o.styl eRef().borderBottomWidth());
256 // Since we actually know the size of the control here, we restrict the font 256 // Since we actually know the size of the control here, we restrict the font
257 // scale to make sure the arrows will fit vertically in the bounds 257 // scale to make sure the arrows will fit vertically in the bounds
258 float fontScale = std::min(o.styleRef().fontSize() / LayoutThemeMac::baseFon tSize, 258 float fontScale = std::min(o.styleRef().fontSize() / LayoutThemeMac::baseFon tSize,
259 bounds.height() / (LayoutThemeMac::menuListBaseArrowHeight * 2 + LayoutT hemeMac::menuListBaseSpaceBetweenArrows)); 259 bounds.height() / (LayoutThemeMac::menuListBaseArrowHeight * 2 + LayoutT hemeMac::menuListBaseSpaceBetweenArrows));
260 float centerY = bounds.y() + bounds.height() / 2.0f; 260 float centerY = bounds.y() + bounds.height() / 2.0f;
261 float arrowHeight = LayoutThemeMac::menuListBaseArrowHeight * fontScale; 261 float arrowHeight = LayoutThemeMac::menuListBaseArrowHeight * fontScale;
262 float arrowWidth = LayoutThemeMac::menuListBaseArrowWidth * fontScale; 262 float arrowWidth = LayoutThemeMac::menuListBaseArrowWidth * fontScale;
263 float leftEdge = bounds.maxX() - LayoutThemeMac::menuListArrowPaddingRight * o.styleRef().effectiveZoom() - arrowWidth;
264 float spaceBetweenArrows = LayoutThemeMac::menuListBaseSpaceBetweenArrows * fontScale; 263 float spaceBetweenArrows = LayoutThemeMac::menuListBaseSpaceBetweenArrows * fontScale;
265 264 float scaledPaddingEnd = LayoutThemeMac::menuListArrowPaddingEnd * o.styleRe f().effectiveZoom();
266 if (bounds.width() < arrowWidth + LayoutThemeMac::menuListArrowPaddingLeft * o.styleRef().effectiveZoom()) 265 float leftEdge;
266 if (o.styleRef().direction() == LTR) {
267 leftEdge = bounds.maxX() - scaledPaddingEnd - arrowWidth;
268 } else {
269 leftEdge = bounds.x() + scaledPaddingEnd;
270 }
271 if (bounds.width() < arrowWidth + scaledPaddingEnd)
267 return false; 272 return false;
268 273
269 Color color = o.styleRef().visitedDependentColor(CSSPropertyColor); 274 Color color = o.styleRef().visitedDependentColor(CSSPropertyColor);
270 SkPaint paint = paintInfo.context.fillPaint(); 275 SkPaint paint = paintInfo.context.fillPaint();
271 paint.setAntiAlias(true); 276 paint.setAntiAlias(true);
272 paint.setColor(color.rgb()); 277 paint.setColor(color.rgb());
273 278
274 SkPath arrow1; 279 SkPath arrow1;
275 arrow1.moveTo(leftEdge, centerY - spaceBetweenArrows / 2.0f); 280 arrow1.moveTo(leftEdge, centerY - spaceBetweenArrows / 2.0f);
276 arrow1.lineTo(leftEdge + arrowWidth, centerY - spaceBetweenArrows / 2.0f); 281 arrow1.lineTo(leftEdge + arrowWidth, centerY - spaceBetweenArrows / 2.0f);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 paintInfo.context.rotate(deg2rad(-45.0)); 548 paintInfo.context.rotate(deg2rad(-45.0));
544 paintInfo.context.translate(-centerX, -centerY); 549 paintInfo.context.translate(-centerX, -centerY);
545 550
546 paintInfo.context.setFillColor(fillColor); 551 paintInfo.context.setFillColor(fillColor);
547 paintInfo.context.fillEllipse(unzoomedRect); 552 paintInfo.context.fillEllipse(unzoomedRect);
548 553
549 return false; 554 return false;
550 } 555 }
551 556
552 } // namespace blink 557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698