Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2018 00:38:10 +0000 (00:38 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2018 00:38:10 +0000 (00:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187369
rdar://problem/41870420

Reviewed by Tim Horton.

Source/WebCore:

* Modules/mediasession/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
* css/MediaQueryEvaluator.cpp:
(WebCore::prefersDarkInterfaceEvaluate):
* css/StyleColor.h:
* dom/Document.cpp:
(WebCore::Document::useDarkAppearance const):
(WebCore::Document::styleColorOptions const):
(WebCore::Document::useDefaultAppearance const): Deleted.
* dom/Document.h:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::paint):
* page/Page.cpp:
(WebCore::Page::useDarkAppearance const):
(WebCore::Page::defaultAppearance const): Deleted.
* page/Page.h:
(WebCore::Page::setUseDarkAppearance):
(WebCore::Page::setDefaultAppearance): Deleted.
* platform/Theme.h:
* platform/graphics/MediaPlaybackTargetPicker.h:
* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
(WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageForLink):
* platform/mac/LocalDefaultSystemAppearance.h:
* platform/mac/LocalDefaultSystemAppearance.mm:
(WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
* platform/mac/ThemeMac.h:
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::paint):
* platform/mock/MediaPlaybackTargetPickerMock.cpp:
(WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
* platform/mock/MediaPlaybackTargetPickerMock.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::resolveStyleForMarkedText):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintContents):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paint):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::documentViewFor const):
(WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
(WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
(WebCore::RenderThemeMac::colorCache const):
(WebCore::RenderThemeMac::systemColor const):
(WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
(WebCore::RenderThemeMac::paintSliderThumb):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):

Source/WebKit:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _effectiveAppearanceIsDark]):
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _setUseSystemAppearance:]):
(-[WKWebView effectiveAppearanceDidChange]):
(-[WKWebView _defaultAppearance]): Deleted.
* UIProcess/API/mac/WKView.mm:
(-[WKView _effectiveAppearanceIsDark]):
(-[WKView effectiveAppearanceDidChange]):
(-[WKView _setUseSystemAppearance:]):
(-[WKView _defaultAppearance]): Deleted.
(-[WKView _setDefaultAppearance:]): Deleted.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::effectiveAppearanceIsDark):
(WebKit::WebViewImpl::setUseDarkAppearance):
(WebKit::WebViewImpl::useDefaultAppearance): Deleted.
(WebKit::WebViewImpl::setDefaultAppearance): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setUseDarkAppearance):
(WebKit::WebPageProxy::showPlaybackTargetPicker):
(WebKit::WebPageProxy::setDefaultAppearance): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::useDarkAppearance const):
(WebKit::WebPageProxy::defaultAppearance const): Deleted.
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView drawRect:]):
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::paintControlForLayerInContext):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_credentialsMessenger):
(WebKit::WebPage::drawRect):
(WebKit::WebPage::setUseDarkAppearance):
(WebKit::WebPage::setDefaultAppearance): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Source/WebKitLegacy/mac:

* WebView/WebMediaPlaybackTargetPicker.mm:
(WebMediaPlaybackTargetPicker::showPlaybackTargetPicker):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _effectiveAppearanceIsDark]):
(-[WebView _updateDefaultAppearance]):
(-[WebView _defaultAppearance]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233552 268f45cc-cd09-0410-ab3c-d52691b4dbfc

44 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/StyleColor.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/platform/Theme.h
Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm
Source/WebCore/platform/mac/DragImageMac.mm
Source/WebCore/platform/mac/LocalDefaultSystemAppearance.h
Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm
Source/WebCore/platform/mac/ThemeMac.h
Source/WebCore/platform/mac/ThemeMac.mm
Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp
Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/mac/WKView.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/mac/WKPrintingView.mm
Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm
Source/WebKitLegacy/mac/WebView/WebView.mm

index a3c260d..83791ef 100644 (file)
@@ -1,3 +1,72 @@
+2018-07-05  Timothy Hatcher  <timothy@apple.com>
+
+        Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
+        https://bugs.webkit.org/show_bug.cgi?id=187369
+        rdar://problem/41870420
+
+        Reviewed by Tim Horton.
+
+        * Modules/mediasession/WebMediaSessionManager.cpp:
+        (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::prefersDarkInterfaceEvaluate):
+        * css/StyleColor.h:
+        * dom/Document.cpp:
+        (WebCore::Document::useDarkAppearance const):
+        (WebCore::Document::styleColorOptions const):
+        (WebCore::Document::useDefaultAppearance const): Deleted.
+        * dom/Document.h:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::paint):
+        * page/Page.cpp:
+        (WebCore::Page::useDarkAppearance const):
+        (WebCore::Page::defaultAppearance const): Deleted.
+        * page/Page.h:
+        (WebCore::Page::setUseDarkAppearance):
+        (WebCore::Page::setDefaultAppearance): Deleted.
+        * platform/Theme.h:
+        * platform/graphics/MediaPlaybackTargetPicker.h:
+        * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
+        * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
+        (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
+        * platform/mac/DragImageMac.mm:
+        (WebCore::createDragImageForLink):
+        * platform/mac/LocalDefaultSystemAppearance.h:
+        * platform/mac/LocalDefaultSystemAppearance.mm:
+        (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
+        * platform/mac/ThemeMac.h:
+        * platform/mac/ThemeMac.mm:
+        (WebCore::ThemeMac::paint):
+        * platform/mock/MediaPlaybackTargetPickerMock.cpp:
+        (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
+        * platform/mock/MediaPlaybackTargetPickerMock.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::resolveStyleForMarkedText):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintContents):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::paintContents):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paint):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::documentViewFor const):
+        (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
+        (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
+        (WebCore::RenderThemeMac::colorCache const):
+        (WebCore::RenderThemeMac::systemColor const):
+        (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
+        (WebCore::RenderThemeMac::paintSliderThumb):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::draw):
+
 2018-07-05  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r233539.
index 8e3a8d0..5c294c1 100644 (file)
@@ -178,7 +178,7 @@ void WebMediaSessionManager::removeAllPlaybackTargetPickerClients(WebMediaSessio
     scheduleDelayedTask(TargetMonitoringConfigurationTask | TargetClientsConfigurationTask);
 }
 
-void WebMediaSessionManager::showPlaybackTargetPicker(WebMediaSessionManagerClient& client, uint64_t contextId, const IntRect& rect, bool, bool useDefaultAppearance)
+void WebMediaSessionManager::showPlaybackTargetPicker(WebMediaSessionManagerClient& client, uint64_t contextId, const IntRect& rect, bool, bool useDarkAppearance)
 {
     size_t index = find(&client, contextId);
     ASSERT(index != notFound);
@@ -193,7 +193,7 @@ void WebMediaSessionManager::showPlaybackTargetPicker(WebMediaSessionManagerClie
 
     bool hasActiveRoute = flagsAreSet(m_clientState[index]->flags, MediaProducer::IsPlayingToExternalDevice);
     LOG(Media, "WebMediaSessionManager::showPlaybackTargetPicker(%p + %llu) - hasActiveRoute = %i", &client, contextId, (int)hasActiveRoute);
-    targetPicker().showPlaybackTargetPicker(FloatRect(rect), hasActiveRoute, useDefaultAppearance);
+    targetPicker().showPlaybackTargetPicker(FloatRect(rect), hasActiveRoute, useDarkAppearance);
 }
 
 void WebMediaSessionManager::clientStateDidChange(WebMediaSessionManagerClient& client, uint64_t contextId, MediaProducer::MediaStateFlags newFlags)
index 4117778..06368c0 100644 (file)
@@ -717,7 +717,7 @@ static bool prefersDarkInterfaceEvaluate(CSSValue* value, const CSSToLengthConve
 {
     bool prefersDarkInterface = false;
 
-    if (frame.page()->useSystemAppearance() && !frame.page()->defaultAppearance())
+    if (frame.page()->useSystemAppearance() && frame.page()->useDarkAppearance())
         prefersDarkInterface = true;
 
     if (!value)
index a7b81d9..d7bf5a5 100644 (file)
@@ -54,7 +54,7 @@ public:
     enum class Options : uint8_t {
         ForVisitedLink = 1 << 0,
         UseSystemAppearance = 1 << 1,
-        UseDefaultAppearance = 1 << 2
+        UseDarkAppearance = 1 << 2
     };
 
     static Color colorFromKeyword(CSSValueID, OptionSet<Options>);
index 41009bd..3ada393 100644 (file)
@@ -7084,12 +7084,12 @@ bool Document::useSystemAppearance() const
     return useSystemAppearance;
 }
 
-bool Document::useDefaultAppearance() const
+bool Document::useDarkAppearance() const
 {
-    bool useDefaultAppearance = true;
+    bool useDarkAppearance = false;
     if (Page* documentPage = page())
-        useDefaultAppearance = documentPage->defaultAppearance();
-    return useDefaultAppearance;
+        useDarkAppearance = documentPage->useDarkAppearance();
+    return useDarkAppearance;
 }
 
 OptionSet<StyleColor::Options> Document::styleColorOptions() const
@@ -7097,8 +7097,8 @@ OptionSet<StyleColor::Options> Document::styleColorOptions() const
     OptionSet<StyleColor::Options> options;
     if (useSystemAppearance())
         options |= StyleColor::Options::UseSystemAppearance;
-    if (useDefaultAppearance())
-        options |= StyleColor::Options::UseDefaultAppearance;
+    if (useDarkAppearance())
+        options |= StyleColor::Options::UseDarkAppearance;
     return options;
 }
 
index 87b0160..48a0bd3 100644 (file)
@@ -553,7 +553,8 @@ public:
     float deviceScaleFactor() const;
 
     bool useSystemAppearance() const;
-    bool useDefaultAppearance() const;
+    bool useDarkAppearance() const;
+
     OptionSet<StyleColor::Options> styleColorOptions() const;
 
     WEBCORE_EXPORT Ref<Range> createRange();
index 0059971..c5b9aa5 100644 (file)
@@ -181,7 +181,7 @@ void InspectorOverlay::paint(GraphicsContext& context)
         return;
 
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(m_page.useSystemAppearance(), m_page.defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(m_page.useSystemAppearance(), m_page.useDarkAppearance());
 #endif
 
     GraphicsContextStateSaver stateSaver(context);
index 2735c25..e242be3 100644 (file)
@@ -2385,12 +2385,12 @@ void Page::setUseSystemAppearance(bool value)
     }
 }
 
-bool Page::defaultAppearance() const
+bool Page::useDarkAppearance() const
 {
     FrameView* view = mainFrame().view();
     if (!view || !equalLettersIgnoringASCIICase(view->mediaType(), "screen"))
-        return true;
-    return m_defaultAppearance;
+        return false;
+    return m_useDarkAppearance;
 }
 
 void Page::setFullscreenInsets(const FloatBoxExtent& insets)
index c83c7cd..f2ec451 100644 (file)
@@ -342,8 +342,8 @@ public:
     bool useSystemAppearance() const { return m_useSystemAppearance; }
     WEBCORE_EXPORT void setUseSystemAppearance(bool);
     
-    WEBCORE_EXPORT bool defaultAppearance() const;
-    void setDefaultAppearance(bool a) { m_defaultAppearance = a; }
+    WEBCORE_EXPORT bool useDarkAppearance() const;
+    void setUseDarkAppearance(bool a) { m_useDarkAppearance = a; }
 
 #if ENABLE(TEXT_AUTOSIZING)
     float textAutosizingWidth() const { return m_textAutosizingWidth; }
@@ -754,7 +754,7 @@ private:
 #endif
     
     bool m_useSystemAppearance { false };
-    bool m_defaultAppearance { true };
+    bool m_useDarkAppearance { false };
 
 #if ENABLE(TEXT_AUTOSIZING)
     float m_textAutosizingWidth { 0 };
index 03fb8e5..e8cec35 100644 (file)
@@ -68,7 +68,7 @@ public:
     virtual bool controlRequiresPreWhiteSpace(ControlPart) const;
 
     // Method for painting a control. The rect is in zoomed coordinates.
-    virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDefaultAppearance);
+    virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance);
 
     // Some controls may spill out of their containers (e.g., the check on an OS X checkbox).  When these controls repaint,
     // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
index a8a4d7f..0eca0b9 100644 (file)
@@ -51,7 +51,7 @@ public:
 
     virtual ~MediaPlaybackTargetPicker();
 
-    virtual void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDefaultAppearance);
+    virtual void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance);
     virtual void startingMonitoringPlaybackTargets();
     virtual void stopMonitoringPlaybackTargets();
     virtual void invalidatePlaybackTargets();
index f66629b..1565225 100644 (file)
@@ -43,7 +43,7 @@ public:
 
     virtual ~MediaPlaybackTargetPickerMac();
 
-    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDefaultAppearance) override;
+    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) override;
     void startingMonitoringPlaybackTargets() override;
     void stopMonitoringPlaybackTargets() override;
     void invalidatePlaybackTargets() override;
index 1644994..083ad41 100644 (file)
@@ -110,7 +110,7 @@ AVOutputDeviceMenuControllerWKType *MediaPlaybackTargetPickerMac::devicePicker()
     return m_outputDeviceMenuController.get();
 }
 
-void MediaPlaybackTargetPickerMac::showPlaybackTargetPicker(const FloatRect& location, bool checkActiveRoute, bool useDefaultAppearance)
+void MediaPlaybackTargetPickerMac::showPlaybackTargetPicker(const FloatRect& location, bool checkActiveRoute, bool useDarkAppearance)
 {
     if (!client() || m_showingMenu)
         return;
@@ -119,7 +119,7 @@ void MediaPlaybackTargetPickerMac::showPlaybackTargetPicker(const FloatRect& loc
 
     m_showingMenu = true;
 
-    if ([devicePicker() showMenuForRect:location appearanceName:useDefaultAppearance ? NSAppearanceNameVibrantLight : NSAppearanceNameVibrantDark allowReselectionOfSelectedOutputDevice:!checkActiveRoute]) {
+    if ([devicePicker() showMenuForRect:location appearanceName:(useDarkAppearance ? NSAppearanceNameVibrantDark : NSAppearanceNameVibrantLight) allowReselectionOfSelectedOutputDevice:!checkActiveRoute]) {
         if (!checkActiveRoute)
             currentDeviceDidChange();
     }
index d31604a..31b32a1 100644 (file)
@@ -303,7 +303,7 @@ DragImageRef createDragImageForLink(Element& element, URL& url, const String& ti
 
     Page* page = element.document().page();
 
-    LocalDefaultSystemAppearance localAppearance(true, page ? page->defaultAppearance() : true);
+    LocalDefaultSystemAppearance localAppearance(true, page ? page->useDarkAppearance() : false);
 
     auto imageSize = layout.boundingRect.size();
 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
index 36c0a62..ef65be0 100644 (file)
@@ -40,7 +40,7 @@ class LocalDefaultSystemAppearance {
     WTF_MAKE_NONCOPYABLE(LocalDefaultSystemAppearance);
 
 public:
-    WEBCORE_EXPORT LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDefaultAppearance);
+    WEBCORE_EXPORT LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDarkAppearance);
     WEBCORE_EXPORT ~LocalDefaultSystemAppearance();
 
     bool usingDarkAppearance() const
index 667fbb4..62c5182 100644 (file)
@@ -35,19 +35,19 @@ namespace WebCore {
 static size_t recursionCount = 0;
 #endif
 
-LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDefaultAppearance)
+LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDarkAppearance)
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     if (recursionCount++)
         return;
 
     m_savedSystemAppearance = [NSAppearance currentAppearance];
-    m_usingDarkAppearance = useSystemAppearance && !useDefaultAppearance;
+    m_usingDarkAppearance = useSystemAppearance && useDarkAppearance;
 
     [NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:m_usingDarkAppearance ? NSAppearanceNameDarkAqua : NSAppearanceNameAqua]];
 #else
     UNUSED_PARAM(useSystemAppearance);
-    UNUSED_PARAM(useDefaultAppearance);
+    UNUSED_PARAM(useDarkAppearance);
 #endif
 }
 
