Ensure that style is updated when the effective appearance changes
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2018 18:47:44 +0000 (18:47 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2018 18:47:44 +0000 (18:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183690
<rdar://problem/38385900>

Reviewed by Tim Horton and Wenson Hsieh.

Source/WebCore:

Only exposing a function to outside WebCore, no tests needed.

* page/Page.h:

Source/WebKit:

Respond to and respect the effective appearance changing.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView effectiveAppearanceDidChange]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setDefaultAppearance):

Source/WebKitLegacy/mac:

Respond to and respect the effective appearance changing.

* WebView/WebView.mm:
(-[WebView _setUseSystemAppearance:]):
(-[WebView effectiveAppearanceDidChange]):

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

Source/WebCore/ChangeLog
Source/WebCore/page/Page.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebView.mm

index ed48028..e5c01dc 100644 (file)
@@ -1,3 +1,15 @@
+2018-03-16  Megan Gardner  <megan_gardner@apple.com>
+
+        Ensure that style is updated when the effective appearance changes
+        https://bugs.webkit.org/show_bug.cgi?id=183690
+        <rdar://problem/38385900>
+
+        Reviewed by Tim Horton and Wenson Hsieh.
+
+        Only exposing a function to outside WebCore, no tests needed.
+
+        * page/Page.h:
+
 2018-03-16  Chris Dumez  <cdumez@apple.com>
 
         WebKit.RestoreSessionStateContainingScrollRestorationDefault API test is failing with async policy delegates
index 671eded..9fdd4d8 100644 (file)
@@ -160,7 +160,7 @@ public:
 
     WEBCORE_EXPORT uint64_t renderTreeSize() const;
 
-    void setNeedsRecalcStyleInAllFrames();
+    WEBCORE_EXPORT void setNeedsRecalcStyleInAllFrames();
 
     WEBCORE_EXPORT ViewportArguments viewportArguments() const;
 
index 688c3db..17cb56d 100644 (file)
@@ -1,3 +1,18 @@
+2018-03-16  Megan Gardner  <megan_gardner@apple.com>
+
+        Ensure that style is updated when the effective appearance changes
+        https://bugs.webkit.org/show_bug.cgi?id=183690
+        <rdar://problem/38385900>
+
+        Reviewed by Tim Horton and Wenson Hsieh.
+
+        Respond to and respect the effective appearance changing.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView effectiveAppearanceDidChange]):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setDefaultAppearance):
+
 2018-03-16  Chris Dumez  <cdumez@apple.com>
 
         URLSchemeHandler.Basic API test fails with async policy delegates
index 8c1148b..f41111a 100644 (file)
@@ -6181,6 +6181,11 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
     _page->setDefaultAppearance([self _defaultAppearance]);
 }
 
+- (void)effectiveAppearanceDidChange
+{
+    _page->setDefaultAppearance([self _defaultAppearance]);
+}
+
 - (void)_setHeaderBannerHeight:(int)height
 {
     _page->setHeaderBannerHeightForTesting(height);
index db12c97..f4ae7f0 100644 (file)
@@ -4130,6 +4130,7 @@ void WebPage::setUseSystemAppearance(bool useSystemAppearance)
 void WebPage::setDefaultAppearance(bool defaultAppearance)
 {
     corePage()->setDefaultAppearance(defaultAppearance);
+    corePage()->setNeedsRecalcStyleInAllFrames();
 }
 #endif
 
index 39303e7..8814cf2 100644 (file)
@@ -1,3 +1,17 @@
+2018-03-16  Megan Gardner  <megan_gardner@apple.com>
+
+        Ensure that style is updated when the effective appearance changes
+        https://bugs.webkit.org/show_bug.cgi?id=183690
+        <rdar://problem/38385900>
+
+        Reviewed by Tim Horton and Wenson Hsieh.
+
+        Respond to and respect the effective appearance changing.
+
+        * WebView/WebView.mm:
+        (-[WebView _setUseSystemAppearance:]):
+        (-[WebView effectiveAppearanceDidChange]):
+
 2018-03-15  Megan Gardner  <megan_gardner@apple.com>
 
         Create MediaQueryParserContext to provide additional context for the evaluation of media queries
index c21b77d..410deee 100644 (file)
@@ -5202,14 +5202,25 @@ static Vector<String> toStringVector(NSArray* patterns)
     if (auto page = _private->page) {
         page->setUseSystemAppearance(useSystemAppearance);
         page->setDefaultAppearance([self _defaultAppearance]);
+        page->setNeedsRecalcStyleInAllFrames();
     }
 }
 
 - (BOOL)_useSystemAppearance
 {
-    if (auto page = _private->page)
-        return page->useSystemAppearance();
-    return NO;
+    if (!_private->page)
+        return NO;
+    
+    return _private->page->useSystemAppearance();
+}
+
+- (void)effectiveAppearanceDidChange
+{
+    if (!_private->page)
+        return;
+    
+    _private->page->setDefaultAppearance([self _defaultAppearance]);
+    _private->page->setNeedsRecalcStyleInAllFrames();
 }
 
 - (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData