Default the view background color and text color to different values when in dark...
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2018 01:48:20 +0000 (01:48 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2018 01:48:20 +0000 (01:48 +0000)
commitd0b4c6b7544a863add16e413d7122e666208030f
treee932f7c611f99dcb209d876355c626773ab26b43
parent26b9a19605a6ce7f180ba4fb8dd559a38773e9ff
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.

Source/WebCore:

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.

Source/WebKit:

* 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.

Source/WebKitLegacy/win:

* WebFrame.cpp:
(WebFrame::updateBackground): Drop backgroundColor.
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.

LayoutTests:

* 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/css-dark-mode/default-colors-expected.txt [new file with mode: 0644]
LayoutTests/css-dark-mode/default-colors.html [new file with mode: 0644]
LayoutTests/inspector/css/shadow-scoped-style-expected.txt
LayoutTests/platform/mac/printing/width-overflow-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/html.css
Source/WebCore/dom/Document.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/graphics/Color.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKitLegacy/win/WebFrame.cpp