Recalc styles every time defaultAppearance changes.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2018 18:32:45 +0000 (18:32 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2018 18:32:45 +0000 (18:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186866
rdar://problem/41309805

Reviewed by Tim Horton.

Source/WebCore:

* page/Page.cpp:
(WebCore::Page::setUseSystemAppearance): Added. Recalc styles and update system colors.
(WebCore::Page::setDefaultAppearance): Added. Ditto.
* page/Page.h:
(WebCore::Page::setUseSystemAppearance): Deleted impl.
(WebCore::Page::setDefaultAppearance): Deleted impl.

Source/WebKit:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setDefaultAppearance):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setDefaultAppearance):

Source/WebKitLegacy/mac:

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

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

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

index c2a6404..1254dda 100644 (file)
@@ -1,3 +1,18 @@
+2018-06-22  Timothy Hatcher  <timothy@apple.com>
+
+        Recalc styles every time defaultAppearance changes.
+        https://bugs.webkit.org/show_bug.cgi?id=186866
+        rdar://problem/41309805
+
+        Reviewed by Tim Horton.
+
+        * page/Page.cpp:
+        (WebCore::Page::setUseSystemAppearance): Added. Recalc styles and update system colors.
+        (WebCore::Page::setDefaultAppearance): Added. Ditto.
+        * page/Page.h:
+        (WebCore::Page::setUseSystemAppearance): Deleted impl.
+        (WebCore::Page::setDefaultAppearance): Deleted impl.
+
 2018-06-22  Thibault Saunier  <tsaunier@igalia.com>
 
         [GStreamer] Avoid sending SELECT_STREAM events when nothing changed
index 20a610a..4862a32 100644 (file)
@@ -2369,6 +2369,17 @@ void Page::setUnobscuredSafeAreaInsets(const FloatBoxExtent& insets)
     }
 }
 
+void Page::setUseSystemAppearance(bool useSystemAppearance)
+{
+    if (m_useSystemAppearance == useSystemAppearance)
+        return;
+
+    m_useSystemAppearance = useSystemAppearance;
+
+    RenderTheme::singleton().platformColorsDidChange();
+    setNeedsRecalcStyleInAllFrames();
+}
+
 bool Page::defaultAppearance() const
 {
     FrameView* view = mainFrame().view();
@@ -2377,6 +2388,17 @@ bool Page::defaultAppearance() const
     return m_defaultAppearance;
 }
 
+void Page::setDefaultAppearance(bool defaultAppearance)
+{
+    // Don't return early, even if m_defaultAppearance == defaultAppearance.
+    // The system appearance might have changed under us, like for accessibility.
+
+    m_defaultAppearance = defaultAppearance;
+
+    RenderTheme::singleton().platformColorsDidChange();
+    setNeedsRecalcStyleInAllFrames();
+}
+
 void Page::setFullscreenInsets(const FloatBoxExtent& insets)
 {
     if (insets == m_fullscreenInsets)
index ec498c5..e88350a 100644 (file)
@@ -338,12 +338,12 @@ public:
     bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; }
     void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; }
 #endif
-    
+
     bool useSystemAppearance() const { return m_useSystemAppearance; }
-    void setUseSystemAppearance(bool a) { m_useSystemAppearance = a; }
+    WEBCORE_EXPORT void setUseSystemAppearance(bool);
     
     bool defaultAppearance() const;
-    void setDefaultAppearance(bool a) { m_defaultAppearance = a; }
+    WEBCORE_EXPORT void setDefaultAppearance(bool);
 
 #if ENABLE(TEXT_AUTOSIZING)
     float textAutosizingWidth() const { return m_textAutosizingWidth; }
index a49761f..8479706 100644 (file)
@@ -1,3 +1,16 @@
+2018-06-22  Timothy Hatcher  <timothy@apple.com>
+
+        Recalc styles every time defaultAppearance changes.
+        https://bugs.webkit.org/show_bug.cgi?id=186866
+        rdar://problem/41309805
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setDefaultAppearance):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setDefaultAppearance):
+
 2018-06-22  Sihui Liu  <sihui_liu@apple.com>
 
         REGRESSION (r231850): Cookie file cannot be read or written by network process
index b9af1d6..5f1521f 100644 (file)
@@ -7303,10 +7303,10 @@ void WebPageProxy::setDefaultAppearance(bool defaultAppearance)
 {
     if (!isValid())
         return;
-    
-    if (defaultAppearance == m_defaultAppearance)
-        return;
-    
+
+    // Don't return early, even if m_defaultAppearance == defaultAppearance.
+    // The system appearance might have changed under us, like for accessibility.
+
     m_defaultAppearance = defaultAppearance;
     m_process->send(Messages::WebPage::SetDefaultAppearance(defaultAppearance), m_pageID);
 }
index 43bd0c0..2a8c321 100644 (file)
@@ -4193,12 +4193,10 @@ void WebPage::setUseSystemAppearance(bool useSystemAppearance)
 {
     corePage()->setUseSystemAppearance(useSystemAppearance);
 }
-    
+
 void WebPage::setDefaultAppearance(bool defaultAppearance)
 {
     corePage()->setDefaultAppearance(defaultAppearance);
-    RenderTheme::singleton().platformColorsDidChange();
-    corePage()->setNeedsRecalcStyleInAllFrames();
 }
 #endif
 
index 7582a60..3150ea5 100644 (file)
@@ -1,3 +1,16 @@
+2018-06-22  Timothy Hatcher  <timothy@apple.com>
+
+        Recalc styles every time defaultAppearance changes.
+        https://bugs.webkit.org/show_bug.cgi?id=186866
+        rdar://problem/41309805
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebView.mm:
+        (-[WebView _updateDefaultAppearance]):
+        (-[WebView _setUseSystemAppearance:]):
+        (-[WebView _useSystemAppearance]):
+
 2018-06-20  Darin Adler  <darin@apple.com>
 
         [Cocoa] Use the isDirectory: variants of NSURL methods more to eliminate unnecessary file system activity
index 57310f7..b5c8450 100644 (file)
@@ -5288,23 +5288,19 @@ static Vector<String> toStringVector(NSArray* patterns)
 - (void)_updateDefaultAppearance
 {
     _private->page->setDefaultAppearance([self _defaultAppearance]);
-    RenderTheme::singleton().platformColorsDidChange();
-    _private->page->setNeedsRecalcStyleInAllFrames();
 }
 
 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
 {
-    if (auto page = _private->page) {
-        page->setUseSystemAppearance(useSystemAppearance);
-        [self _updateDefaultAppearance];
-    }
+    if (_private && _private->page)
+        _private->page->setUseSystemAppearance(useSystemAppearance);
 }
 
 - (BOOL)_useSystemAppearance
 {
     if (!_private->page)
         return NO;
-    
+
     return _private->page->useSystemAppearance();
 }