Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUser...
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jun 2019 21:39:36 +0000 (21:39 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jun 2019 21:39:36 +0000 (21:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199336
rdar://problem/52348938

Reviewed by Tim Horton.

Source/WebCore:

* css/StyleColor.h:
* dom/Document.cpp:
(WebCore::Document::useElevatedUserInterfaceLevel const):
(WebCore::Document::styleColorOptions const):
(WebCore::Document::useInactiveAppearance const): Deleted.
* dom/Document.h:
* page/Page.cpp:
(WebCore::Page::effectiveAppearanceDidChange):
* page/Page.h:
(WebCore::Page::useElevatedUserInterfaceLevel const):
(WebCore::Page::useInactiveAppearance const): Deleted.
* platform/ios/LocalCurrentTraitCollection.h:
(WebCore::LocalCurrentTraitCollection::usingElevatedUserInterfaceLevel const):
(WebCore::LocalCurrentTraitCollection::usingBaseLevelAppearance const): Deleted.
* platform/ios/LocalCurrentTraitCollection.mm:
(WebCore::LocalCurrentTraitCollection::LocalCurrentTraitCollection):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemColor const):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setUseDarkAppearanceInternal):

Source/WebKit:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _effectiveUserInterfaceLevelIsElevated]):
(-[WKWebView _effectiveAppearanceIsInactive]): Deleted.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::effectiveUserInterfaceLevelIsElevated):
(WebKit::WebViewImpl::effectiveAppearanceIsInactive): Deleted.
* UIProcess/PageClient.h:
(WebKit::PageClient::effectiveUserInterfaceLevelIsElevated const):
(WebKit::PageClient::effectiveAppearanceIsInactive const): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::useElevatedUserInterfaceLevel const):
(WebKit::WebPageProxy::effectiveAppearanceDidChange):
(WebKit::WebPageProxy::useInactiveAppearance const): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
(WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
(WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetUseDarkAppearance):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shrinkToFitContentTimer):
(WebKit::WebPage::effectiveAppearanceDidChange):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _setUseDarkAppearance:]):
(-[WebView _useElevatedUserInterfaceLevel]):
(-[WebView _setUseElevatedUserInterfaceLevel:]):
(-[WebView _setUseDarkAppearance:useInactiveAppearance:]):
(-[WebView _setUseDarkAppearance:useElevatedUserInterfaceLevel:]):
(-[WebView _effectiveUserInterfaceLevelIsElevated]):
(-[WebView viewDidChangeEffectiveAppearance]):
(-[WebView _useInactiveAppearance]): Deleted.
(-[WebView _setUseInactiveAppearance:]): Deleted.
(-[WebView _effectiveAppearanceIsInactive]): Deleted.
* WebView/WebViewPrivate.h:

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

31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/StyleColor.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/platform/ios/LocalCurrentTraitCollection.h
Source/WebCore/platform/ios/LocalCurrentTraitCollection.mm
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/testing/InternalSettings.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/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/mac/PageClientImplMac.h
Source/WebKit/UIProcess/mac/PageClientImplMac.mm
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
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/WebView.mm
Source/WebKitLegacy/mac/WebView/WebViewPrivate.h

index 6a894ca..430ec3b 100644 (file)
@@ -1,3 +1,32 @@
+2019-06-28  Timothy Hatcher  <timothy@apple.com>
+
+        Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
+        https://bugs.webkit.org/show_bug.cgi?id=199336
+        rdar://problem/52348938
+
+        Reviewed by Tim Horton.
+
+        * css/StyleColor.h:
+        * dom/Document.cpp:
+        (WebCore::Document::useElevatedUserInterfaceLevel const):
+        (WebCore::Document::styleColorOptions const):
+        (WebCore::Document::useInactiveAppearance const): Deleted.
+        * dom/Document.h:
+        * page/Page.cpp:
+        (WebCore::Page::effectiveAppearanceDidChange):
+        * page/Page.h:
+        (WebCore::Page::useElevatedUserInterfaceLevel const):
+        (WebCore::Page::useInactiveAppearance const): Deleted.
+        * platform/ios/LocalCurrentTraitCollection.h:
+        (WebCore::LocalCurrentTraitCollection::usingElevatedUserInterfaceLevel const):
+        (WebCore::LocalCurrentTraitCollection::usingBaseLevelAppearance const): Deleted.
+        * platform/ios/LocalCurrentTraitCollection.mm:
+        (WebCore::LocalCurrentTraitCollection::LocalCurrentTraitCollection):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::systemColor const):
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::setUseDarkAppearanceInternal):
+
 2019-06-28  Simon Fraser  <simon.fraser@apple.com>
 
         REGRESSION (r239984): pages with custom scrollbars also show normal scrollbars
index 853e4ab..1448ade 100644 (file)
@@ -55,7 +55,7 @@ public:
         ForVisitedLink = 1 << 0,
         UseSystemAppearance = 1 << 1,
         UseDarkAppearance = 1 << 2,
-        UseInactiveAppearance = 1 << 3
+        UseElevatedUserInterfaceLevel = 1 << 3
     };
 
     static Color colorFromKeyword(CSSValueID, OptionSet<Options>);
index 43dc4ad..78e5912 100644 (file)
@@ -6958,10 +6958,10 @@ bool Document::useDarkAppearance(const RenderStyle* style) const
     return false;
 }
 
-bool Document::useInactiveAppearance() const
+bool Document::useElevatedUserInterfaceLevel() const
 {
     if (auto* documentPage = page())
-        return documentPage->useInactiveAppearance();
+        return documentPage->useElevatedUserInterfaceLevel();
     return false;
 }
 
@@ -6972,8 +6972,8 @@ OptionSet<StyleColor::Options> Document::styleColorOptions(const RenderStyle* st
         options.add(StyleColor::Options::UseSystemAppearance);
     if (useDarkAppearance(style))
         options.add(StyleColor::Options::UseDarkAppearance);
-    if (useInactiveAppearance())
-        options.add(StyleColor::Options::UseInactiveAppearance);
+    if (useElevatedUserInterfaceLevel())
+        options.add(StyleColor::Options::UseElevatedUserInterfaceLevel);
     return options;
 }
 
index 8e92d80..a1c8b14 100644 (file)
@@ -564,7 +564,7 @@ public:
     float deviceScaleFactor() const;
 
     WEBCORE_EXPORT bool useSystemAppearance() const;
-    WEBCORE_EXPORT bool useInactiveAppearance() const;
+    WEBCORE_EXPORT bool useElevatedUserInterfaceLevel() const;
     WEBCORE_EXPORT bool useDarkAppearance(const RenderStyle*) const;
 
     OptionSet<StyleColor::Options> styleColorOptions(const RenderStyle*) const;
index 90e4c93..518c7a2 100644 (file)
@@ -2727,14 +2727,14 @@ void Page::setUseSystemAppearance(bool value)
     }
 }
 