index 25847e1..49028f1 100644 (file)
@@ -53,7 +53,7 @@ private:
 
     bool controlRequiresPreWhiteSpace(ControlPart part) const final { return part == PushButtonPart; }
 
-    void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDefaultAppearance) final;
+    void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) final;
     void inflateControlPaintRect(ControlPart, const ControlStates&, FloatRect&, float zoomFactor) const final;
 
     bool userPrefersReducedMotion() const final;
index b190c73..4831fff 100644 (file)
@@ -848,9 +848,9 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, const ControlStates& st
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
-void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDefaultAppearance)
+void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance)
 {
-    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDefaultAppearance);
+    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDarkAppearance);
 
     switch (part) {
         case CheckboxPart:
index 93f4676..d5700d1 100644 (file)
@@ -70,16 +70,16 @@ void MediaPlaybackTargetPickerMock::timerFired()
     currentDeviceDidChange();
 }
 
-void MediaPlaybackTargetPickerMock::showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDefaultAppearance)
+void MediaPlaybackTargetPickerMock::showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance)
 {
     if (!client() || m_showingMenu)
         return;
 
 #if LOG_DISABLED
     UNUSED_PARAM(checkActiveRoute);
-    UNUSED_PARAM(useDefaultAppearance);
+    UNUSED_PARAM(useDarkAppearance);
 #endif
-    LOG(Media, "MediaPlaybackTargetPickerMock::showPlaybackTargetPicker - checkActiveRoute = %i, useDefaultAppearance = %i", (int)checkActiveRoute, (int)useDefaultAppearance);
+    LOG(Media, "MediaPlaybackTargetPickerMock::showPlaybackTargetPicker - checkActiveRoute = %i, useDarkAppearance = %i", (int)checkActiveRoute, (int)useDarkAppearance);
 
     m_showingMenu = true;
     m_timer.startOneShot(timerInterval);
index 13cff1c..b017de8 100644 (file)
@@ -41,7 +41,7 @@ public:
 
     virtual ~MediaPlaybackTargetPickerMock();
 
-    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDefaultAppearance) override;
+    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) override;
     void startingMonitoringPlaybackTargets() override;
     void stopMonitoringPlaybackTargets() override;
     void invalidatePlaybackTargets() override;
index 339e71f..a8c19a3 100644 (file)
@@ -767,7 +767,7 @@ auto InlineTextBox::resolveStyleForMarkedText(const MarkedText& markedText, cons
     }
     case MarkedText::TextMatch: {
         // Text matches always use the light system appearance.
-        OptionSet<StyleColor::Options> styleColorOptions = { StyleColor::Options::UseSystemAppearance, StyleColor::Options::UseDefaultAppearance };
+        OptionSet<StyleColor::Options> styleColorOptions = { StyleColor::Options::UseSystemAppearance, StyleColor::Options::UseDarkAppearance };
 #if PLATFORM(MAC)
         style.textStyles.fillColor = renderer().theme().systemColor(CSSValueAppleSystemLabel, styleColorOptions);
 #endif
index 4c5d42a..1c62551 100644 (file)
@@ -2586,7 +2586,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph
 #endif
 
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(renderer().page().useSystemAppearance(), renderer().page().defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(renderer().page().useSystemAppearance(), renderer().page().useDarkAppearance());
 #endif
 
     // The dirtyRect is in the coords of the painting root.
index db16dda..41a6384 100644 (file)
@@ -2774,7 +2774,7 @@ void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRec
 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior)
 {
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(page().useSystemAppearance(), page().defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(page().useSystemAppearance(), page().useDarkAppearance());
 #endif
 
     IntRect pixelSnappedRectForIntegralPositionedItems = snappedIntRect(LayoutRect(clip));
index 2f9403d..54bde70 100644 (file)
@@ -303,7 +303,7 @@ bool RenderTheme::paint(const RenderBox& box, ControlStates& controlStates, cons
     case ButtonPart:
     case InnerSpinButtonPart:
         updateControlStatesForRenderer(box, controlStates);
-        Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.page().useSystemAppearance(), box.page().defaultAppearance());
+        Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.page().useSystemAppearance(), box.page().useDarkAppearance());
         return false;
     default:
         break;
index e7001bb..9a7e93c 100644 (file)
@@ -221,7 +221,7 @@ RenderThemeMac::RenderThemeMac()
 
 NSView *RenderThemeMac::documentViewFor(const RenderObject& o) const
 {
-    LocalDefaultSystemAppearance localAppearance(o.page().useSystemAppearance(), o.page().defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(o.page().useSystemAppearance(), o.page().useDarkAppearance());
     ControlStates states(extractControlStatesForRenderer(o));
     return ThemeMac::ensuredView(&o.view().frameView(), states);
 }
@@ -316,14 +316,14 @@ String RenderThemeMac::imageControlsStyleSheet() const
 
 Color RenderThemeMac::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor selectedTextBackgroundColor]);
 }
 
 Color RenderThemeMac::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor unemphasizedSelectedTextBackgroundColor]);
 #else
     UNUSED_PARAM(options);
