WebKit Bugzilla
Attachment 342671 Details for
Bug 186577
: Input form controls have white background in dark mode when they should not
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186577-20180613100751.patch (text/plain), 12.85 KB, created by
Timothy Hatcher
on 2018-06-13 10:07:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2018-06-13 10:07:51 PDT
Size:
12.85 KB
patch
obsolete
>Subversion Revision: 232726 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c8e099d1e235fec314a27af5cba310fa4e4ae4e2..b399c30b231d2a45046119f685ea82249f43912a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-06-12 Timothy Hatcher <timothy@apple.com> >+ >+ Input form controls have a white background in dark mode, when they should not. >+ >+ https://bugs.webkit.org/show_bug.cgi?id=186577 >+ rdar://problem/39258325 >+ >+ Reviewed by Tim Horton. >+ >+ * DerivedSources.make: Allow WTF_PLATFORM_MAC ifdefs to preprocess in html.css. >+ * css/CSSValueKeywords.in: Added -apple-system-control-background. >+ * css/MediaQueryExpression.cpp: >+ (WebCore::featureWithValidIdent): Allow dark mode media query in user agent stylesheets. >+ (WebCore::isFeatureValidWithoutValue): Ditto. >+ * css/MediaQueryParserContext.cpp: >+ (WebCore::MediaQueryParserContext::MediaQueryParserContext): Transfer the CSSParserMode from CSSParserContext. >+ * css/MediaQueryParserContext.h: >+ * css/html.css: Set color and background-color to semantic colors for input, textarea, and select. >+ Make input background-color transparent in dark mode to match AppKit. >+ * rendering/RenderThemeMac.mm: >+ (WebCore::RenderThemeMac::systemColor const): Added -apple-system-control-background. >+ (WebCore::RenderThemeMac::paintTextField): Adjust the drawing rect to match new artwork in macOS 10.14. >+ > 2018-06-11 Chris Dumez <cdumez@apple.com> > > Crash under com.apple.WebKit.Networking at WebCore: WebCore::NetworkStorageSession::hasStorageAccess const >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 262e0c7cbb1d4682423ca187b9ef2abbf309084b..cddfdcd749fa709118438c9cbafec39401b80f3f 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -1023,6 +1023,12 @@ else > WTF_PLATFORM_IOS = 0 > endif > >+ifeq ($(shell $(CC) -std=gnu++17 -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_MAC ' | cut -d' ' -f3), 1) >+ WTF_PLATFORM_MAC = 1 >+else >+ WTF_PLATFORM_MAC = 0 >+endif >+ > ifeq ($(shell $(CC) -std=gnu++17 -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep USE_APPLE_INTERNAL_SDK | cut -d' ' -f3), 1) > USE_APPLE_INTERNAL_SDK = 1 > else >@@ -1035,6 +1041,8 @@ endif > > ifeq ($(WTF_PLATFORM_IOS), 1) > FEATURE_AND_PLATFORM_DEFINES = $(FEATURE_DEFINES) WTF_PLATFORM_IOS >+else ifeq ($(WTF_PLATFORM_MAC), 1) >+FEATURE_AND_PLATFORM_DEFINES = $(FEATURE_DEFINES) WTF_PLATFORM_MAC > else > FEATURE_AND_PLATFORM_DEFINES = $(FEATURE_DEFINES) > endif >diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in >index d45856206ab29fc879f9ee3ef3ffe1651c1d418e..69359fccd4be71c14e441376e20953fa299fa006 100644 >--- a/Source/WebCore/css/CSSValueKeywords.in >+++ b/Source/WebCore/css/CSSValueKeywords.in >@@ -224,6 +224,7 @@ windowframe > windowtext > -apple-system-header-text > -apple-system-text-background >+-apple-system-control-background > -apple-system-alternate-selected-text > -apple-system-label > -apple-system-secondary-label >diff --git a/Source/WebCore/css/MediaQueryExpression.cpp b/Source/WebCore/css/MediaQueryExpression.cpp >index d553392f9491cf067fe0541a6f7386dca11243b7..617cb6a0cd0239a4f0dafd037b4dc367ada143fa 100644 >--- a/Source/WebCore/css/MediaQueryExpression.cpp >+++ b/Source/WebCore/css/MediaQueryExpression.cpp >@@ -54,7 +54,7 @@ static inline bool featureWithValidIdent(const AtomicString& mediaFeature, const > || mediaFeature == MediaFeatureNames::displayMode > #endif > || mediaFeature == MediaFeatureNames::prefersReducedMotion >- || (mediaFeature == MediaFeatureNames::prefersDarkInterface && context.useSystemAppearance); >+ || (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode))); > } > > static inline bool featureWithValidDensity(const String& mediaFeature, const CSSPrimitiveValue& value) >@@ -162,7 +162,7 @@ static inline bool isFeatureValidWithoutValue(const AtomicString& mediaFeature, > || mediaFeature == MediaFeatureNames::invertedColors > || mediaFeature == MediaFeatureNames::pointer > || mediaFeature == MediaFeatureNames::prefersReducedMotion >- || (mediaFeature == MediaFeatureNames::prefersDarkInterface && context.useSystemAppearance) >+ || (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode))) > || mediaFeature == MediaFeatureNames::devicePixelRatio > || mediaFeature == MediaFeatureNames::resolution > #if ENABLE(APPLICATION_MANIFEST) >diff --git a/Source/WebCore/css/MediaQueryParserContext.cpp b/Source/WebCore/css/MediaQueryParserContext.cpp >index 7f7366e379c485b1ff98ea966070e30aa50886cf..6d110b4dcbe63f35c25405f167047bfbec7b347a 100644 >--- a/Source/WebCore/css/MediaQueryParserContext.cpp >+++ b/Source/WebCore/css/MediaQueryParserContext.cpp >@@ -26,7 +26,6 @@ > #include "config.h" > #include "MediaQueryParserContext.h" > >-#include "CSSParserMode.h" > #include "Document.h" > #include "Page.h" > >@@ -35,11 +34,12 @@ namespace WebCore { > MediaQueryParserContext::MediaQueryParserContext(const CSSParserContext& context) > { > useSystemAppearance = context.useSystemAppearance; >+ mode = context.mode; > } > > MediaQueryParserContext::MediaQueryParserContext(const Document& document) > { > useSystemAppearance = document.page() ? document.page()->useSystemAppearance() : false; > } >- >+ > } // namespace WebCore >diff --git a/Source/WebCore/css/MediaQueryParserContext.h b/Source/WebCore/css/MediaQueryParserContext.h >index 0b03bf5d1edc4cdb61ea9a830eccacfc72215a8f..1bfbcdea6eeee40c529ac635114ec2cd95432216 100644 >--- a/Source/WebCore/css/MediaQueryParserContext.h >+++ b/Source/WebCore/css/MediaQueryParserContext.h >@@ -25,6 +25,8 @@ > > #pragma once > >+#include "CSSParserMode.h" >+ > namespace WebCore { > > class Document; >@@ -35,8 +37,9 @@ public: > MediaQueryParserContext() { } > MediaQueryParserContext(const CSSParserContext&); > WEBCORE_EXPORT MediaQueryParserContext(const Document&); >- >+ > bool useSystemAppearance { false }; >+ CSSParserMode mode { HTMLStandardMode }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css >index 3d4607aef57382616d17c14f1c1e1c12ca57208e..6a7e49eff4108bef874cbad5ba67f439f95e5cac 100644 >--- a/Source/WebCore/css/html.css >+++ b/Source/WebCore/css/html.css >@@ -384,7 +384,12 @@ input[type="range"], > input, > input:matches([type="password"], [type="search"]) { > -webkit-appearance: textfield; >+#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC >+ color: text; >+ background-color: -apple-system-control-background; >+#else > background-color: white; >+#endif > #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS > border-radius: 5px; > font: 11px Helvetica, -webkit-pictograph; >@@ -399,6 +404,15 @@ input:matches([type="password"], [type="search"]) { > cursor: auto; > } > >+#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC >+@media (prefers-dark-interface) { >+ input, >+ input:matches([type="password"], [type="search"]) { >+ background-color: transparent; >+ } >+} >+#endif >+ > input[type="search"] { > -webkit-appearance: searchfield; > box-sizing: border-box; >@@ -613,7 +627,12 @@ keygen::-webkit-keygen-select { > textarea { > -webkit-appearance: textarea; > #if !(defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS) >+#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC >+ color: text; >+ background-color: -apple-system-control-background; >+#else > background-color: white; >+#endif > border: 1px solid; > -webkit-rtl-ordering: logical; > -webkit-user-select: text; >@@ -899,8 +918,13 @@ select { > #else > -webkit-appearance: menulist; > border: 1px solid; >+#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC >+ color: text; >+ background-color: -apple-system-control-background; >+#else > color: black; > background-color: white; >+#endif > #endif > align-items: center; > white-space: pre; >diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm >index 34fa174140134ed6feedc21facc991677165c566..d3d7da75e27b81f2a43fb5046f4bee202db21096 100644 >--- a/Source/WebCore/rendering/RenderThemeMac.mm >+++ b/Source/WebCore/rendering/RenderThemeMac.mm >@@ -558,6 +558,8 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > return @selector(headerTextColor); > case CSSValueAppleSystemTextBackground: > return @selector(textBackgroundColor); >+ case CSSValueAppleSystemControlBackground: >+ return @selector(controlBackgroundColor); > case CSSValueAppleSystemAlternateSelectedText: > return @selector(alternateSelectedControlTextColor); > case CSSValueAppleSystemLabel: >@@ -855,7 +857,12 @@ bool RenderThemeMac::paintTextField(const RenderObject& o, const PaintInfo& pain > AffineTransform transform = paintInfo.context().getCTM(); > if (transform.xScale() > 1 || transform.yScale() > 1) { > adjustedPaintRect.inflateX(1 / transform.xScale()); >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 >+ adjustedPaintRect.inflateY(2 / transform.yScale()); >+ adjustedPaintRect.move(0, -1 / transform.yScale()); >+#else > adjustedPaintRect.inflateY(1 / transform.yScale()); >+#endif > } > NSTextFieldCell *textField = this->textField(); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9dae63f446248d4f748023160c52c04309da2adc..d49b74c9516395c9619d6e2c9522968f980cc6b7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2018-06-13 Timothy Hatcher <timothy@apple.com> >+ >+ Input form controls have a white background in dark mode, when they should not. >+ >+ https://bugs.webkit.org/show_bug.cgi?id=186577 >+ rdar://problem/39258325 >+ >+ Reviewed by Tim Horton. >+ >+ * fast/css/apple-system-control-colors-expected.txt: Updated. >+ * fast/css/apple-system-control-colors.html: Added -apple-system-control-background. >+ * platform/gtk/fast/css/apple-system-control-colors-expected.txt: Updated. >+ > 2018-06-11 Antti Koivisto <antti@apple.com> > > Fix spelling. >diff --git a/LayoutTests/fast/css/apple-system-control-colors-expected.txt b/LayoutTests/fast/css/apple-system-control-colors-expected.txt >index 6062db099fb46feb8886b795068f337d4e1ab60f..6ebee22ebc8bb6a581c30b54a74c93cff89299da 100644 >--- a/LayoutTests/fast/css/apple-system-control-colors-expected.txt >+++ b/LayoutTests/fast/css/apple-system-control-colors-expected.txt >@@ -1,5 +1,6 @@ > -apple-system-header-text : rgba(0, 0, 0, 0.85098) > -apple-system-text-background : rgb(255, 255, 255) >+-apple-system-control-background : rgb(255, 255, 255) > -apple-system-alternate-selected-text : rgb(255, 255, 255) > -apple-system-label : rgba(0, 0, 0, 0.85098) > -apple-system-secondary-label : rgba(0, 0, 0, 0.498039) >diff --git a/LayoutTests/fast/css/apple-system-control-colors.html b/LayoutTests/fast/css/apple-system-control-colors.html >index d72c3cff5ca30f51169712284e723f74a5bbc43d..1a06fbefd12fa416f0a5c82efcfcda0114270b12 100644 >--- a/LayoutTests/fast/css/apple-system-control-colors.html >+++ b/LayoutTests/fast/css/apple-system-control-colors.html >@@ -23,6 +23,7 @@ > </style> > <div><span class="swatch" style="background-color: -apple-system-header-text"></span>-apple-system-header-text</div> > <div><span class="swatch" style="background-color: -apple-system-text-background"></span>-apple-system-text-background</div> >+<div><span class="swatch" style="background-color: -apple-system-control-background"></span>-apple-system-control-background</div> > <div><span class="swatch" style="background-color: -apple-system-alternate-selected-text"></span>-apple-system-alternate-selected-text</div> > <div><span class="swatch" style="background-color: -apple-system-label"></span>-apple-system-label</div> > <div><span class="swatch" style="background-color: -apple-system-secondary-label"></span>-apple-system-secondary-label</div> >diff --git a/LayoutTests/platform/gtk/fast/css/apple-system-control-colors-expected.txt b/LayoutTests/platform/gtk/fast/css/apple-system-control-colors-expected.txt >index 9ffe4d73f7e2a8ae6d3398a555205cac76f32798..71763fd23414890508330a77c62e24d17db5ce0f 100644 >--- a/LayoutTests/platform/gtk/fast/css/apple-system-control-colors-expected.txt >+++ b/LayoutTests/platform/gtk/fast/css/apple-system-control-colors-expected.txt >@@ -1,5 +1,6 @@ > -apple-system-header-text : rgba(0, 0, 0, 0) > -apple-system-text-background : rgba(0, 0, 0, 0) >+-apple-system-control-background : rgba(0, 0, 0, 0) > -apple-system-alternate-selected-text : rgba(0, 0, 0, 0) > -apple-system-label : rgba(0, 0, 0, 0) > -apple-system-secondary-label : rgba(0, 0, 0, 0)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186577
:
342603
|
342613
|
342670
| 342671