Title: [233642] trunk/Source
Revision
233642
Author
[email protected]
Date
2018-07-09 09:41:10 -0700 (Mon, 09 Jul 2018)

Log Message

Unreviewed, rolling out r233612.
https://bugs.webkit.org/show_bug.cgi?id=187475

Revision caused the api test LinkColorWithSystemAppearance to
fail on all systems. (Requested by Truitt on #webkit).

Reverted changeset:

"Semantic colors don't update when accessibility Increase
Contrast mode is enabled."
https://bugs.webkit.org/show_bug.cgi?id=187425
https://trac.webkit.org/changeset/233612

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233641 => 233642)


--- trunk/Source/WebCore/ChangeLog	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebCore/ChangeLog	2018-07-09 16:41:10 UTC (rev 233642)
@@ -1,3 +1,18 @@
+2018-07-09  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r233612.
+        https://bugs.webkit.org/show_bug.cgi?id=187475
+
+        Revision caused the api test LinkColorWithSystemAppearance to
+        fail on all systems. (Requested by Truitt on #webkit).
+
+        Reverted changeset:
+
+        "Semantic colors don't update when accessibility Increase
+        Contrast mode is enabled."
+        https://bugs.webkit.org/show_bug.cgi?id=187425
+        https://trac.webkit.org/changeset/233612
+
 2018-07-09  Philippe Normand  <[email protected]>
 
         [GStreamer] Remove useless workaround

Modified: trunk/Source/WebCore/page/Page.cpp (233641 => 233642)


--- trunk/Source/WebCore/page/Page.cpp	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebCore/page/Page.cpp	2018-07-09 16:41:10 UTC (rev 233642)
@@ -520,29 +520,22 @@
     m_group = m_singlePageGroup.get();
 }
 
-void Page::updateStyleAfterChangeInEnvironment()
+void Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment()
 {
-    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
-        // If a change in the global environment has occurred, we need to
-        // make sure all the properties a recomputed, therefore we invalidate
-        // the properties cache.
-        auto* document = frame->document();
-        if (!document)
-            continue;
-
-        if (StyleResolver* styleResolver = document->styleScope().resolverIfExists())
-            styleResolver->invalidateMatchedPropertiesCache();
-        document->scheduleForcedStyleRecalc();
-        document->styleScope().didChangeStyleSheetEnvironment();
+    for (auto* page : allPages()) {
+        for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+            // If a change in the global environment has occurred, we need to
+            // make sure all the properties a recomputed, therefore we invalidate
+            // the properties cache.
+            if (!frame->document())
+                continue;
+            if (StyleResolver* styleResolver = frame->document()->styleScope().resolverIfExists())
+                styleResolver->invalidateMatchedPropertiesCache();
+            frame->document()->scheduleForcedStyleRecalc();
+        }
     }
 }
 
-void Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment()
-{
-    for (auto* page : allPages())
-        page->updateStyleAfterChangeInEnvironment();
-}
-
 void Page::setNeedsRecalcStyleInAllFrames()
 {
     // FIXME: Figure out what this function is actually trying to add in different call sites.
@@ -2405,16 +2398,12 @@
 {
     if (m_useSystemAppearance == value)
         return;
-
     m_useSystemAppearance = value;
 
-    updateStyleAfterChangeInEnvironment();
-
     for (auto* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         auto* document = frame->document();
         if (!document)
             continue;
-
         // System apperance change may affect stylesheet parsing. We need to reparse.
         document->extensionStyleSheets().clearPageUserSheet();
         document->extensionStyleSheets().invalidateInjectedStyleSheetCache();
@@ -2421,16 +2410,6 @@
     }
 }
 
-void Page::setUseDarkAppearance(bool value)
-{
-    if (m_useDarkAppearance == value)
-        return;
-
-    m_useDarkAppearance = value;
-
-    updateStyleAfterChangeInEnvironment();
-}
-
 bool Page::useDarkAppearance() const
 {
     FrameView* view = mainFrame().view();

Modified: trunk/Source/WebCore/page/Page.h (233641 => 233642)


--- trunk/Source/WebCore/page/Page.h	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebCore/page/Page.h	2018-07-09 16:41:10 UTC (rev 233642)
@@ -168,8 +168,6 @@
     WEBCORE_EXPORT static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
     WEBCORE_EXPORT static void clearPreviousItemFromAllPages(HistoryItem*);
 
-    void updateStyleAfterChangeInEnvironment();
-
     WEBCORE_EXPORT explicit Page(PageConfiguration&&);
     WEBCORE_EXPORT ~Page();
 
@@ -345,7 +343,7 @@
     WEBCORE_EXPORT void setUseSystemAppearance(bool);
     
     WEBCORE_EXPORT bool useDarkAppearance() const;
-    WEBCORE_EXPORT void setUseDarkAppearance(bool);
+    void setUseDarkAppearance(bool a) { m_useDarkAppearance = a; }
 
 #if ENABLE(TEXT_AUTOSIZING)
     float textAutosizingWidth() const { return m_textAutosizingWidth; }

Modified: trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm (233641 => 233642)


--- trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm	2018-07-09 16:41:10 UTC (rev 233642)
@@ -31,9 +31,16 @@
 
 namespace WebCore {
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+static size_t recursionCount = 0;
+#endif
+
 LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDarkAppearance)
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    if (recursionCount++)
+        return;
+
     m_savedSystemAppearance = [NSAppearance currentAppearance];
     m_usingDarkAppearance = useSystemAppearance && useDarkAppearance;
 
@@ -47,6 +54,9 @@
 LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance()
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    if (--recursionCount)
+        return;
+
     [NSAppearance setCurrentAppearance:m_savedSystemAppearance.get()];
 #endif
 }

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (233641 => 233642)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2018-07-09 16:41:10 UTC (rev 233642)
@@ -136,19 +136,14 @@
     self = [super init];
     if (!self)
         return nil;
-
     [[NSNotificationCenter defaultCenter] addObserver:self
         selector:@selector(systemColorsDidChange:) name:NSSystemColorsDidChangeNotification object:nil];
-
-    [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
-        selector:@selector(systemColorsDidChange:) name:NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification object:nil];
-
     return self;
 }
 