-void Page::effectiveAppearanceDidChange(bool useDarkAppearance, bool useInactiveAppearance)
+void Page::effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
 {
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    if (m_useDarkAppearance == useDarkAppearance && m_useInactiveAppearance == useInactiveAppearance)
+    if (m_useDarkAppearance == useDarkAppearance && m_useElevatedUserInterfaceLevel == useElevatedUserInterfaceLevel)
         return;
 
     m_useDarkAppearance = useDarkAppearance;
-    m_useInactiveAppearance = useInactiveAppearance;
+    m_useElevatedUserInterfaceLevel = useElevatedUserInterfaceLevel;
 
     InspectorInstrumentation::defaultAppearanceDidChange(*this, useDarkAppearance);
 
@@ -2742,10 +2742,10 @@ void Page::effectiveAppearanceDidChange(bool useDarkAppearance, bool useInactive
 #else
     UNUSED_PARAM(useDarkAppearance);
 
-    if (m_useInactiveAppearance == useInactiveAppearance)
+    if (m_useElevatedUserInterfaceLevel == useElevatedUserInterfaceLevel)
         return;
 
-    m_useInactiveAppearance = useInactiveAppearance;
+    m_useElevatedUserInterfaceLevel = useElevatedUserInterfaceLevel;
 
     appearanceDidChange();
 #endif
index e7a1eae..2fab6e2 100644 (file)
@@ -380,8 +380,8 @@ public:
     WEBCORE_EXPORT void setUseSystemAppearance(bool);
     
     WEBCORE_EXPORT bool useDarkAppearance() const;
-    bool useInactiveAppearance() const { return m_useInactiveAppearance; }
-    WEBCORE_EXPORT void effectiveAppearanceDidChange(bool useDarkAppearance, bool useInactiveAppearance);
+    bool useElevatedUserInterfaceLevel() const { return m_useElevatedUserInterfaceLevel; }
+    WEBCORE_EXPORT void effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel);
     bool defaultUseDarkAppearance() const { return m_useDarkAppearance; }
     void setUseDarkAppearanceOverride(Optional<bool>);
 
@@ -837,7 +837,7 @@ private:
 #endif
     
     bool m_useSystemAppearance { false };
-    bool m_useInactiveAppearance { false };
+    bool m_useElevatedUserInterfaceLevel { false };
     bool m_useDarkAppearance { false };
     Optional<bool> m_useDarkAppearanceOverride;
 
index 626b014..87da9dd 100644 (file)
@@ -40,7 +40,7 @@ class LocalCurrentTraitCollection {
     WTF_MAKE_NONCOPYABLE(LocalCurrentTraitCollection);
 
 public:
-    WEBCORE_EXPORT LocalCurrentTraitCollection(bool useDarkAppearance, bool useBaseLevelAppearance);
+    WEBCORE_EXPORT LocalCurrentTraitCollection(bool useDarkAppearance, bool useElevatedUserInterfaceLevel);
     WEBCORE_EXPORT LocalCurrentTraitCollection(UITraitCollection *);
     WEBCORE_EXPORT ~LocalCurrentTraitCollection();
 
@@ -53,12 +53,12 @@ public:
 #endif
     }
 
-    bool usingBaseLevelAppearance() const
+    bool usingElevatedUserInterfaceLevel() const
     {
 #if HAVE(OS_DARK_MODE_SUPPORT)
-        return m_usingBaseLevelAppearance;
+        return m_usingElevatedUserInterfaceLevel;
 #else
-        return true;
+        return false;
 #endif
     }
 
@@ -66,7 +66,7 @@ private:
 #if HAVE(OS_DARK_MODE_SUPPORT)
     RetainPtr<UITraitCollection> m_savedTraitCollection;
     bool m_usingDarkAppearance { false };
-    bool m_usingBaseLevelAppearance { true };
+    bool m_usingElevatedUserInterfaceLevel { false };
 #endif
 };
 
index 193567a..f906701 100644 (file)
 
 namespace WebCore {
 
-LocalCurrentTraitCollection::LocalCurrentTraitCollection(bool useDarkAppearance, bool useBaseLevelAppearance)
+LocalCurrentTraitCollection::LocalCurrentTraitCollection(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
 {
 #if HAVE(OS_DARK_MODE_SUPPORT)
     m_savedTraitCollection = [PAL::getUITraitCollectionClass() _currentTraitCollection];
     m_usingDarkAppearance = useDarkAppearance;
-    m_usingBaseLevelAppearance = useBaseLevelAppearance;
+    m_usingElevatedUserInterfaceLevel = useElevatedUserInterfaceLevel;
 
     auto userInterfaceStyleTrait = [PAL::getUITraitCollectionClass() traitCollectionWithUserInterfaceStyle:m_usingDarkAppearance ? UIUserInterfaceStyleDark : UIUserInterfaceStyleLight];
-    auto backgroundLevelTrait = [PAL::getUITraitCollectionClass() traitCollectionWithUserInterfaceLevel:m_usingBaseLevelAppearance ? UIUserInterfaceLevelBase : UIUserInterfaceLevelElevated];
+    auto backgroundLevelTrait = [PAL::getUITraitCollectionClass() traitCollectionWithUserInterfaceLevel:m_usingElevatedUserInterfaceLevel ? UIUserInterfaceLevelElevated : UIUserInterfaceLevelBase];
     auto newTraitCollection = [PAL::getUITraitCollectionClass() traitCollectionWithTraitsFromCollections:@[ m_savedTraitCollection.get(), userInterfaceStyleTrait, backgroundLevelTrait ]];
 
     [PAL::getUITraitCollectionClass() _setCurrentTraitCollection:newTraitCollection];
 #else
     UNUSED_PARAM(useDarkAppearance);
-    UNUSED_PARAM(useBaseLevelAppearance);
+    UNUSED_PARAM(useElevatedUserInterfaceLevel);
 #endif
 }
 
@@ -54,7 +54,7 @@ LocalCurrentTraitCollection::LocalCurrentTraitCollection(UITraitCollection *trai
 #if HAVE(OS_DARK_MODE_SUPPORT)
     m_savedTraitCollection = [PAL::getUITraitCollectionClass() _currentTraitCollection];
     m_usingDarkAppearance = traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark;
-    m_usingBaseLevelAppearance = traitCollection.userInterfaceLevel == UIUserInterfaceLevelBase;
+    m_usingElevatedUserInterfaceLevel = traitCollection.userInterfaceLevel == UIUserInterfaceLevelElevated;
 
     [PAL::getUITraitCollectionClass() _setCurrentTraitCollection:traitCollection];
 #else
index 9da48fe..1a6a7e5 100644 (file)
@@ -1444,8 +1444,8 @@ Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O
     auto& cache = colorCache(options);
     return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options] () -> Color {
         const bool useDarkAppearance = options.contains(StyleColor::Options::UseDarkAppearance);
-        const bool useInactiveAppearance = options.contains(StyleColor::Options::UseInactiveAppearance);
-        LocalCurrentTraitCollection localTraitCollection(useDarkAppearance, useInactiveAppearance);
+        const bool useElevatedUserInterfaceLevel = options.contains(StyleColor::Options::UseElevatedUserInterfaceLevel);
+        LocalCurrentTraitCollection localTraitCollection(useDarkAppearance, useElevatedUserInterfaceLevel);
 
         auto cssColorToSelector = [cssValueID] () -> SEL {
             switch (cssValueID) {
index 16353d9..e723a47 100644 (file)
@@ -548,7 +548,7 @@ void InternalSettings::setUseDarkAppearanceInternal(bool useDarkAppearance)
     }
 #endif
     ASSERT(m_page);
-    m_page->effectiveAppearanceDidChange(useDarkAppearance, m_page->useInactiveAppearance());
+    m_page->effectiveAppearanceDidChange(useDarkAppearance, m_page->useElevatedUserInterfaceLevel());
 }
 
 ExceptionOr<void> InternalSettings::setUseDarkAppearance(bool useDarkAppearance)
index 38dac50..ea1a468 100644 (file)
@@ -1,3 +1,48 @@
+2019-06-28  Timothy Hatcher  <timothy@apple.com>
+
+        Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
+        https://bugs.webkit.org/show_bug.cgi?id=199336
+        rdar://problem/52348938
+
+        Reviewed by Tim Horton.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _effectiveUserInterfaceLevelIsElevated]):
+        (-[WKWebView _effectiveAppearanceIsInactive]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::effectiveUserInterfaceLevelIsElevated):
+        (WebKit::WebViewImpl::effectiveAppearanceIsInactive): Deleted.
+        * UIProcess/PageClient.h:
+        (WebKit::PageClient::effectiveUserInterfaceLevelIsElevated const):
+        (WebKit::PageClient::effectiveAppearanceIsInactive const): Deleted.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        (WebKit::WebPageProxy::useElevatedUserInterfaceLevel const):
+        (WebKit::WebPageProxy::effectiveAppearanceDidChange):
+        (WebKit::WebPageProxy::useInactiveAppearance const): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
+        (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
+        * UIProcess/mac/PageClientImplMac.h:
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
+        (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageSetUseDarkAppearance):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_shrinkToFitContentTimer):
+        (WebKit::WebPage::effectiveAppearanceDidChange):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2019-06-28  Jer Noble  <jer.noble@apple.com>
 
         Unreviewed maccatalyst build fix; add ENABLE(FULLSCREEN) checks around calls to fullScreenManager().
index 1b90d7c..85f1198 100644 (file)
@@ -78,7 +78,7 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << controlledByAutomation;
     encoder << isProcessSwap;
     encoder << useDarkAppearance;
-    encoder << useInactiveAppearance;
+    encoder << useElevatedUserInterfaceLevel;
 
 #if PLATFORM(MAC)
     encoder << colorSpace;
@@ -255,7 +255,7 @@ Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decod
         return WTF::nullopt;
     if (!decoder.decode(parameters.useDarkAppearance))
         return WTF::nullopt;
-    if (!decoder.decode(parameters.useInactiveAppearance))
+    if (!decoder.decode(parameters.useElevatedUserInterfaceLevel))
         return WTF::nullopt;
 
 #if PLATFORM(MAC)
index f4b17e5..8c88212 100644 (file)
@@ -138,7 +138,7 @@ struct WebPageCreationParameters {
     bool isProcessSwap { false };
 
     bool useDarkAppearance { false };
-    bool useInactiveAppearance { false };
+    bool useElevatedUserInterfaceLevel { false };
 
 #if PLATFORM(MAC)
     ColorSpaceData colorSpace;
index 3a19705..a2d2dfe 100644 (file)
@@ -480,10 +480,10 @@ static bool shouldAllowSettingAnyXHRHeaderFromFileURLs()
     return self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark;
 }
 
-- (BOOL)_effectiveAppearanceIsInactive
+- (BOOL)_effectiveUserInterfaceLevelIsElevated
 {
 #if HAVE(OS_DARK_MODE_SUPPORT) && !PLATFORM(WATCHOS)
-    return self.traitCollection.userInterfaceLevel != UIUserInterfaceLevelElevated;
+    return self.traitCollection.userInterfaceLevel == UIUserInterfaceLevelElevated;
 #else
     return NO;
 #endif
index d55abf4..6b24612 100644 (file)
@@ -171,7 +171,7 @@ struct PrintInfo;
 @property (nonatomic, readonly, getter=_isRetainingActiveFocusedState) BOOL _retainingActiveFocusedState;
 
 - (BOOL)_effectiveAppearanceIsDark;
-- (BOOL)_effectiveAppearanceIsInactive;
+- (BOOL)_effectiveUserInterfaceLevelIsElevated;
 #endif // PLATFORM(IOS_FAMILY)
 
 #if ENABLE(ATTACHMENT_ELEMENT)
index e40fd90..a3ba9ef 100644 (file)
@@ -599,7 +599,7 @@ public:
 
     void effectiveAppearanceDidChange();
     bool effectiveAppearanceIsDark();
-    bool effectiveAppearanceIsInactive();
+    bool effectiveUserInterfaceLevelIsElevated();
 
     void takeFocus(WebCore::FocusDirection);
 
index 254aef9..b907538 100644 (file)
@@ -5314,9 +5314,8 @@ bool WebViewImpl::effectiveAppearanceIsDark()
 #endif
 }
 
-bool WebViewImpl::effectiveAppearanceIsInactive()
+bool WebViewImpl::effectiveUserInterfaceLevelIsElevated()
 {
-    // FIXME: Use the window isKeyWindow state or view first responder status?
     return false;
 }
 
index 1d07801..41204ae 100644 (file)
@@ -327,7 +327,7 @@ public:
 #endif
 
     virtual bool effectiveAppearanceIsDark() const { return false; }
-    virtual bool effectiveAppearanceIsInactive() const { return false; }
+    virtual bool effectiveUserInterfaceLevelIsElevated() const { return false; }
 
     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
     virtual void exitAcceleratedCompositingMode() = 0;
index 2607b30..18ffde7 100644 (file)
@@ -7176,7 +7176,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
     parameters.layerHostingMode = m_layerHostingMode;
     parameters.controlledByAutomation = m_controlledByAutomation;
     parameters.useDarkAppearance = useDarkAppearance();
-    parameters.useInactiveAppearance = useInactiveAppearance();
+    parameters.useElevatedUserInterfaceLevel = useElevatedUserInterfaceLevel();
 #if PLATFORM(MAC)
     parameters.colorSpace = pageClient().colorSpace();
     parameters.useSystemAppearance = m_useSystemAppearance;
@@ -8704,9 +8704,9 @@ bool WebPageProxy::useDarkAppearance() const
     return pageClient().effectiveAppearanceIsDark();
 }
 