@@ -333,13 +333,13 @@ Color RenderThemeMac::platformInactiveSelectionBackgroundColor(OptionSet<StyleCo
 
 bool RenderThemeMac::supportsSelectionForegroundColors(OptionSet<StyleColor::Options> options) const
 {
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return localAppearance.usingDarkAppearance();
 }
 
 Color RenderThemeMac::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     if (localAppearance.usingDarkAppearance())
         return colorFromNSColor([NSColor selectedTextColor]);
     return { };
@@ -348,7 +348,7 @@ Color RenderThemeMac::platformActiveSelectionForegroundColor(OptionSet<StyleColo
 Color RenderThemeMac::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     if (localAppearance.usingDarkAppearance())
         return colorFromNSColor([NSColor unemphasizedSelectedTextColor]);
     return { };
@@ -361,7 +361,7 @@ Color RenderThemeMac::platformInactiveSelectionForegroundColor(OptionSet<StyleCo
 Color RenderThemeMac::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor selectedContentBackgroundColor]);
 #else
     UNUSED_PARAM(options);
@@ -372,7 +372,7 @@ Color RenderThemeMac::platformActiveListBoxSelectionBackgroundColor(OptionSet<St
 Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor unemphasizedSelectedContentBackgroundColor]);
 #else
     UNUSED_PARAM(options);
@@ -382,14 +382,14 @@ Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor(OptionSet<
 
 Color RenderThemeMac::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor alternateSelectedControlTextColor]);
 }
 
 Color RenderThemeMac::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor unemphasizedSelectedTextColor]);
 #else
     UNUSED_PARAM(options);
@@ -407,7 +407,7 @@ Color RenderThemeMac::platformFocusRingColor(OptionSet<StyleColor::Options> opti
 Color RenderThemeMac::platformActiveTextSearchHighlightColor(OptionSet<StyleColor::Options> options) const
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
-    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDarkAppearance));
     return colorFromNSColor([NSColor findHighlightColor]);
 #else
     UNUSED_PARAM(options);
@@ -525,8 +525,8 @@ void RenderThemeMac::platformColorsDidChange()
 auto RenderThemeMac::colorCache(OptionSet<StyleColor::Options> options) const -> ColorCache&
 {
     const bool useSystemAppearance = options.contains(StyleColor::Options::UseSystemAppearance);
-    const bool useDefaultAppearance = options.contains(StyleColor::Options::UseDefaultAppearance);
-    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDefaultAppearance);
+    const bool useDarkAppearance = options.contains(StyleColor::Options::UseDarkAppearance);
+    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDarkAppearance);
     if (localAppearance.usingDarkAppearance())
         return m_darkColorCache;
     return RenderTheme::colorCache(options);
@@ -535,10 +535,10 @@ auto RenderThemeMac::colorCache(OptionSet<StyleColor::Options> options) const ->
 Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
 {
     const bool useSystemAppearance = options.contains(StyleColor::Options::UseSystemAppearance);
-    const bool useDefaultAppearance = options.contains(StyleColor::Options::UseDefaultAppearance);
+    const bool useDarkAppearance = options.contains(StyleColor::Options::UseDarkAppearance);
     const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
 
-    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDefaultAppearance);
+    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDarkAppearance);
 
     auto& cache = colorCache(options);
 
@@ -1605,7 +1605,7 @@ void RenderThemeMac::setPopupButtonCellState(const RenderObject& o, const IntSiz
 
 void RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary(NSCell* cell, const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
 {
-    LocalDefaultSystemAppearance localAppearance(renderer.page().useSystemAppearance(), renderer.page().defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(renderer.page().useSystemAppearance(), renderer.page().useDarkAppearance());
     bool shouldDrawFocusRing = isFocused(renderer) && renderer.style().outlineStyleIsAuto() == OutlineIsAuto::On;
     bool shouldUseImageBuffer = renderer.style().effectiveZoom() != 1 || renderer.page().pageScaleFactor() != 1;
     bool shouldDrawCell = true;
@@ -1687,7 +1687,7 @@ bool RenderThemeMac::paintSliderThumb(const RenderObject& o, const PaintInfo& pa
         ? sliderThumbVertical()
         : sliderThumbHorizontal();
 
-    LocalDefaultSystemAppearance localAppearance(o.page().useSystemAppearance(), o.page().defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(o.page().useSystemAppearance(), o.page().useDarkAppearance());
 
     LocalCurrentGraphicsContext localContext(paintInfo.context());
 
index aac2543..bd1f632 100644 (file)
@@ -324,7 +324,7 @@ ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec
     }
 
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(m_page->useSystemAppearance(), m_page->defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(m_page->useSystemAppearance(), m_page->useDarkAppearance());
 #endif
 
     view->paint(context, intersection(context.clipBounds(), enclosingIntRect(srcRect)));
index 2519397..6758b8f 100644 (file)
@@ -1,3 +1,55 @@
+2018-07-05  Timothy Hatcher  <timothy@apple.com>
+
+        Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
+        https://bugs.webkit.org/show_bug.cgi?id=187369
+        rdar://problem/41870420
+
+        Reviewed by Tim Horton.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _effectiveAppearanceIsDark]):
+        (-[WKWebView _initializeWithConfiguration:]):
+        (-[WKWebView _setUseSystemAppearance:]):
+        (-[WKWebView effectiveAppearanceDidChange]):
+        (-[WKWebView _defaultAppearance]): Deleted.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _effectiveAppearanceIsDark]):
+        (-[WKView effectiveAppearanceDidChange]):
+        (-[WKView _setUseSystemAppearance:]):
+        (-[WKView _defaultAppearance]): Deleted.
+        (-[WKView _setDefaultAppearance:]): Deleted.
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::effectiveAppearanceIsDark):
+        (WebKit::WebViewImpl::setUseDarkAppearance):
+        (WebKit::WebViewImpl::useDefaultAppearance): Deleted.
+        (WebKit::WebViewImpl::setDefaultAppearance): Deleted.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        (WebKit::WebPageProxy::setUseDarkAppearance):
+        (WebKit::WebPageProxy::showPlaybackTargetPicker):
+        (WebKit::WebPageProxy::setDefaultAppearance): Deleted.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::useDarkAppearance const):
+        (WebKit::WebPageProxy::defaultAppearance const): Deleted.
+        * UIProcess/mac/WKPrintingView.mm:
+        (-[WKPrintingView drawRect:]):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+        (WebKit::InjectedBundleRangeHandle::renderedImage):
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::paintControlForLayerInContext):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_credentialsMessenger):
+        (WebKit::WebPage::drawRect):
+        (WebKit::WebPage::setUseDarkAppearance):
+        (WebKit::WebPage::setDefaultAppearance): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2018-07-05  Brian Burg  <bburg@apple.com>
 
         REGRESSION: ASSERT under WebAutomationSessionProxy::computeElementLayout when elementInViewClientCenterPoint returns nullopt