-- (void)systemColorsDidChange:(NSNotification *)notification
+- (void)systemColorsDidChange:(NSNotification *)unusedNotification
 {
-    UNUSED_PARAM(notification);
+    ASSERT_UNUSED(unusedNotification, [[unusedNotification name] isEqualToString:NSSystemColorsDidChangeNotification]);
     WebCore::RenderTheme::singleton().platformColorsDidChange();
 }
 

Modified: trunk/Source/WebKit/ChangeLog (233641 => 233642)


--- trunk/Source/WebKit/ChangeLog	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKit/ChangeLog	2018-07-09 16:41:10 UTC (rev 233642)
@@ -1,3 +1,18 @@
+2018-07-09  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r233612.
+        https://bugs.webkit.org/show_bug.cgi?id=187475
+
+        Revision caused the api test LinkColorWithSystemAppearance to
+        fail on all systems. (Requested by Truitt on #webkit).
+
+        Reverted changeset:
+
+        "Semantic colors don't update when accessibility Increase
+        Contrast mode is enabled."
+        https://bugs.webkit.org/show_bug.cgi?id=187425
+        https://trac.webkit.org/changeset/233612
+
 2018-07-09  Brian Burg  <[email protected]>
 
         WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (233641 => 233642)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-07-09 16:41:10 UTC (rev 233642)
@@ -470,6 +470,11 @@
     return static_cast<uint32_t>(WebCore::UserInterfaceLayoutDirection::LTR);
 }
 
+- (bool)_effectiveAppearanceIsDark
+{
+    return _impl->effectiveAppearanceIsDark();
+}
+
 #endif // PLATFORM(MAC)
 
 static void validate(WKWebViewConfiguration *configuration)
@@ -691,6 +696,7 @@
 
     _impl->setAutomaticallyAdjustsContentInsets(true);
     _impl->setRequiresUserActionForEditingControlsManager([configuration _requiresUserActionForEditingControlsManager]);
+    _impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 #endif
 
 #if ENABLE(ACCESSIBILITY_EVENTS)
@@ -6299,9 +6305,10 @@
 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
 {
     _impl->setUseSystemAppearance(useSystemAppearance);
+    _impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
-- (void)viewDidChangeEffectiveAppearance
+- (void)effectiveAppearanceDidChange
 {
     // This can be called during [super initWithCoder:] and [super initWithFrame:].
     // That is before _impl is ready to be used, so check. <rdar://problem/39611236>
@@ -6308,7 +6315,7 @@
     if (!_impl)
         return;
 
-    _impl->effectiveAppearanceDidChange();
+    _impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (void)_setHeaderBannerHeight:(int)height

Modified: trunk/Source/WebKit/UIProcess/API/mac/WKView.mm (233641 => 233642)


--- trunk/Source/WebKit/UIProcess/API/mac/WKView.mm	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKView.mm	2018-07-09 16:41:10 UTC (rev 233642)
@@ -1622,19 +1622,20 @@
     _data->_impl->setShouldSuppressFirstResponderChanges(shouldSuppress);
 }
 
-- (void)viewDidChangeEffectiveAppearance
+- (bool)_effectiveAppearanceIsDark
 {
-    // This can be called during [super initWithCoder:] and [super initWithFrame:].
-    // That is before _data or _impl is ready to be used, so check. <rdar://problem/39611236>
-    if (!_data || !_data->_impl)
-        return;
+    return _data->_impl->effectiveAppearanceIsDark();
+}
 
-    _data->_impl->effectiveAppearanceDidChange();
+- (void)effectiveAppearanceDidChange
+{
+    _data->_impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
 {
     _data->_impl->setUseSystemAppearance(useSystemAppearance);
+    _data->_impl->setUseDarkAppearance(self._effectiveAppearanceIsDark);
 }
 
 - (BOOL)_useSystemAppearance

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (233641 => 233642)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2018-07-09 16:41:10 UTC (rev 233642)
@@ -538,10 +538,7 @@
     
     void setUseSystemAppearance(bool);
     bool useSystemAppearance();
-
     void setUseDarkAppearance(bool);
-
-    void effectiveAppearanceDidChange();
     bool effectiveAppearanceIsDark();
 
 private:

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (233641 => 233642)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-07-09 16:41:10 UTC (rev 233642)
@@ -1311,8 +1311,6 @@
 
     m_page->setAddsVisitedLinks(processPool.historyClient().addsVisitedLinks());
 
-    m_page->setUseDarkAppearance(effectiveAppearanceIsDark());
-
     m_page->initializeWebPage();
 
     registerDraggedTypes();
@@ -5015,11 +5013,6 @@
     return m_page->useSystemAppearance();
 }
 
-void WebViewImpl::effectiveAppearanceDidChange()
-{
-    setUseDarkAppearance(effectiveAppearanceIsDark());
-}
-
 bool WebViewImpl::effectiveAppearanceIsDark()
 {
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (233641 => 233642)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-07-09 16:41:10 UTC (rev 233642)
@@ -4208,6 +4208,8 @@
 void WebPage::setUseDarkAppearance(bool useDarkAppearance)
 {
     corePage()->setUseDarkAppearance(useDarkAppearance);
+    RenderTheme::singleton().platformColorsDidChange();
+    corePage()->setNeedsRecalcStyleInAllFrames();
 }
 #endif
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (233641 => 233642)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-07-09 16:41:10 UTC (rev 233642)
@@ -1,3 +1,18 @@
+2018-07-09  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r233612.
+        https://bugs.webkit.org/show_bug.cgi?id=187475
+
+        Revision caused the api test LinkColorWithSystemAppearance to
+        fail on all systems. (Requested by Truitt on #webkit).
+
+        Reverted changeset:
+
+        "Semantic colors don't update when accessibility Increase
+        Contrast mode is enabled."
+        https://bugs.webkit.org/show_bug.cgi?id=187425
+        https://trac.webkit.org/changeset/233612
+
 2018-07-06  Timothy Hatcher  <[email protected]>
 
         Semantic colors don't update when accessibility Increase Contrast mode is enabled.

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (233641 => 233642)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-07-09 16:30:37 UTC (rev 233641)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-07-09 16:41:10 UTC (rev 233642)
@@ -1537,6 +1537,7 @@
 
 #if !PLATFORM(IOS)
     [self _registerDraggedTypes];
+    [self _updateDefaultAppearance];
 #endif
 
     [self _setIsVisible:[self _isViewVisible]];
@@ -5284,10 +5285,19 @@
 #endif
 }
 
+- (void)_updateDefaultAppearance
+{
+    _private->page->setUseDarkAppearance(self._effectiveAppearanceIsDark);
+    RenderTheme::singleton().platformColorsDidChange();
+    _private->page->setNeedsRecalcStyleInAllFrames();
+}
+
 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
 {
-    if (_private && _private->page)
-        _private->page->setUseSystemAppearance(useSystemAppearance);
+    if (auto page = _private->page) {
+        page->setUseSystemAppearance(useSystemAppearance);
+        [self _updateDefaultAppearance];
+    }
 }
 
 - (BOOL)_useSystemAppearance
@@ -5294,11 +5304,11 @@
 {
     if (!_private->page)
         return NO;
-
+    
     return _private->page->useSystemAppearance();
 }
 
-- (void)viewDidChangeEffectiveAppearance
+- (void)effectiveAppearanceDidChange
 {
     // This can be called during [super initWithCoder:] and [super initWithFrame:].
     // That is before _private is ready to be used, so check. <rdar://problem/39611236>
@@ -5305,7 +5315,7 @@
     if (!_private || !_private->page)
         return;
 
-    _private->page->setUseDarkAppearance(self._effectiveAppearanceIsDark);
+    [self _updateDefaultAppearance];
 }
 
 - (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to