-bool WebPageProxy::useInactiveAppearance() const
+bool WebPageProxy::useElevatedUserInterfaceLevel() const
 {
-    return pageClient().effectiveAppearanceIsInactive();
+    return pageClient().effectiveUserInterfaceLevelIsElevated();
 }
 
 void WebPageProxy::effectiveAppearanceDidChange()
@@ -8714,7 +8714,7 @@ void WebPageProxy::effectiveAppearanceDidChange()
     if (!hasRunningProcess())
         return;
 
-    m_process->send(Messages::WebPage::EffectiveAppearanceDidChange(useDarkAppearance(), useInactiveAppearance()), m_pageID);
+    m_process->send(Messages::WebPage::EffectiveAppearanceDidChange(useDarkAppearance(), useElevatedUserInterfaceLevel()), m_pageID);
 }
 
 #if PLATFORM(COCOA)
index a80d15e..a19ee09 100644 (file)
@@ -954,7 +954,7 @@ public:
 
     void effectiveAppearanceDidChange();
     bool useDarkAppearance() const;
-    bool useInactiveAppearance() const;
+    bool useElevatedUserInterfaceLevel() const;
 
 #if PLATFORM(COCOA)
     // Called by the web process through a message.
index 42930c4..01cd86e 100644 (file)
@@ -142,7 +142,7 @@ private:
     void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&) override;
 
     bool effectiveAppearanceIsDark() const override;
