A change in system environment should force all CSS properties to be recomputed.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2013 20:54:16 +0000 (20:54 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2013 20:54:16 +0000 (20:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115872
<rdar://problem/13781171>

Reviewed by Antti Koivisto.

When a change in the global environment occurs, for example system colors,
we need to make sure all the CSS properties are recomputed and not fetched
from the cache. For this reason we invalidate the properties cache.
I've also renamed the function to give it a more meaningful name.

* page/Page.cpp:
(WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
* page/Page.h:
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::platformColorsDidChange):

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

Source/WebCore/ChangeLog
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/rendering/RenderTheme.cpp

index ebab134..3d679b4 100644 (file)
@@ -1,3 +1,22 @@
+2013-05-09  Enrica Casucci  <enrica@apple.com>
+
+        A change in system environment should force all CSS properties to be recomputed.
+        https://bugs.webkit.org/show_bug.cgi?id=115872
+        <rdar://problem/13781171>
+
+        Reviewed by Antti Koivisto.
+
+        When a change in the global environment occurs, for example system colors,
+        we need to make sure all the CSS properties are recomputed and not fetched
+        from the cache. For this reason we invalidate the properties cache.
+        I've also renamed the function to give it a more meaningful name.
+        
+        * page/Page.cpp:
+        (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
+        * page/Page.h:
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::platformColorsDidChange):
+
 2013-05-09  Antti Koivisto  <antti@apple.com>
 
         Reoptimize free-standing :focus/link/visited/-webkit-any-link selectors.
index 23a082e..605ee42 100644 (file)
@@ -76,6 +76,7 @@
 #include "SharedBuffer.h"
 #include "StorageArea.h"
 #include "StorageNamespace.h"
+#include "StyleResolver.h"
 #include "TextResourceDecoder.h"
 #include "VisitedLinkState.h"
 #include "VoidCallback.h"
@@ -458,14 +459,20 @@ void Page::initGroup()
     m_group = m_singlePageGroup.get();
 }
 
-void Page::scheduleForcedStyleRecalcForAllPages()
+void Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment()
 {
     if (!allPages)
         return;
     HashSet<Page*>::iterator end = allPages->end();
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
+        for (Frame* frame = (*it)->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 (StyleResolver* styleResolver = frame->document()->styleResolverIfExists())
+                styleResolver->invalidateMatchedPropertiesCache();
             frame->document()->scheduleForcedStyleRecalc();
+        }
 }
 
 void Page::setNeedsRecalcStyleInAllFrames()
index 384c2cb..1da14d4 100644 (file)
@@ -111,7 +111,7 @@ class Page : public Supplementable<Page> {
     WTF_MAKE_NONCOPYABLE(Page);
     friend class Settings;
 public:
-    static void scheduleForcedStyleRecalcForAllPages();
+    static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
 
     // It is up to the platform to ensure that non-null clients are provided where required.
     struct PageClients {
index 972be90..7f333e1 100644 (file)
@@ -1123,7 +1123,7 @@ void RenderTheme::platformColorsDidChange()
     m_activeListBoxSelectionBackgroundColor = Color();
     m_inactiveListBoxSelectionForegroundColor = Color();
 
-    Page::scheduleForcedStyleRecalcForAllPages();
+    Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
 }
 
 Color RenderTheme::systemColor(int cssValueId) const