Diff
Modified: trunk/Source/WebCore/ChangeLog (240627 => 240628)
--- trunk/Source/WebCore/ChangeLog 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebCore/ChangeLog 2019-01-29 01:51:03 UTC (rev 240628)
@@ -1,3 +1,25 @@
+2019-01-28 Timothy Hatcher <timo...@apple.com>
+
+ Make it easier for non-Apple ports to enable dark mode CSS support.
+ https://bugs.webkit.org/show_bug.cgi?id=193882
+
+ Reviewed by Megan Gardner.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::updateBackgroundRecursively): Limit use of system
+ background color to the Mac platform.
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::purgeCaches): Purge m_darkColorCache.
+ (WebCore::RenderTheme::platformColorsDidChange): Reset m_darkColorCache.
+ (WebCore::RenderTheme::colorCache const): Added m_darkColorCache.
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::colorCache const): Deleted.
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::purgeCaches): Removed m_darkColorCache.
+ (WebCore::RenderThemeMac::platformColorsDidChange): Deleted.
+ (WebCore::RenderThemeMac::colorCache const): Deleted.
+
2019-01-28 Simon Fraser <simon.fra...@apple.com>
svg/text/select-text-inside-non-static-position.html crashes under ScrollingStateTree::unparentChildrenAndDestroyNode()
Modified: trunk/Source/WebCore/page/FrameView.cpp (240627 => 240628)
--- trunk/Source/WebCore/page/FrameView.cpp 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebCore/page/FrameView.cpp 2019-01-29 01:51:03 UTC (rev 240628)
@@ -3013,7 +3013,7 @@
void FrameView::updateBackgroundRecursively(bool transparent)
{
-#if ENABLE(DARK_MODE_CSS)
+#if ENABLE(DARK_MODE_CSS) && PLATFORM(MAC)
Color backgroundColor = transparent ? Color::transparent : RenderTheme::singleton().systemColor(CSSValueAppleSystemControlBackground, styleColorOptions());
#else
Color backgroundColor = transparent ? Color::transparent : Color::white;
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (240627 => 240628)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2019-01-29 01:51:03 UTC (rev 240628)
@@ -1216,15 +1216,24 @@
void RenderTheme::purgeCaches()
{
m_colorCache = ColorCache();
+ m_darkColorCache = ColorCache();
}
void RenderTheme::platformColorsDidChange()
{
m_colorCache = ColorCache();
+ m_darkColorCache = ColorCache();
Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
}
+auto RenderTheme::colorCache(OptionSet<StyleColor::Options> options) const -> ColorCache&
+{
+ if (options.contains(StyleColor::Options::UseDarkAppearance))
+ return m_darkColorCache;
+ return m_colorCache;
+}
+
FontCascadeDescription& RenderTheme::cachedSystemFontDescription(CSSValueID systemFontID) const
{
static NeverDestroyed<FontCascadeDescription> caption;
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (240627 => 240628)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2019-01-29 01:51:03 UTC (rev 240628)
@@ -438,10 +438,11 @@
Color inactiveTextSearchHighlightColor;
};
- virtual ColorCache& colorCache(OptionSet<StyleColor::Options>) const { return m_colorCache; }
+ virtual ColorCache& colorCache(OptionSet<StyleColor::Options>) const;
private:
mutable ColorCache m_colorCache;
+ mutable ColorCache m_darkColorCache;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (240627 => 240628)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2019-01-29 01:51:03 UTC (rev 240628)
@@ -68,8 +68,6 @@
ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) final { return SmallScrollbar; }
- void platformColorsDidChange() final;
-
int minimumMenuListSize(const RenderStyle&) const final;
void adjustSliderThumbSize(RenderStyle&, const Element*) const final;
@@ -177,8 +175,6 @@
Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const final;
- ColorCache& colorCache(OptionSet<StyleColor::Options>) const final;
-
void purgeCaches() final;
// Get the control size based off the font. Used by some of the controls (like buttons).
@@ -256,8 +252,6 @@
bool m_isSliderThumbHorizontalPressed { false };
bool m_isSliderThumbVerticalPressed { false };
- mutable ColorCache m_darkColorCache;
-
RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver;
String m_legacyMediaControlsScript;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (240627 => 240628)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2019-01-29 01:51:03 UTC (rev 240628)
@@ -335,7 +335,6 @@
m_mediaControlsScript.clearImplIfNotShared();
m_legacyMediaControlsStyleSheet.clearImplIfNotShared();
m_mediaControlsStyleSheet.clearImplIfNotShared();
- m_darkColorCache = ColorCache();
RenderTheme::purgeCaches();
}
@@ -605,21 +604,6 @@
return makeRGBA(pixel[0], pixel[1], pixel[2], pixel[3]);
}
-void RenderThemeMac::platformColorsDidChange()
-{
- m_darkColorCache = ColorCache();
-
- RenderTheme::platformColorsDidChange();
-}
-
-auto RenderThemeMac::colorCache(OptionSet<StyleColor::Options> options) const -> ColorCache&
-{
- LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseDarkAppearance));
- if (localAppearance.usingDarkAppearance())
- return m_darkColorCache;
- return RenderTheme::colorCache(options);
-}
-
Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
{
const bool useSystemAppearance = options.contains(StyleColor::Options::UseSystemAppearance);
Modified: trunk/Source/WebKit/ChangeLog (240627 => 240628)
--- trunk/Source/WebKit/ChangeLog 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/ChangeLog 2019-01-29 01:51:03 UTC (rev 240628)
@@ -1,3 +1,30 @@
+2019-01-28 Timothy Hatcher <timo...@apple.com>
+
+ Make it easier for non-Apple ports to enable dark mode CSS support.
+ https://bugs.webkit.org/show_bug.cgi?id=193882
+
+ Reviewed by Megan Gardner.
+
+ Make modern WebKit code for dark mode usable by other ports, to match
+ the WebCore parts that have been cross-platform all along.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode const):
+ (WebKit::WebPageCreationParameters::decode):
+ * Shared/WebPageCreationParameters.h:
+ * UIProcess/PageClient.h:
+ (WebKit::PageClient::effectiveAppearanceIsDark const):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::creationParameters):
+ (WebKit::WebPageProxy::useDarkAppearance const):
+ (WebKit::WebPageProxy::effectiveAppearanceDidChange):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
+ (WebKit::WebPage::setUseDarkAppearance):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2019-01-28 Andy Estes <aes...@apple.com>
[Cocoa] Add SPI to _WKUserContentExtensionStore to retrieve its underlying WKContentRuleListStore
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (240627 => 240628)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2019-01-29 01:51:03 UTC (rev 240628)
@@ -74,11 +74,11 @@
encoder << mimeTypesWithCustomContentProviders;
encoder << controlledByAutomation;
encoder << isProcessSwap;
+ encoder << useDarkAppearance;
#if PLATFORM(MAC)
encoder << colorSpace;
encoder << useSystemAppearance;
- encoder << useDarkAppearance;
#endif
#if PLATFORM(IOS_FAMILY)
encoder << screenSize;
@@ -229,6 +229,8 @@
return WTF::nullopt;
if (!decoder.decode(parameters.isProcessSwap))
return WTF::nullopt;
+ if (!decoder.decode(parameters.useDarkAppearance))
+ return WTF::nullopt;
#if PLATFORM(MAC)
if (!decoder.decode(parameters.colorSpace))
@@ -235,8 +237,6 @@
return WTF::nullopt;
if (!decoder.decode(parameters.useSystemAppearance))
return WTF::nullopt;
- if (!decoder.decode(parameters.useDarkAppearance))
- return WTF::nullopt;
#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (240627 => 240628)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2019-01-29 01:51:03 UTC (rev 240628)
@@ -131,10 +131,11 @@
bool controlledByAutomation;
bool isProcessSwap { false };
+ bool useDarkAppearance { false };
+
#if PLATFORM(MAC)
ColorSpaceData colorSpace;
bool useSystemAppearance;
- bool useDarkAppearance;
#endif
#if PLATFORM(IOS_FAMILY)
WebCore::FloatSize screenSize;
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (240627 => 240628)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2019-01-29 01:51:03 UTC (rev 240628)
@@ -311,6 +311,8 @@
virtual void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&) = 0;
#endif
+ virtual bool effectiveAppearanceIsDark() const { return false; }
+
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
virtual void exitAcceleratedCompositingMode() = 0;
virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) = 0;
@@ -337,8 +339,6 @@
virtual NSWindow *platformWindow() = 0;
virtual void setShouldSuppressFirstResponderChanges(bool) = 0;
- virtual bool effectiveAppearanceIsDark() const = 0;
-
#if WK_API_ENABLED
virtual NSView *inspectorAttachmentView() = 0;
virtual _WKRemoteObjectRegistry *remoteObjectRegistry() = 0;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (240627 => 240628)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-01-29 01:51:03 UTC (rev 240628)
@@ -6785,10 +6785,10 @@
parameters.backgroundExtendsBeyondPage = m_backgroundExtendsBeyondPage;
parameters.layerHostingMode = m_layerHostingMode;
parameters.controlledByAutomation = m_controlledByAutomation;
+ parameters.useDarkAppearance = useDarkAppearance();
#if PLATFORM(MAC)
parameters.colorSpace = pageClient().colorSpace();
parameters.useSystemAppearance = m_useSystemAppearance;
- parameters.useDarkAppearance = useDarkAppearance();
#endif
#if PLATFORM(IOS_FAMILY)
parameters.screenSize = screenSize();
@@ -7406,11 +7406,6 @@
m_process->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID);
}
-bool WebPageProxy::useDarkAppearance() const
-{
- return pageClient().effectiveAppearanceIsDark();
-}
-
#if USE(DICTATION_ALTERNATIVES)
void WebPageProxy::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
{
@@ -7917,14 +7912,6 @@
m_process->send(Messages::WebPage::SetUseSystemAppearance(useSystemAppearance), m_pageID);
}
-void WebPageProxy::effectiveAppearanceDidChange()
-{
- if (!isValid())
- return;
-
- m_process->send(Messages::WebPage::SetUseDarkAppearance(useDarkAppearance()), m_pageID);
-}
-
void WebPageProxy::setHeaderBannerHeightForTesting(int height)
{
m_process->send(Messages::WebPage::SetHeaderBannerHeightForTesting(height), m_pageID);
@@ -8274,6 +8261,19 @@
}
#endif
+bool WebPageProxy::useDarkAppearance() const
+{
+ return pageClient().effectiveAppearanceIsDark();
+}
+
+void WebPageProxy::effectiveAppearanceDidChange()
+{
+ if (!isValid())
+ return;
+
+ m_process->send(Messages::WebPage::SetUseDarkAppearance(useDarkAppearance()), m_pageID);
+}
+
#if PLATFORM(COCOA)
void WebPageProxy::touchBarMenuDataChanged(const TouchBarMenuData& touchBarMenuData)
{
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (240627 => 240628)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-01-29 01:51:03 UTC (rev 240628)
@@ -897,9 +897,10 @@
#if PLATFORM(MAC)
void setUseSystemAppearance(bool);
bool useSystemAppearance() const { return m_useSystemAppearance; }
+#endif
+
void effectiveAppearanceDidChange();
bool useDarkAppearance() const;
-#endif
#if PLATFORM(COCOA)
// Called by the web process through a message.
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (240627 => 240628)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-01-29 01:51:03 UTC (rev 240628)
@@ -523,10 +523,13 @@
setPageLength(parameters.pageLength);
setGapBetweenPages(parameters.gapBetweenPages);
setPaginationLineGridEnabled(parameters.paginationLineGridEnabled);
+
+ setUseDarkAppearance(parameters.useDarkAppearance);
+
#if PLATFORM(MAC)
setUseSystemAppearance(parameters.useSystemAppearance);
- setUseDarkAppearance(parameters.useDarkAppearance);
#endif
+
// If the page is created off-screen, its visibilityState should be prerender.
m_page->setActivityState(m_activityState);
if (!isVisible())
@@ -4501,12 +4504,13 @@
{
corePage()->setUseSystemAppearance(useSystemAppearance);
}
-
+
+#endif
+
void WebPage::setUseDarkAppearance(bool useDarkAppearance)
{
corePage()->setUseDarkAppearance(useDarkAppearance);
}
-#endif
void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo)
{
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (240627 => 240628)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-01-29 01:51:03 UTC (rev 240628)
@@ -537,9 +537,10 @@
void setBottomOverhangImage(WebImage*);
void setUseSystemAppearance(bool);
- void setUseDarkAppearance(bool);
#endif
+ void setUseDarkAppearance(bool);
+
bool windowIsFocused() const;
bool windowAndWebPageAreFocused() const;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (240627 => 240628)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-01-29 01:51:03 UTC (rev 240628)
@@ -474,12 +474,13 @@
HandleAcceptedCandidate(struct WebCore::TextCheckingResult acceptedCandidate)
SetUseSystemAppearance(bool useSystemAppearance);
- SetUseDarkAppearance(bool useDarkAppearance);
SetHeaderBannerHeightForTesting(int height);
SetFooterBannerHeightForTesting(int height);
#endif
+ SetUseDarkAppearance(bool useDarkAppearance);
+
#if PLATFORM(COCOA)
RequestActiveNowPlayingSessionInfo(WebKit::CallbackID callbackID)
#endif
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (240627 => 240628)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-01-29 01:51:03 UTC (rev 240628)
@@ -1,3 +1,14 @@
+2019-01-28 Timothy Hatcher <timo...@apple.com>
+
+ Make it easier for non-Apple ports to enable dark mode CSS support.
+ https://bugs.webkit.org/show_bug.cgi?id=193882
+
+ Reviewed by Megan Gardner.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]): Fix some defines.
+ (-[WebView _effectiveAppearanceIsDark]): Ditto.
+
2019-01-27 Chris Fleizach <cfleiz...@apple.com>
AX: Introduce a static accessibility tree
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (240627 => 240628)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2019-01-29 01:38:17 UTC (rev 240627)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2019-01-29 01:51:03 UTC (rev 240628)
@@ -1583,6 +1583,9 @@
ResourceHandle::forceContentSniffing();
_private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
+#endif
+
+#if HAVE(OS_DARK_MODE_SUPPORT) && PLATFORM(MAC)
_private->page->setUseDarkAppearance(self._effectiveAppearanceIsDark);
#endif
@@ -5293,15 +5296,13 @@
return insets;
}
+#if HAVE(OS_DARK_MODE_SUPPORT) && PLATFORM(MAC)
- (bool)_effectiveAppearanceIsDark
{
-#if HAVE(OS_DARK_MODE_SUPPORT)
NSAppearanceName appearance = [[self effectiveAppearance] bestMatchFromAppearancesWithNames:@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
return [appearance isEqualToString:NSAppearanceNameDarkAqua];
-#else
- return false;
+}
#endif
-}
- (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
{
@@ -5317,6 +5318,7 @@
return _private->page->useSystemAppearance();
}
+#if HAVE(OS_DARK_MODE_SUPPORT) && PLATFORM(MAC)
- (void)viewDidChangeEffectiveAppearance
{
// This can be called during [super initWithCoder:] and [super initWithFrame:].
@@ -5326,6 +5328,7 @@
_private->page->setUseDarkAppearance(self._effectiveAppearanceIsDark);
}
+#endif
- (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData
{