-    bool effectiveAppearanceIsInactive() const override;
+    bool effectiveUserInterfaceLevelIsElevated() const override;
 
     void couldNotRestorePageState() override;
     void restorePageState(Optional<WebCore::FloatPoint>, const WebCore::FloatPoint&, const WebCore::FloatBoxExtent&, double) override;
index 248bb23..3999503 100644 (file)
@@ -481,9 +481,9 @@ bool PageClientImpl::effectiveAppearanceIsDark() const
     return [m_webView _effectiveAppearanceIsDark];
 }
 
-bool PageClientImpl::effectiveAppearanceIsInactive() const
+bool PageClientImpl::effectiveUserInterfaceLevelIsElevated() const
 {
-    return [m_webView _effectiveAppearanceIsInactive];
+    return [m_webView _effectiveUserInterfaceLevelIsElevated];
 }
 
 void PageClientImpl::setRemoteLayerTreeRootNode(RemoteLayerTreeNode* rootNode)
index b767fa9..a7fdb0b 100644 (file)
@@ -241,7 +241,7 @@ private:
 
     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
     bool effectiveAppearanceIsDark() const override;
-    bool effectiveAppearanceIsInactive() const override;
+    bool effectiveUserInterfaceLevelIsElevated() const override;
 
 #if ENABLE(DRAG_SUPPORT)
     void didPerformDragOperation(bool handled) final;
index 8124ec4..8214173 100644 (file)
@@ -944,9 +944,9 @@ bool PageClientImpl::effectiveAppearanceIsDark() const
     return m_impl->effectiveAppearanceIsDark();
 }
 
-bool PageClientImpl::effectiveAppearanceIsInactive() const
+bool PageClientImpl::effectiveUserInterfaceLevelIsElevated() const
 {
-    return m_impl->effectiveAppearanceIsInactive();
+    return m_impl->effectiveUserInterfaceLevelIsElevated();
 }
 
 void PageClientImpl::takeFocus(WebCore::FocusDirection direction)
