- Revision
- 101812
- Author
- [email protected]
- Date
- 2011-12-02 09:42:04 -0800 (Fri, 02 Dec 2011)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=73520
REGRESSION(r101524): Article titles invisible until hover on blaze.com
Source/WebCore:
Reviewed by Darin Adler.
We need to invalidate the matched declaration cache when new web fonts are loaded.
Fonts in the cached RenderStyles may not be valid anymore.
Also renamed m_matchStyleDeclarationCache -> m_matchedStyleDeclarationCache.
Test reduction by the Reduction Fairy (aka kling).
Test: fast/css/font-face-cache-bug.html
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::dispatchInvalidationCallbacks):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::findFromMatchedDeclarationCache):
(WebCore::CSSStyleSelector::addToMatchedDeclarationCache):
(WebCore::CSSStyleSelector::invalidateMatchedDeclarationCache):
* css/CSSStyleSelector.h:
LayoutTests:
Reviewed by Darin Adler.
Test reduction by the Reduction Fairy (aka kling).
* fast/css/font-face-cache-bug-expected.txt: Added.
* fast/css/font-face-cache-bug.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (101811 => 101812)
--- trunk/LayoutTests/ChangeLog 2011-12-02 17:41:04 UTC (rev 101811)
+++ trunk/LayoutTests/ChangeLog 2011-12-02 17:42:04 UTC (rev 101812)
@@ -1,3 +1,15 @@
+2011-12-02 Antti Koivisto <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=73520
+ REGRESSION(r101524): Article titles invisible until hover on blaze.com
+
+ Reviewed by Darin Adler.
+
+ Test reduction by the Reduction Fairy (aka kling).
+
+ * fast/css/font-face-cache-bug-expected.txt: Added.
+ * fast/css/font-face-cache-bug.html: Added.
+
2011-12-02 Philippe Normand <[email protected]>
Unreviewed, skip failing websocket test on GTK.
Added: trunk/LayoutTests/fast/css/font-face-cache-bug-expected.txt (0 => 101812)
--- trunk/LayoutTests/fast/css/font-face-cache-bug-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/font-face-cache-bug-expected.txt 2011-12-02 17:42:04 UTC (rev 101812)
@@ -0,0 +1,10 @@
+Test for WebKit bug 73520
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getComputedStyle(testDiv, 0).width is "48px"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+aaa
Added: trunk/LayoutTests/fast/css/font-face-cache-bug.html (0 => 101812)
--- trunk/LayoutTests/fast/css/font-face-cache-bug.html (rev 0)
+++ trunk/LayoutTests/fast/css/font-face-cache-bug.html 2011-12-02 17:42:04 UTC (rev 101812)
@@ -0,0 +1,38 @@
+<html>
+ <script src=""
+ <script>
+ description('Test for <a href="" bug 73520</a>');
+ window.jsTestIsAsync = true;
+ function runTest()
+ {
+ testDiv = document.getElementById('test');
+ shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px');
+ finishJSTest();
+ }
+ </script>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: serif;
+ }
+ @font-face{
+ font-family: 'ahem';
+ src: url('../../resources/Ahem.ttf');
+ }
+ #test {
+ position: absolute
+ }
+ #test span {
+ font-family: ahem;
+ }
+ </style>
+ </head>
+ <body _onload_="setTimeout('runTest()', 100)">
+ <div id=test>
+ <a href=""
+ <span>aaa</span>
+ </a>
+ </div>
+ <script src=""
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (101811 => 101812)
--- trunk/Source/WebCore/ChangeLog 2011-12-02 17:41:04 UTC (rev 101811)
+++ trunk/Source/WebCore/ChangeLog 2011-12-02 17:42:04 UTC (rev 101812)
@@ -1,3 +1,27 @@
+2011-12-02 Antti Koivisto <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=73520
+ REGRESSION(r101524): Article titles invisible until hover on blaze.com
+
+ Reviewed by Darin Adler.
+
+ We need to invalidate the matched declaration cache when new web fonts are loaded.
+ Fonts in the cached RenderStyles may not be valid anymore.
+
+ Also renamed m_matchStyleDeclarationCache -> m_matchedStyleDeclarationCache.
+
+ Test reduction by the Reduction Fairy (aka kling).
+
+ Test: fast/css/font-face-cache-bug.html
+
+ * css/CSSFontSelector.cpp:
+ (WebCore::CSSFontSelector::dispatchInvalidationCallbacks):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::findFromMatchedDeclarationCache):
+ (WebCore::CSSStyleSelector::addToMatchedDeclarationCache):
+ (WebCore::CSSStyleSelector::invalidateMatchedDeclarationCache):
+ * css/CSSStyleSelector.h:
+
2011-11-02 Jer Noble <[email protected]>
MediaControls should use MediaController if present.
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (101811 => 101812)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2011-12-02 17:41:04 UTC (rev 101811)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2011-12-02 17:42:04 UTC (rev 101812)
@@ -36,6 +36,7 @@
#include "CSSPrimitiveValue.h"
#include "CSSPropertyNames.h"
#include "CSSSegmentedFontFace.h"
+#include "CSSStyleSelector.h"
#include "CSSUnicodeRangeValue.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
@@ -368,8 +369,12 @@
clients[i]->fontsNeedUpdate(this);
// FIXME: Make Document a FontSelectorClient so that it can simply register for invalidation callbacks.
- if (!m_document || m_document->inPageCache() || !m_document->renderer())
+ if (!m_document)
return;
+ if (CSSStyleSelector* styleSelector = m_document->styleSelectorIfExists())
+ styleSelector->invalidateMatchedDeclarationCache();
+ if (m_document->inPageCache() || !m_document->renderer())
+ return;
m_document->scheduleForcedStyleRecalc();
}
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (101811 => 101812)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-12-02 17:41:04 UTC (rev 101811)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-12-02 17:42:04 UTC (rev 101812)
@@ -2218,8 +2218,8 @@
{
ASSERT(hash);
- MatchedStyleDeclarationCache::iterator it = m_matchStyleDeclarationCache.find(hash);
- if (it == m_matchStyleDeclarationCache.end())
+ MatchedStyleDeclarationCache::iterator it = m_matchedStyleDeclarationCache.find(hash);
+ if (it == m_matchedStyleDeclarationCache.end())
return 0;
MatchedStyleDeclarationCacheItem& cacheItem = it->second;
ASSERT(cacheItem.matchResult.isCacheable);
@@ -2246,8 +2246,13 @@
// The RenderStyle in the cache is really just a holder for the substructures and never used as-is.
cacheItem.renderStyle = RenderStyle::clone(style);
cacheItem.parentRenderStyle = RenderStyle::clone(parentStyle);
- m_matchStyleDeclarationCache.add(hash, cacheItem);
+ m_matchedStyleDeclarationCache.add(hash, cacheItem);
}
+
+void CSSStyleSelector::invalidateMatchedDeclarationCache()
+{
+ m_matchedStyleDeclarationCache.clear();
+}
static bool isCacheableInMatchedDeclarationCache(const RenderStyle* style, const RenderStyle* parentStyle)
{
Modified: trunk/Source/WebCore/css/CSSStyleSelector.h (101811 => 101812)
--- trunk/Source/WebCore/css/CSSStyleSelector.h 2011-12-02 17:41:04 UTC (rev 101811)
+++ trunk/Source/WebCore/css/CSSStyleSelector.h 2011-12-02 17:42:04 UTC (rev 101812)
@@ -210,6 +210,8 @@
bool usesLinkRules() const { return m_features.usesLinkRules; }
static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations);
+
+ void invalidateMatchedDeclarationCache();
#if ENABLE(CSS_FILTERS)
bool createFilterOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, FilterOperations& outOperations);
@@ -365,7 +367,7 @@
Vector<MatchedStyleDeclaration, 64> m_matchedDecls;
typedef HashMap<unsigned, MatchedStyleDeclarationCacheItem> MatchedStyleDeclarationCache;
- MatchedStyleDeclarationCache m_matchStyleDeclarationCache;
+ MatchedStyleDeclarationCache m_matchedStyleDeclarationCache;
// A buffer used to hold the set of matched rules for an element, and a temporary buffer used for
// merge sorting.