Add WebView SPI to temporarily force light or dark appearance on a page.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2019 00:28:24 +0000 (00:28 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2019 00:28:24 +0000 (00:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194230

Reviewed by Tim Horton.

* WebView/WebView.mm:
(-[WebView _useDarkAppearance:]): Added.
(-[WebView _setUseDarkAppearance:]): Added.
* WebView/WebViewPrivate.h:

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

Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/mac/WebView/WebViewPrivate.h

index baa3226..088dac1 100644 (file)
@@ -1,3 +1,15 @@
+2019-02-04  Timothy Hatcher  <timothy@apple.com>
+
+        Add WebView SPI to temporarily force light or dark appearance on a page.
+        https://bugs.webkit.org/show_bug.cgi?id=194230
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebView.mm:
+        (-[WebView _useDarkAppearance:]): Added.
+        (-[WebView _setUseDarkAppearance:]): Added.
+        * WebView/WebViewPrivate.h:
+
 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
 
         PageOverlayController's layers should be created lazily
index 6630934..e6c482b 100644 (file)
@@ -2487,6 +2487,20 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     return newWindowWebView;
 }
 
+- (BOOL)_useDarkAppearance
+{
+    if (!_private || !_private->page)
+        return NO;
+    return _private->page->useDarkAppearance();
+}
+
+- (void)_setUseDarkAppearance:(BOOL)useDarkAppearance
+{
+    if (!_private || !_private->page)
+        return;
+    _private->page->setUseDarkAppearance(useDarkAppearance);
+}
+
 + (void)_setIconLoadingEnabled:(BOOL)enabled
 {
     iconLoadingEnabled = enabled;
index 299fe67..c25ee83 100644 (file)
@@ -322,6 +322,8 @@ typedef enum {
 + (void)_setIconLoadingEnabled:(BOOL)enabled;
 + (BOOL)_isIconLoadingEnabled;
 
+@property (nonatomic, assign, setter=_setUseDarkAppearance:) BOOL _useDarkAppearance;
+
 - (WebInspector *)inspector;
 
 #if ENABLE_REMOTE_INSPECTOR