index ac7be19..32eae27 100644 (file)
@@ -593,7 +593,7 @@ void WKBundlePageSetUseDarkAppearance(WKBundlePageRef pageRef, bool useDarkAppea
 {
     WebKit::WebPage* webPage = WebKit::toImpl(pageRef);
     if (WebCore::Page* page = webPage ? webPage->corePage() : nullptr)
-        page->effectiveAppearanceDidChange(useDarkAppearance, page->useInactiveAppearance());
+        page->effectiveAppearanceDidChange(useDarkAppearance, page->useElevatedUserInterfaceLevel());
 }
 
 bool WKBundlePageIsUsingDarkAppearance(WKBundlePageRef pageRef)
index 3962e28..3bcf0d7 100644 (file)
@@ -564,7 +564,7 @@ WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters)
     setGapBetweenPages(parameters.gapBetweenPages);
     setPaginationLineGridEnabled(parameters.paginationLineGridEnabled);
 
-    effectiveAppearanceDidChange(parameters.useDarkAppearance, parameters.useInactiveAppearance);
+    effectiveAppearanceDidChange(parameters.useDarkAppearance, parameters.useElevatedUserInterfaceLevel);
 
     if (parameters.isEditable)
         setEditable(true);
@@ -4656,9 +4656,9 @@ void WebPage::setUseSystemAppearance(bool useSystemAppearance)
 #endif
 
 #if !PLATFORM(GTK)
-void WebPage::effectiveAppearanceDidChange(bool useDarkAppearance, bool useInactiveAppearance)
+void WebPage::effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
 {
-    corePage()->effectiveAppearanceDidChange(useDarkAppearance, useInactiveAppearance);
+    corePage()->effectiveAppearanceDidChange(useDarkAppearance, useElevatedUserInterfaceLevel);
 }
 #endif
 
index 39d0c21..15bcb90 100644 (file)
@@ -553,7 +553,7 @@ public:
     void setUseSystemAppearance(bool);
 #endif
 
-    void effectiveAppearanceDidChange(bool useDarkAppearance, bool useInactiveAppearance);
+    void effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel);
 
     bool windowIsFocused() const;
     bool windowAndWebPageAreFocused() const;
index 6346cd0..dad2d5e 100644 (file)
@@ -489,7 +489,7 @@ GenerateSyntheticEditingCommand(enum:uint8_t WebKit::SyntheticEditingCommandType
     SetFooterBannerHeightForTesting(int height);
 #endif
 
-    EffectiveAppearanceDidChange(bool useDarkAppearance, bool useInactiveAppearance);
+    EffectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel);
 
 #if PLATFORM(COCOA)
     RequestActiveNowPlayingSessionInfo(WebKit::CallbackID callbackID)
index 4765790..c2c0d11 100644 (file)
@@ -1,3 +1,25 @@
+2019-06-28  Timothy Hatcher  <timothy@apple.com>
+
+        Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
+        https://bugs.webkit.org/show_bug.cgi?id=199336
+        rdar://problem/52348938
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView _setUseDarkAppearance:]):
+        (-[WebView _useElevatedUserInterfaceLevel]):
+        (-[WebView _setUseElevatedUserInterfaceLevel:]):
+        (-[WebView _setUseDarkAppearance:useInactiveAppearance:]):
+        (-[WebView _setUseDarkAppearance:useElevatedUserInterfaceLevel:]):
+        (-[WebView _effectiveUserInterfaceLevelIsElevated]):
+        (-[WebView viewDidChangeEffectiveAppearance]):
+        (-[WebView _useInactiveAppearance]): Deleted.
+        (-[WebView _setUseInactiveAppearance:]): Deleted.
+        (-[WebView _effectiveAppearanceIsInactive]): Deleted.
+        * WebView/WebViewPrivate.h:
+
 2019-06-28  Konstantin Tokarev  <annulen@yandex.ru>
 
         Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733
index d7cb659..262c74a 100644 (file)
@@ -1585,7 +1585,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 #endif
 
 #if HAVE(OS_DARK_MODE_SUPPORT) && PLATFORM(MAC)
-    _private->page->effectiveAppearanceDidChange(self._effectiveAppearanceIsDark, self._effectiveAppearanceIsInactive);
+    _private->page->effectiveAppearanceDidChange(self._effectiveAppearanceIsDark, self._effectiveUserInterfaceLevelIsElevated);
 #endif
 
     _private->page->settings().setContentDispositionAttachmentSandboxEnabled(true);
