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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutThemeMac.mm

Issue 2171133003: macOS: Respect more CSS properties for menulist SELECT elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebaseline more tests Created 4 years, 5 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/platform/mac/fast/forms/select/menulist-popup-item-style-expected.txt ('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/layout/LayoutThemeMac.mm
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
index ad3fd3f4f9543077a7ab1bc78dac75c5187e1c7c..7c85b6e94ef50bab75248c9ab79e53e253ee9ed0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -111,6 +111,22 @@
namespace blink {
+namespace {
+
+bool fontSizeMatchesToControlSize(const ComputedStyle& style)
+{
+ int fontSize = style.fontSize();
+ if (fontSize == [NSFont systemFontSizeForControlSize:NSRegularControlSize])
+ return true;
+ if (fontSize == [NSFont systemFontSizeForControlSize:NSSmallControlSize])
+ return true;
+ if (fontSize == [NSFont systemFontSizeForControlSize:NSMiniControlSize])
+ return true;
+ return false;
+}
+
+} // namespace
+
using namespace HTMLNames;
LayoutThemeMac::LayoutThemeMac()
@@ -445,14 +461,22 @@ bool LayoutThemeMac::isControlStyled(const ComputedStyle& style) const
if (style.appearance() == TextFieldPart || style.appearance() == TextAreaPart)
return style.hasAuthorBorder() || style.boxShadow();
- // FIXME: This is horrible, but there is not much else that can be done.
- // Menu lists cannot draw properly when scaled. They can't really draw
- // properly when transformed either. We can't detect the transform case at
- // style adjustment time so that will just have to stay broken. We can
- // however detect that we're zooming. If zooming is in effect we treat it
- // like the control is styled.
- if (style.appearance() == MenulistPart && style.effectiveZoom() != 1.0f)
- return true;
+ if (style.appearance() == MenulistPart) {
+ // FIXME: This is horrible, but there is not much else that can be done.
+ // Menu lists cannot draw properly when scaled. They can't really draw
+ // properly when transformed either. We can't detect the transform case
+ // at style adjustment time so that will just have to stay broken. We
+ // can however detect that we're zooming. If zooming is in effect we
+ // treat it like the control is styled.
+ if (style.effectiveZoom() != 1.0f)
+ return true;
+ if (!fontSizeMatchesToControlSize(style))
+ return true;
+ if (style.getFontDescription().family().family() != "BlinkMacSystemFont")
+ return true;
+ if (!style.height().isIntrinsicOrAuto())
+ return true;
+ }
// Some other cells don't work well when scaled.
if (style.effectiveZoom() != 1) {
switch (style.appearance()) {
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-popup-item-style-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698