Diff
Modified: trunk/LayoutTests/ChangeLog (238211 => 238212)
--- trunk/LayoutTests/ChangeLog 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/LayoutTests/ChangeLog 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1,3 +1,16 @@
+2018-11-14 Timothy Hatcher <timo...@apple.com>
+
+ Default the view background color and text color to different values when in dark mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191607
+ rdar://problem/46045854
+
+ Reviewed by Dean Jackson.
+
+ * css-dark-mode/default-colors-expected.txt: Added.
+ * css-dark-mode/default-colors.html: Added.
+ * inspector/css/shadow-scoped-style-expected.txt: Rebaseline.
+ * platform/mac/printing/width-overflow-expected.txt: Rebaseline.
+
2018-11-14 Ryan Haddad <ryanhad...@apple.com>
Layout test fast/layers/no-clipping-overflow-hidden-added-after-transform.html is a flaky failure on EWS bots
Added: trunk/LayoutTests/css-dark-mode/default-colors-expected.txt (0 => 238212)
--- trunk/LayoutTests/css-dark-mode/default-colors-expected.txt (rev 0)
+++ trunk/LayoutTests/css-dark-mode/default-colors-expected.txt 2018-11-15 01:48:20 UTC (rev 238212)
@@ -0,0 +1,10 @@
+
+PASS Body text color is black, since the page isn't in dark mode
+PASS View base background color is white, since the page isn't in dark mode
+PASS Set dark appearance
+PASS Body text color is black, since the page hasn't set a supported color scheme
+PASS View base background color is white, since the page hasn't set a supported color scheme
+PASS Set prefers-color-schemes: light dark on the body
+PASS Body text color is white
+PASS View base background color is a dark grey
+
Added: trunk/LayoutTests/css-dark-mode/default-colors.html (0 => 238212)
--- trunk/LayoutTests/css-dark-mode/default-colors.html (rev 0)
+++ trunk/LayoutTests/css-dark-mode/default-colors.html 2018-11-15 01:48:20 UTC (rev 238212)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->
+
+<script src=""
+<script src=""
+
+<body></body>
+
+<script>
+function test_prop(element, prop, expected) {
+ assert_equals(window.getComputedStyle(element).getPropertyValue(prop), expected);
+}
+
+test(function() {
+ test_prop(document.body, "color", "rgb(0, 0, 0)");
+}, "Body text color is black, since the page isn't in dark mode");
+
+test(function() {
+ assert_equals(internals.viewBaseBackgroundColor(), "rgb(255, 255, 255)");
+}, "View base background color is white, since the page isn't in dark mode");
+
+test(function() {
+ if (!window.internals)
+ return;
+ internals.settings.setUseDarkAppearance(true);
+}, "Set dark appearance");
+
+test(function() {
+ test_prop(document.body, "color", "rgb(0, 0, 0)");
+}, "Body text color is black, since the page hasn't set a supported color scheme");
+
+test(function() {
+ assert_equals(internals.viewBaseBackgroundColor(), "rgb(255, 255, 255)");
+}, "View base background color is white, since the page hasn't set a supported color scheme");
+
+test(function() {
+ let styleElement = document.createElement("style");
+ styleElement.textContent = ":root { supported-color-schemes: light dark; }";
+ document.head.appendChild(styleElement);
+}, "Set prefers-color-schemes: light dark on the body");
+
+test(function() {
+ test_prop(document.body, "color", "rgb(255, 255, 255)");
+}, "Body text color is white");
+
+test(function() {
+ if (!window.internals)
+ return;
+ assert_equals(internals.viewBaseBackgroundColor(), "rgb(30, 30, 30)");
+}, "View base background color is a dark grey");
+</script>
Modified: trunk/LayoutTests/inspector/css/shadow-scoped-style-expected.txt (238211 => 238212)
--- trunk/LayoutTests/inspector/css/shadow-scoped-style-expected.txt 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/LayoutTests/inspector/css/shadow-scoped-style-expected.txt 2018-11-15 01:48:20 UTC (rev 238212)
@@ -21,6 +21,8 @@
}
address, article, aside, div, footer, header, hgroup, layer, main, nav, section {
}
+html {
+}
-- Running test case: CSS.ShadowScopedStyle.ElementInShadowTree
PASS: Node should not have shadow roots.
Modified: trunk/LayoutTests/platform/mac/printing/width-overflow-expected.txt (238211 => 238212)
--- trunk/LayoutTests/platform/mac/printing/width-overflow-expected.txt 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/LayoutTests/platform/mac/printing/width-overflow-expected.txt 2018-11-15 01:48:20 UTC (rev 238212)
@@ -8,11 +8,11 @@
text run at (0,0) width 765: "To run this test manually, print this page. If the right side of any lines is printed without being truncated, the test passes."
RenderBlock {DIV} at (0,34) size 1300x2218
RenderBlock {P} at (0,0) size 1300x72
- RenderText {#text} at (0,0) size 1288x72
- text run at (0,0) width 1288: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
- text run at (0,18) width 1288: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
- text run at (0,36) width 1288: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
- text run at (0,54) width 525: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
+ RenderText {#text} at (0,0) size 1289x72
+ text run at (0,0) width 1289: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
+ text run at (0,18) width 1289: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
+ text run at (0,36) width 1289: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
+ text run at (0,54) width 526: "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
RenderBlock {P} at (0,88) size 1300x72
RenderText {#text} at (0,0) size 1288x72
text run at (0,0) width 1288: "B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B"
@@ -96,9 +96,9 @@
text run at (0,36) width 1288: "O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O"
text run at (0,54) width 790: "O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O"
RenderBlock {P} at (0,1284) size 1300x54
- RenderText {#text} at (0,0) size 1289x54
- text run at (0,0) width 1289: "P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P"
- text run at (0,18) width 1289: "P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P"
+ RenderText {#text} at (0,0) size 1290x54
+ text run at (0,0) width 1290: "P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P"
+ text run at (0,18) width 1290: "P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P"
text run at (0,36) width 1105: "P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P"
RenderBlock {P} at (0,1354) size 1300x72
RenderText {#text} at (0,0) size 1288x72
@@ -122,7 +122,7 @@
text run at (0,0) width 1292: "T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T"
text run at (0,18) width 1292: "T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T"
text run at (0,36) width 1292: "T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T"
- text run at (0,54) width 158: "T T T T T T T T T T T T"
+ text run at (0,54) width 159: "T T T T T T T T T T T T"
RenderBlock {P} at (0,1688) size 1300x72
RenderText {#text} at (0,0) size 1288x72
text run at (0,0) width 1288: "U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U"
@@ -153,7 +153,7 @@
text run at (0,0) width 1299: "Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y"
text run at (0,18) width 1299: "Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y"
text run at (0,36) width 1299: "Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y"
- text run at (0,54) width 580: "Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y"
+ text run at (0,54) width 581: "Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y"
RenderBlock {P} at (0,2146) size 1300x72
RenderText {#text} at (0,0) size 1291x72
text run at (0,0) width 1291: "Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z"
Modified: trunk/Source/WebCore/ChangeLog (238211 => 238212)
--- trunk/Source/WebCore/ChangeLog 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/ChangeLog 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1,3 +1,44 @@
+2018-11-14 Timothy Hatcher <timo...@apple.com>
+
+ Default the view background color and text color to different values when in dark mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191607
+ rdar://problem/46045854
+
+ Reviewed by Dean Jackson.
+
+ Test: css-dark-mode/default-colors.html
+
+ * css/html.css:
+ (html): Set color: text on macOS.
+ * dom/Document.cpp:
+ (WebCore::Document::processSupportedColorSchemes): Call recalculateBaseBackgroundColor().
+ * editing/EditingStyle.cpp:
+ (WebCore::caretColorFromStyle): Added.
+ (WebCore::EditingStyle::prepareToApplyAt): Use equalIgnoringSemanticColor. Check for
+ caret-color directly since removeEquivalentProperties fails with semantic colors.
+ (WebCore::extractPropertiesNotIn): Use equalIgnoringSemanticColor. Check for caret-color
+ directly since removeEquivalentProperties fails with semantic colors.
+ * page/Frame.cpp:
+ (WebCore::Frame::createView): Drop backgroundColor.
+ * page/Frame.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::recalculateBaseBackgroundColor): Added.
+ (WebCore::FrameView::updateBackgroundRecursively): Drop backgroundColor argument.
+ Calculate the backgroundColor based on the transparent argument only.
+ * page/FrameView.h:
+ * platform/graphics/Color.h:
+ (WebCore::equalIgnoringSemanticColor): Added for EditingStyle.
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::styleDidChange): Call recalculateBaseBackgroundColor().
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const): Use isWhiteColor()
+ since it ignores the semantic color flag.
+ * testing/Internals.cpp:
+ (WebCore::Internals::setViewIsTransparent): Drop backgroundColor.
+ (WebCore::Internals::viewBaseBackgroundColor): Added.
+ * testing/Internals.h:
+ * testing/Internals.idl: Added viewBaseBackgroundColor.
+
2018-11-14 Justin Fan <justin_...@apple.com>
[WebGPU] Code quality concerns raised for 191291: [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
Modified: trunk/Source/WebCore/css/html.css (238211 => 238212)
--- trunk/Source/WebCore/css/html.css 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/css/html.css 2018-11-15 01:48:20 UTC (rev 238212)
@@ -25,6 +25,9 @@
html {
display: block;
+#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC
+ color: text;
+#endif
}
/* children of the <head> element all have display:none */
Modified: trunk/Source/WebCore/dom/Document.cpp (238211 => 238212)
--- trunk/Source/WebCore/dom/Document.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/dom/Document.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -3634,6 +3634,9 @@
m_supportedColorSchemes = supportedColorSchemes;
m_allowsColorSchemeTransformations = allowsTransformations;
+ if (auto* frameView = view())
+ frameView->recalculateBaseBackgroundColor();
+
if (auto* page = this->page())
page->updateStyleAfterChangeInEnvironment();
}
Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (238211 => 238212)
--- trunk/Source/WebCore/editing/EditingStyle.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -401,6 +401,12 @@
}
template<typename T>
+static inline Color caretColorFromStyle(T& style)
+{
+ return cssValueToColor(extractPropertyValue(style, CSSPropertyCaretColor).get());
+}
+
+template<typename T>
static inline Color backgroundColorFromStyle(T& style)
{
return cssValueToColor(extractPropertyValue(style, CSSPropertyBackgroundColor).get());
@@ -1080,9 +1086,12 @@
if (textAlignResolvingStartAndEnd(*m_mutableStyle) == textAlignResolvingStartAndEnd(*styleAtPosition))
m_mutableStyle->removeProperty(CSSPropertyTextAlign);
- if (textColorFromStyle(*m_mutableStyle) == textColorFromStyle(*styleAtPosition))
+ if (equalIgnoringSemanticColor(textColorFromStyle(*m_mutableStyle), textColorFromStyle(*styleAtPosition)))
m_mutableStyle->removeProperty(CSSPropertyColor);
+ if (equalIgnoringSemanticColor(caretColorFromStyle(*m_mutableStyle), caretColorFromStyle(*styleAtPosition)))
+ m_mutableStyle->removeProperty(CSSPropertyCaretColor);
+
if (hasTransparentBackgroundColor(m_mutableStyle.get())
|| cssValueToColor(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor).get()) == rgbaBackgroundColorInEffect(position.containerNode()))
m_mutableStyle->removeProperty(CSSPropertyBackgroundColor);
@@ -1805,14 +1814,17 @@
if (extractPropertyValue(baseStyle, CSSPropertyFontWeight) && fontWeightIsBold(mutableStyle) == fontWeightIsBold(baseStyle))
mutableStyle->removeProperty(CSSPropertyFontWeight);
- if (extractPropertyValue(baseStyle, CSSPropertyColor) && textColorFromStyle(mutableStyle) == textColorFromStyle(baseStyle))
+ if (extractPropertyValue(baseStyle, CSSPropertyColor) && equalIgnoringSemanticColor(textColorFromStyle(mutableStyle), textColorFromStyle(baseStyle)))
mutableStyle->removeProperty(CSSPropertyColor);
+ if (extractPropertyValue(baseStyle, CSSPropertyCaretColor) && equalIgnoringSemanticColor(caretColorFromStyle(mutableStyle), caretColorFromStyle(baseStyle)))
+ mutableStyle->removeProperty(CSSPropertyCaretColor);
+
if (extractPropertyValue(baseStyle, CSSPropertyTextAlign)
&& textAlignResolvingStartAndEnd(mutableStyle) == textAlignResolvingStartAndEnd(baseStyle))
mutableStyle->removeProperty(CSSPropertyTextAlign);
- if (extractPropertyValue(baseStyle, CSSPropertyBackgroundColor) && backgroundColorFromStyle(mutableStyle) == backgroundColorFromStyle(baseStyle))
+ if (extractPropertyValue(baseStyle, CSSPropertyBackgroundColor) && equalIgnoringSemanticColor(backgroundColorFromStyle(mutableStyle), backgroundColorFromStyle(baseStyle)))
mutableStyle->removeProperty(CSSPropertyBackgroundColor);
return mutableStyle;
Modified: trunk/Source/WebCore/page/Frame.cpp (238211 => 238212)
--- trunk/Source/WebCore/page/Frame.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/page/Frame.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -899,7 +899,7 @@
return nullptr;
}
-void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
+void Frame::createView(const IntSize& viewportSize, bool transparent,
const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect,
bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
ScrollbarMode verticalScrollbarMode, bool verticalLock)
@@ -930,7 +930,7 @@
setView(frameView.copyRef());
- frameView->updateBackgroundRecursively(backgroundColor, transparent);
+ frameView->updateBackgroundRecursively(transparent);
if (isMainFrame)
frameView->setParentVisible(true);
Modified: trunk/Source/WebCore/page/Frame.h (238211 => 238212)
--- trunk/Source/WebCore/page/Frame.h 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/page/Frame.h 2018-11-15 01:48:20 UTC (rev 238212)
@@ -129,7 +129,7 @@
WEBCORE_EXPORT void initWithSimpleHTMLDocument(const String& style, const URL&);
#endif
WEBCORE_EXPORT void setView(RefPtr<FrameView>&&);
- WEBCORE_EXPORT void createView(const IntSize&, const Color& backgroundColor, bool transparent,
+ WEBCORE_EXPORT void createView(const IntSize&, bool transparent,
const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect,
bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
ScrollbarMode = ScrollbarAuto, bool verticalLock = false);
Modified: trunk/Source/WebCore/page/FrameView.cpp (238211 => 238212)
--- trunk/Source/WebCore/page/FrameView.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/page/FrameView.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -416,6 +416,18 @@
setScrollbarOverlayStyle(computedOverlayStyle);
}
+#if ENABLE(DARK_MODE_CSS)
+void FrameView::recalculateBaseBackgroundColor()
+{
+ bool usingDarkAppearance = useDarkAppearance();
+ if (m_usesDarkAppearance == usingDarkAppearance)
+ return;
+
+ m_usesDarkAppearance = usingDarkAppearance;
+ updateBackgroundRecursively(m_isTransparent);
+}
+#endif
+
void FrameView::clear()
{
setCanBlitOnScroll(true);
@@ -2994,8 +3006,14 @@
renderView()->compositor().rootBackgroundColorOrTransparencyChanged();
}
-void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool transparent)
+void FrameView::updateBackgroundRecursively(bool transparent)
{
+#if ENABLE(DARK_MODE_CSS)
+ Color backgroundColor = transparent ? Color::transparent : RenderTheme::singleton().systemColor(CSSValueAppleSystemControlBackground, styleColorOptions());
+#else
+ Color backgroundColor = transparent ? Color::transparent : Color::white;
+#endif
+
for (auto* frame = m_frame.ptr(); frame; frame = frame->tree().traverseNext(m_frame.ptr())) {
if (FrameView* view = frame->view()) {
view->setTransparent(transparent);
Modified: trunk/Source/WebCore/page/FrameView.h (238211 => 238212)
--- trunk/Source/WebCore/page/FrameView.h 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/page/FrameView.h 2018-11-15 01:48:20 UTC (rev 238212)
@@ -179,6 +179,9 @@
void prepareForDetach();
void detachCustomScrollbars();
WEBCORE_EXPORT void recalculateScrollbarOverlayStyle();
+#if ENABLE(DARK_MODE_CSS)
+ void recalculateBaseBackgroundColor();
+#endif
void clear();
void resetLayoutMilestones();
@@ -191,7 +194,7 @@
WEBCORE_EXPORT Color baseBackgroundColor() const;
WEBCORE_EXPORT void setBaseBackgroundColor(const Color&);
- WEBCORE_EXPORT void updateBackgroundRecursively(const Color&, bool);
+ WEBCORE_EXPORT void updateBackgroundRecursively(bool);
enum ExtendedBackgroundModeFlags {
ExtendedBackgroundModeNone = 0,
Modified: trunk/Source/WebCore/platform/graphics/Color.h (238211 => 238212)
--- trunk/Source/WebCore/platform/graphics/Color.h 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/platform/graphics/Color.h 2018-11-15 01:48:20 UTC (rev 238212)
@@ -300,6 +300,7 @@
WEBCORE_EXPORT Color& operator=(Color&&);
friend bool operator==(const Color& a, const Color& b);
+ friend bool equalIgnoringSemanticColor(const Color& a, const Color& b);
static bool isBlackColor(const Color&);
static bool isWhiteColor(const Color&);
@@ -403,6 +404,11 @@
return !(a == b);
}
+inline bool equalIgnoringSemanticColor(const Color& a, const Color& b)
+{
+ return (a.m_colorData.rgbaAndFlags & ~Color::isSemanticRBGAColorBit) == (b.m_colorData.rgbaAndFlags & ~Color::isSemanticRBGAColorBit);
+}
+
inline uint8_t roundAndClampColorChannel(int value)
{
return std::max(0, std::min(255, value));
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (238211 => 238212)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -369,6 +369,10 @@
setNeedsLayoutAndPrefWidthsRecalc();
}
+#if ENABLE(DARK_MODE_CSS)
+ view().frameView().recalculateBaseBackgroundColor();
+#endif
+
view().frameView().recalculateScrollbarOverlayStyle();
const Pagination& pagination = view().frameView().pagination();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (238211 => 238212)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -2704,7 +2704,7 @@
return false;
// Background color could be of interest to tests or other dumpers if it's non-white.
- if (!strcmp(propertyName, "backgroundColor") && layer->backgroundColor() == Color::white)
+ if (!strcmp(propertyName, "backgroundColor") && Color::isWhiteColor(layer->backgroundColor()))
return false;
// The root tile cache's repaints will show up at the top with FrameView's,
Modified: trunk/Source/WebCore/testing/Internals.cpp (238211 => 238212)
--- trunk/Source/WebCore/testing/Internals.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/testing/Internals.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1678,11 +1678,18 @@
Document* document = contextDocument();
if (!document || !document->view())
return Exception { InvalidAccessError };
- Color backgroundColor = transparent ? Color::transparent : Color::white;
- document->view()->updateBackgroundRecursively(backgroundColor, transparent);
+ document->view()->updateBackgroundRecursively(transparent);
return { };
}
+ExceptionOr<String> Internals::viewBaseBackgroundColor()
+{
+ Document* document = contextDocument();
+ if (!document || !document->view())
+ return Exception { InvalidAccessError };
+ return document->view()->baseBackgroundColor().cssText();
+}
+
ExceptionOr<void> Internals::setViewBaseBackgroundColor(const String& colorValue)
{
Document* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (238211 => 238212)
--- trunk/Source/WebCore/testing/Internals.h 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/testing/Internals.h 2018-11-15 01:48:20 UTC (rev 238212)
@@ -245,6 +245,8 @@
ExceptionOr<Ref<DOMRect>> visualViewportRect();
ExceptionOr<void> setViewIsTransparent(bool);
+
+ ExceptionOr<String> viewBaseBackgroundColor();
ExceptionOr<void> setViewBaseBackgroundColor(const String& colorValue);
ExceptionOr<void> setPagination(const String& mode, int gap, int pageLength);
Modified: trunk/Source/WebCore/testing/Internals.idl (238211 => 238212)
--- trunk/Source/WebCore/testing/Internals.idl 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebCore/testing/Internals.idl 2018-11-15 01:48:20 UTC (rev 238212)
@@ -263,6 +263,8 @@
[MayThrowException] DOMRect visualViewportRect();
[MayThrowException] void setViewIsTransparent(boolean trnasparent);
+
+ [MayThrowException] DOMString viewBaseBackgroundColor();
[MayThrowException] void setViewBaseBackgroundColor(DOMString colorValue);
[MayThrowException] void setPagination(DOMString mode, long gap, optional long pageLength = 0);
Modified: trunk/Source/WebKit/ChangeLog (238211 => 238212)
--- trunk/Source/WebKit/ChangeLog 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKit/ChangeLog 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1,3 +1,19 @@
+2018-11-14 Timothy Hatcher <timo...@apple.com>
+
+ Default the view background color and text color to different values when in dark mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191607
+ rdar://problem/46045854
+
+ Reviewed by Dean Jackson.
+
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::backgroundColor const): Use controlBackgroundColor.
+ (WebKit::WebViewImpl::updateLayer): Simplified and use backgroundColor() getter.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setDrawsBackground): Drop backgroundColor.
+
2018-11-14 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (238211 => 238212)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1519,7 +1519,11 @@
NSColor *WebViewImpl::backgroundColor() const
{
if (!m_backgroundColor)
+#if ENABLE(DARK_MODE_CSS)
+ return [NSColor controlBackgroundColor];
+#else
return [NSColor whiteColor];
+#endif
return m_backgroundColor.get();
}
@@ -1758,11 +1762,7 @@
void WebViewImpl::updateLayer()
{
- bool draws = drawsBackground();
- if (!draws || !m_backgroundColor)
- [m_view layer].backgroundColor = CGColorGetConstantColor(draws ? kCGColorWhite : kCGColorClear);
- else
- [m_view layer].backgroundColor = [m_backgroundColor CGColor];
+ [m_view layer].backgroundColor = drawsBackground() ? [backgroundColor() CGColor] : CGColorGetConstantColor(kCGColorClear);
}
void WebViewImpl::drawRect(CGRect rect)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (238211 => 238212)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1391,7 +1391,6 @@
{
WebPage* webPage = m_frame->page();
- Color backgroundColor = webPage->drawsBackground() ? Color::white : Color::transparent;
bool isMainFrame = m_frame->isMainFrame();
bool isTransparent = !webPage->drawsBackground();
bool shouldUseFixedLayout = isMainFrame && webPage->useFixedLayout();
@@ -1418,7 +1417,7 @@
bool horizontalLock = shouldHideScrollbars || webPage->alwaysShowsHorizontalScroller();
bool verticalLock = shouldHideScrollbars || webPage->alwaysShowsVerticalScroller();
- m_frame->coreFrame()->createView(webPage->size(), backgroundColor, isTransparent,
+ m_frame->coreFrame()->createView(webPage->size(), isTransparent,
webPage->fixedLayoutSize(), fixedVisibleContentRect, shouldUseFixedLayout,
horizontalScrollbarMode, horizontalLock, verticalScrollbarMode, verticalLock);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (238211 => 238212)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -2815,9 +2815,8 @@
m_drawsBackground = drawsBackground;
if (FrameView* frameView = mainFrameView()) {
- Color backgroundColor = drawsBackground ? Color::white : Color::transparent;
bool isTransparent = !drawsBackground;
- frameView->updateBackgroundRecursively(backgroundColor, isTransparent);
+ frameView->updateBackgroundRecursively(isTransparent);
}
m_drawingArea->pageBackgroundTransparencyChanged();
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (238211 => 238212)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2018-11-15 01:48:20 UTC (rev 238212)
@@ -1,3 +1,16 @@
+2018-11-14 Timothy Hatcher <timo...@apple.com>
+
+ Default the view background color and text color to different values when in dark mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191607
+ rdar://problem/46045854
+
+ Reviewed by Dean Jackson.
+
+ * WebFrame.cpp:
+ (WebFrame::updateBackground): Drop backgroundColor.
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
+
2018-11-14 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (238211 => 238212)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -984,10 +984,9 @@
RECT pixelRect;
view->frameRect(&pixelRect);
bool transparent = view->transparent();
- Color backgroundColor = transparent ? Color::transparent : Color::white;
FloatRect logicalFrame(pixelRect);
logicalFrame.scale(1.0f / view->deviceScaleFactor());
- core(m_webFrame)->createView(enclosingIntRect(logicalFrame).size(), backgroundColor, transparent, /* fixedLayoutSize */ { }, /* fixedVisibleContentRect */ { });
+ core(m_webFrame)->createView(enclosingIntRect(logicalFrame).size(), transparent, /* fixedLayoutSize */ { }, /* fixedVisibleContentRect */ { });
}
void WebFrameLoaderClient::didSaveToPageCache()
Modified: trunk/Source/WebKitLegacy/win/WebFrame.cpp (238211 => 238212)
--- trunk/Source/WebKitLegacy/win/WebFrame.cpp 2018-11-15 01:38:30 UTC (rev 238211)
+++ trunk/Source/WebKitLegacy/win/WebFrame.cpp 2018-11-15 01:48:20 UTC (rev 238212)
@@ -2085,13 +2085,12 @@
void WebFrame::updateBackground()
{
- Color backgroundColor = webView()->transparent() ? Color::transparent : Color::white;
Frame* coreFrame = core(this);
if (!coreFrame || !coreFrame->view())
return;
- coreFrame->view()->updateBackgroundRecursively(backgroundColor, webView()->transparent());
+ coreFrame->view()->updateBackgroundRecursively(webView()->transparent());
}
// IWebFrame2