@@ -2496,28 +2496,34 @@ ALLOW_DEPRECATED_DECLARATIONS_END
 {
     if (!_private || !_private->page)
         return;
-    [self _setUseDarkAppearance:useDarkAppearance useInactiveAppearance:_private->page->useInactiveAppearance()];
+    [self _setUseDarkAppearance:useDarkAppearance useElevatedUserInterfaceLevel:_private->page->useElevatedUserInterfaceLevel()];
 }
 
-- (BOOL)_useInactiveAppearance
+- (BOOL)_useElevatedUserInterfaceLevel
 {
     if (!_private || !_private->page)
         return NO;
-    return _private->page->useInactiveAppearance();
+    return _private->page->useElevatedUserInterfaceLevel();
 }
 
-- (void)_setUseInactiveAppearance:(BOOL)useInactiveAppearance
+- (void)_setUseElevatedUserInterfaceLevel:(BOOL)useElevatedUserInterfaceLevel
 {
     if (!_private || !_private->page)
         return;
-    [self _setUseDarkAppearance:_private->page->useDarkAppearance() useInactiveAppearance:useInactiveAppearance];
+    [self _setUseDarkAppearance:_private->page->useDarkAppearance() useElevatedUserInterfaceLevel:useElevatedUserInterfaceLevel];
 }
 
 - (void)_setUseDarkAppearance:(BOOL)useDarkAppearance useInactiveAppearance:(BOOL)useInactiveAppearance
 {
+    // FIXME: Remove once UIWebView has moved off this old method.
+    [self _setUseDarkAppearance:useDarkAppearance useElevatedUserInterfaceLevel:!useInactiveAppearance];
+}
+
+- (void)_setUseDarkAppearance:(BOOL)useDarkAppearance useElevatedUserInterfaceLevel:(BOOL)useElevatedUserInterfaceLevel
+{
     if (!_private || !_private->page)
         return;
-    _private->page->effectiveAppearanceDidChange(useDarkAppearance, useInactiveAppearance);
+    _private->page->effectiveAppearanceDidChange(useDarkAppearance, useElevatedUserInterfaceLevel);
 }
 
 + (void)_setIconLoadingEnabled:(BOOL)enabled
@@ -5186,9 +5192,8 @@ static Vector<String> toStringVector(NSArray* patterns)
     return [appearance isEqualToString:NSAppearanceNameDarkAqua];
 }
 
-- (bool)_effectiveAppearanceIsInactive
+- (bool)_effectiveUserInterfaceLevelIsElevated
 {
-    // FIXME: Use the window isKeyWindow state or view first responder status?
     return false;
 }
 #endif
@@ -5215,7 +5220,7 @@ static Vector<String> toStringVector(NSArray* patterns)
     if (!_private || !_private->page)
         return;
 
-    _private->page->effectiveAppearanceDidChange(self._effectiveAppearanceIsDark, self._effectiveAppearanceIsInactive);
+    _private->page->effectiveAppearanceDidChange(self._effectiveAppearanceIsDark, self._effectiveUserInterfaceLevelIsElevated);
 }
 #endif
 
index 131277d..50aaf80 100644 (file)
@@ -324,9 +324,10 @@ typedef enum {
 + (BOOL)_isIconLoadingEnabled;
 
 @property (nonatomic, assign, setter=_setUseDarkAppearance:) BOOL _useDarkAppearance;
-@property (nonatomic, assign, setter=_setUseInactiveAppearance:) BOOL _useInactiveAppearance;
+@property (nonatomic, assign, setter=_setUseElevatedUserInterfaceLevel:) BOOL _useElevatedUserInterfaceLevel;
 
 - (void)_setUseDarkAppearance:(BOOL)useDarkAppearance useInactiveAppearance:(BOOL)useInactiveAppearance;
+- (void)_setUseDarkAppearance:(BOOL)useDarkAppearance useElevatedUserInterfaceLevel:(BOOL)useElevatedUserInterfaceLevel;
 
 - (WebInspector *)inspector;