index 3b0b8aa..5c01b7f 100644 (file)
@@ -81,7 +81,7 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const
 #if PLATFORM(MAC)
     encoder << colorSpace;
     encoder << useSystemAppearance;
-    encoder << defaultAppearance;
+    encoder << useDarkAppearance;
 #endif
 #if PLATFORM(IOS)
     encoder << screenSize;
@@ -239,7 +239,7 @@ std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::
         return std::nullopt;
     if (!decoder.decode(parameters.useSystemAppearance))
         return std::nullopt;
-    if (!decoder.decode(parameters.defaultAppearance))
+    if (!decoder.decode(parameters.useDarkAppearance))
         return std::nullopt;
 #endif
 
index 06f7ab6..1687b5f 100644 (file)
@@ -138,7 +138,7 @@ struct WebPageCreationParameters {
 #if PLATFORM(MAC)
     ColorSpaceData colorSpace;
     bool useSystemAppearance;
-    bool defaultAppearance;
+    bool useDarkAppearance;
 #endif
 #if PLATFORM(IOS)
     WebCore::FloatSize screenSize;
index 4233b20..ac006b7 100644 (file)
@@ -465,9 +465,9 @@ static uint32_t convertSystemLayoutDirection(NSUserInterfaceLayoutDirection dire
     return static_cast<uint32_t>(WebCore::UserInterfaceLayoutDirection::LTR);
 }
 
-- (bool)_defaultAppearance
+- (bool)_effectiveAppearanceIsDark
 {
-    return _impl->useDefaultAppearance();
+    return _impl->effectiveAppearanceIsDark();
 }
 
 #endif // PLATFORM(MAC)
@@ -691,7 +691,7 @@ static void validate(WKWebViewConfiguration *configuration)
 
     _impl->setAutomaticallyAdjustsContentInsets(true);
     _impl->setRequiresUserActionForEditingControlsManager([configuration _requiresUserActionForEditingControlsManager]);
-    _impl->setDefaultAppearance([self _defaultAppearance]);
+    _impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 #endif
 
 #if ENABLE(ACCESSIBILITY_EVENTS)
@@ -6268,7 +6268,7 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
 {
     _impl->setUseSystemAppearance(useSystemAppearance);
-    _impl->setDefaultAppearance([self _defaultAppearance]);
+    _impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (void)effectiveAppearanceDidChange
@@ -6278,7 +6278,7 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
     if (!_impl)
         return;
 
-    _impl->setDefaultAppearance([self _defaultAppearance]);
+    _impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (void)_setHeaderBannerHeight:(int)height
index a18e0fb..e4f60a9 100644 (file)
@@ -1622,20 +1622,20 @@ static _WKOverlayScrollbarStyle toAPIScrollbarStyle(std::optional<WebCore::Scrol
     _data->_impl->setShouldSuppressFirstResponderChanges(shouldSuppress);
 }
 
-- (bool)_defaultAppearance
+- (bool)_effectiveAppearanceIsDark
 {
-    return _data->_impl->useDefaultAppearance();
+    return _data->_impl->effectiveAppearanceIsDark();
 }
 
 - (void)effectiveAppearanceDidChange
 {
-    _data->_impl->setDefaultAppearance([self _defaultAppearance]);
+    _data->_impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
 {
     _data->_impl->setUseSystemAppearance(useSystemAppearance);
-    _data->_impl->setDefaultAppearance([self _defaultAppearance]);
+    _data->_impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (BOOL)_useSystemAppearance
@@ -1643,12 +1643,6 @@ static _WKOverlayScrollbarStyle toAPIScrollbarStyle(std::optional<WebCore::Scrol
     return _data->_impl->useSystemAppearance();
 }
 
-- (void)_setDefaultAppearance:(BOOL)defaultAppearance
-{
-    _data->_impl->setDefaultAppearance(defaultAppearance);
-}
-
-
 @end
 
 #endif // PLATFORM(MAC)
index 164bac3..cf49825 100644 (file)
@@ -538,8 +538,8 @@ public:
     
     void setUseSystemAppearance(bool);
     bool useSystemAppearance();
-    void setDefaultAppearance(bool);
-    bool useDefaultAppearance();
+    void setUseDarkAppearance(bool);
+    bool effectiveAppearanceIsDark();
 
 private:
 #if HAVE(TOUCH_BAR)
index e8518ca..77a0928 100644 (file)
@@ -5013,19 +5013,19 @@ bool WebViewImpl::useSystemAppearance()
     return m_page->useSystemAppearance();
 }
 
-bool WebViewImpl::useDefaultAppearance()
+bool WebViewImpl::effectiveAppearanceIsDark()
 {
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     NSAppearanceName appearance = [[m_view effectiveAppearance] bestMatchFromAppearancesWithNames:@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
-    return [appearance isEqualToString:NSAppearanceNameAqua];
+    return [appearance isEqualToString:NSAppearanceNameDarkAqua];
 #else
-    return true;
+    return false;
 #endif
 }
 
-void WebViewImpl::setDefaultAppearance(bool defaultAppearance)
+void WebViewImpl::setUseDarkAppearance(bool useDarkAppearance)
 {
-    m_page->setDefaultAppearance(defaultAppearance);
+    m_page->setUseDarkAppearance(useDarkAppearance);
 }
 
 } // namespace WebKit
index d9da02b..6ce35d5 100644 (file)
@@ -6184,7 +6184,7 @@ WebPageCreationParameters WebPageProxy::creationParameters()
 #if PLATFORM(MAC)
     parameters.colorSpace = m_pageClient.colorSpace();
     parameters.useSystemAppearance = m_useSystemAppearance;
-    parameters.defaultAppearance = m_defaultAppearance;
+    parameters.useDarkAppearance = m_useDarkAppearance;
 #endif
 #if PLATFORM(IOS)
     parameters.screenSize = screenSize();
@@ -7308,16 +7308,16 @@ void WebPageProxy::setUseSystemAppearance(bool useSystemAppearance)
     m_process->send(Messages::WebPage::SetUseSystemAppearance(useSystemAppearance), m_pageID);
 }
     
-void WebPageProxy::setDefaultAppearance(bool defaultAppearance)
+void WebPageProxy::setUseDarkAppearance(bool useDarkAppearance)
 {
     if (!isValid())
         return;
-    
-    if (defaultAppearance == m_defaultAppearance)
+
+    if (useDarkAppearance == m_useDarkAppearance)
         return;
-    
-    m_defaultAppearance = defaultAppearance;
-    m_process->send(Messages::WebPage::SetDefaultAppearance(defaultAppearance), m_pageID);
+
+    m_useDarkAppearance = useDarkAppearance;
+    m_process->send(Messages::WebPage::SetUseDarkAppearance(useDarkAppearance), m_pageID);
 }
 
 void WebPageProxy::setHeaderBannerHeightForTesting(int height)
@@ -7365,7 +7365,7 @@ void WebPageProxy::removePlaybackTargetPickerClient(uint64_t contextId)
 
 void WebPageProxy::showPlaybackTargetPicker(uint64_t contextId, const WebCore::FloatRect& rect, bool hasVideo)
 {
-    m_pageClient.mediaSessionManager().showPlaybackTargetPicker(*this, contextId, m_pageClient.rootViewToScreen(IntRect(rect)), hasVideo, m_defaultAppearance);
+    m_pageClient.mediaSessionManager().showPlaybackTargetPicker(*this, contextId, m_pageClient.rootViewToScreen(IntRect(rect)), hasVideo, m_useDarkAppearance);
 }
 
 void WebPageProxy::playbackTargetPickerClientStateDidChange(uint64_t contextId, WebCore::MediaProducer::MediaStateFlags state)
index ac06918..796a910 100644 (file)
@@ -829,8 +829,8 @@ public:
 #if PLATFORM(MAC)
     void setUseSystemAppearance(bool);
     bool useSystemAppearance() const { return m_useSystemAppearance; }
-    void setDefaultAppearance(bool);
-    bool defaultAppearance() const { return m_defaultAppearance; }
+    void setUseDarkAppearance(bool);
+    bool useDarkAppearance() const { return m_useDarkAppearance; }
 #endif
 
 #if PLATFORM(COCOA)
@@ -1868,7 +1868,7 @@ private:
         
 #if PLATFORM(MAC)
     bool m_useSystemAppearance { false };
-    bool m_defaultAppearance { true };
+    bool m_useDarkAppearance { false };
 #endif
 
 #if ENABLE(APPLE_PAY)
index 6f699c9..9b18af9 100644 (file)
@@ -568,7 +568,7 @@ static CFStringRef linkDestinationName(PDFDocument *document, PDFDestination *de
     if (!page)
         return;
 
-    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->useDarkAppearance());
 
     if ([self _isPrintingPreview]) {
         [self _drawPreview:nsRect];
index 23d05f0..88b7d54 100644 (file)
@@ -125,7 +125,7 @@ RefPtr<WebImage> InjectedBundleRangeHandle::renderedImage(SnapshotOptions option
         return nullptr;
 
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(frame->page()->useSystemAppearance(), frame->page()->defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(frame->page()->useSystemAppearance(), frame->page()->useDarkAppearance());
 #endif
 
     Ref<Frame> protector(*frame);
index cd0c286..cae4306 100644 (file)
@@ -1215,7 +1215,7 @@ void PDFPlugin::paintControlForLayerInContext(CALayer *layer, CGContextRef conte
 {
 #if PLATFORM(MAC)
     auto* page = webFrame()->coreFrame()->page();
-    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->useDarkAppearance());
 #endif
 
     GraphicsContext graphicsContext(context);
index a3949ea..a705cb8 100644 (file)
@@ -511,7 +511,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters)
     setPaginationLineGridEnabled(parameters.paginationLineGridEnabled);
 #if PLATFORM(MAC)
     setUseSystemAppearance(parameters.useSystemAppearance);
-    setDefaultAppearance(parameters.defaultAppearance);
+    setUseDarkAppearance(parameters.useDarkAppearance);
 #endif
     // If the page is created off-screen, its visibilityState should be prerender.
     m_page->setActivityState(m_activityState);
@@ -1522,7 +1522,7 @@ void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffse
 void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
 {
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(m_page->useSystemAppearance(), m_page->defaultAppearance());
+    LocalDefaultSystemAppearance localAppearance(m_page->useSystemAppearance(), m_page->useDarkAppearance());
 #endif
 
     GraphicsContextStateSaver stateSaver(graphicsContext);
@@ -4205,9 +4205,9 @@ void WebPage::setUseSystemAppearance(bool useSystemAppearance)
     corePage()->setUseSystemAppearance(useSystemAppearance);
 }
     
-void WebPage::setDefaultAppearance(bool defaultAppearance)
+void WebPage::setUseDarkAppearance(bool useDarkAppearance)
 {
-    corePage()->setDefaultAppearance(defaultAppearance);
+    corePage()->setUseDarkAppearance(useDarkAppearance);
     RenderTheme::singleton().platformColorsDidChange();
     corePage()->setNeedsRecalcStyleInAllFrames();
 }
index 741e92f..486f85a 100644 (file)
@@ -519,7 +519,7 @@ public:
     void setBottomOverhangImage(WebImage*);
     
     void setUseSystemAppearance(bool);
-    void setDefaultAppearance(bool);
+    void setUseDarkAppearance(bool);
 #endif
 
     bool windowIsFocused() const;
index 686dafa..ff2f70b 100644 (file)
@@ -448,7 +448,7 @@ messages -> WebPage LegacyReceiver {
     HandleAcceptedCandidate(struct WebCore::TextCheckingResult acceptedCandidate)
 
     SetUseSystemAppearance(bool useSystemAppearance);
-    SetDefaultAppearance(bool defaultAppearance);
+    SetUseDarkAppearance(bool useDarkAppearance);
 
     SetHeaderBannerHeightForTesting(int height);
     SetFooterBannerHeightForTesting(int height);
index 70c95f0..2482fbb 100644 (file)
@@ -1,3 +1,19 @@
+2018-07-05  Timothy Hatcher  <timothy@apple.com>
+
+        Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
+        https://bugs.webkit.org/show_bug.cgi?id=187369
+        rdar://problem/41870420
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebMediaPlaybackTargetPicker.mm:
+        (WebMediaPlaybackTargetPicker::showPlaybackTargetPicker):
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView _effectiveAppearanceIsDark]):
+        (-[WebView _updateDefaultAppearance]):
+        (-[WebView _defaultAppearance]): Deleted.
+
 2018-07-04  Ryosuke Niwa  <rniwa@webkit.org>
 
         Youtube video pages crash after a couple of minutes
index 99a36ee..550b03e 100644 (file)
@@ -53,7 +53,7 @@ void WebMediaPlaybackTargetPicker::removePlaybackTargetPickerClient(uint64_t con
 
 void WebMediaPlaybackTargetPicker::showPlaybackTargetPicker(uint64_t contextId, const WebCore::FloatRect& rect, bool hasVideo)
 {
-    WebCore::WebMediaSessionManager::shared().showPlaybackTargetPicker(*this, contextId, WebCore::IntRect(rect), hasVideo, m_page ? m_page->defaultAppearance() : true);
+    WebCore::WebMediaSessionManager::shared().showPlaybackTargetPicker(*this, contextId, WebCore::IntRect(rect), hasVideo, m_page ? m_page->useDarkAppearance() : false);
 }
 
 void WebMediaPlaybackTargetPicker::playbackTargetPickerClientStateDidChange(uint64_t contextId, WebCore::MediaProducer::MediaStateFlags state)
index 57310f7..4de4edc 100644 (file)
@@ -1574,7 +1574,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
         ResourceHandle::forceContentSniffing();
 
     _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
-    _private->page->setDefaultAppearance([self _defaultAppearance]);
+    _private->page->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 #endif
 
     _private->page->settings().setContentDispositionAttachmentSandboxEnabled(true);
@@ -5275,19 +5275,19 @@ static Vector<String> toStringVector(NSArray* patterns)
     return insets;
 }
 
-- (bool)_defaultAppearance
+- (bool)_effectiveAppearanceIsDark
 {
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     NSAppearanceName appearance = [[self effectiveAppearance] bestMatchFromAppearancesWithNames:@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
-    return [appearance isEqualToString:NSAppearanceNameAqua];
+    return [appearance isEqualToString:NSAppearanceNameDarkAqua];
 #else
-    return true;
+    return false;
 #endif
 }
 
 - (void)_updateDefaultAppearance
 {
-    _private->page->setDefaultAppearance([self _defaultAppearance]);
+    _private->page->setUseDarkAppearance(self._effectiveAppearanceIsDark);
     RenderTheme::singleton().platformColorsDidChange();
     _private->page->setNeedsRecalcStyleInAllFrames();
 }