Title: [135656] trunk/Source/WebCore
- Revision
- 135656
- Author
- [email protected]
- Date
- 2012-11-24 12:31:27 -0800 (Sat, 24 Nov 2012)
Log Message
Put computed style 'font-family' values in the CSSValuePool.
<http://webkit.org/b/103184>
Reviewed by Ojan Vafai.
Use CSSValuePool::createFontFamilyValue() when handing out 'font-family' values from CSSComputedStyleDeclaration.
This avoids creating extra CSSPrimitiveValue objects since we already have these in the pool from parsing.
Also added a max capacity to the font-family cache (using random eviction.)
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForFamily):
* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createFontFamilyValue):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (135655 => 135656)
--- trunk/Source/WebCore/ChangeLog 2012-11-24 19:35:56 UTC (rev 135655)
+++ trunk/Source/WebCore/ChangeLog 2012-11-24 20:31:27 UTC (rev 135656)
@@ -1,3 +1,19 @@
+2012-11-24 Andreas Kling <[email protected]>
+
+ Put computed style 'font-family' values in the CSSValuePool.
+ <http://webkit.org/b/103184>
+
+ Reviewed by Ojan Vafai.
+
+ Use CSSValuePool::createFontFamilyValue() when handing out 'font-family' values from CSSComputedStyleDeclaration.
+ This avoids creating extra CSSPrimitiveValue objects since we already have these in the pool from parsing.
+ Also added a max capacity to the font-family cache (using random eviction.)
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::valueForFamily):
+ * css/CSSValuePool.cpp:
+ (WebCore::CSSValuePool::createFontFamilyValue):
+
2012-11-24 Hayato Ito <[email protected]>
It's confusing that return values of 'bool Node::dispatchEvent(...)' and 'bool Node::dispatchMouseEvent(..)' have the opposite meanings.
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (135655 => 135656)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-11-24 19:35:56 UTC (rev 135655)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-11-24 20:31:27 UTC (rev 135656)
@@ -1209,7 +1209,7 @@
{
if (int familyIdentifier = identifierForFamily(family))
return cssValuePool().createIdentifierValue(familyIdentifier);
- return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createFontFamilyValue(family.string());
}
static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (135655 => 135656)
--- trunk/Source/WebCore/css/CSSValuePool.cpp 2012-11-24 19:35:56 UTC (rev 135655)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp 2012-11-24 20:31:27 UTC (rev 135656)
@@ -113,6 +113,10 @@
PassRefPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName)
{
+ const int maximumFontFamilyCacheSize = 128;
+ if (m_fontFamilyValueCache.size() >= maximumFontFamilyCacheSize)
+ m_fontFamilyValueCache.remove(m_fontFamilyValueCache.begin());
+
RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, 0).iterator->value;
if (!value)
value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STRING);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes