Title: [101934] trunk/Source/WebCore
Revision
101934
Author
[email protected]
Date
2011-12-03 13:45:35 -0800 (Sat, 03 Dec 2011)

Log Message

Keep CSSInheritedValue in the CSS value pool.
<http://webkit.org/b/73747>

Reviewed by Antti Koivisto.

We only need one CSSInheritedValue instance per document, so cache it
in CSSValuePool and have the parser create it through there.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::CSSValuePool):
(WebCore::CSSValuePool::createInheritedValue):
* css/CSSValuePool.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101933 => 101934)


--- trunk/Source/WebCore/ChangeLog	2011-12-03 20:06:11 UTC (rev 101933)
+++ trunk/Source/WebCore/ChangeLog	2011-12-03 21:45:35 UTC (rev 101934)
@@ -1,5 +1,22 @@
 2011-12-03  Andreas Kling  <[email protected]>
 
+        Keep CSSInheritedValue in the CSS value pool.
+        <http://webkit.org/b/73747>
+
+        Reviewed by Antti Koivisto.
+
+        We only need one CSSInheritedValue instance per document, so cache it
+        in CSSValuePool and have the parser create it through there.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSValuePool.cpp:
+        (WebCore::CSSValuePool::CSSValuePool):
+        (WebCore::CSSValuePool::createInheritedValue):
+        * css/CSSValuePool.h:
+
+2011-12-03  Andreas Kling  <[email protected]>
+
         Rename CSSPrimitiveValueCache to CSSValuePool.
         <http://webkit.org/b/73742>
 

Modified: trunk/Source/WebCore/css/CSSParser.cpp (101933 => 101934)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-12-03 20:06:11 UTC (rev 101933)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-12-03 21:45:35 UTC (rev 101934)
@@ -844,7 +844,7 @@
     if (id == CSSValueInherit) {
         if (num != 1)
             return false;
-        addProperty(propId, CSSInheritedValue::create(), important);
+        addProperty(propId, cssValuePool()->createInheritedValue(), important);
         return true;
     }
     else if (id == CSSValueInitial) {

Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (101933 => 101934)


--- trunk/Source/WebCore/css/CSSValuePool.cpp	2011-12-03 20:06:11 UTC (rev 101933)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp	2011-12-03 21:45:35 UTC (rev 101934)
@@ -30,7 +30,8 @@
 namespace WebCore {
 
 CSSValuePool::CSSValuePool()
-    : m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent))
+    : m_inheritedValue(CSSInheritedValue::create())
+    , m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent))
     , m_colorWhite(CSSPrimitiveValue::createColor(Color::white))
     , m_colorBlack(CSSPrimitiveValue::createColor(Color::black))
     , m_pixelZero(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX))
@@ -43,6 +44,11 @@
 {
 }
 
+PassRefPtr<CSSInheritedValue> CSSValuePool::createInheritedValue()
+{
+    return m_inheritedValue;
+}
+
 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(int ident)
 {
     if (ident <= 0 || ident >= numCSSValueKeywords)

Modified: trunk/Source/WebCore/css/CSSValuePool.h (101933 => 101934)


--- trunk/Source/WebCore/css/CSSValuePool.h	2011-12-03 20:06:11 UTC (rev 101933)
+++ trunk/Source/WebCore/css/CSSValuePool.h	2011-12-03 21:45:35 UTC (rev 101934)
@@ -26,6 +26,7 @@
 #ifndef CSSValuePool_h
 #define CSSValuePool_h
 
+#include "CSSInheritedValue.h"
 #include "CSSPrimitiveValue.h"
 #include <wtf/HashMap.h>
 #include <wtf/RefPtr.h>
@@ -37,6 +38,7 @@
     static PassRefPtr<CSSValuePool> create() { return adoptRef(new CSSValuePool); }
     ~CSSValuePool();
 
+    PassRefPtr<CSSInheritedValue> createInheritedValue();
     PassRefPtr<CSSPrimitiveValue> createIdentifierValue(int identifier);
     PassRefPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
     PassRefPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
@@ -46,6 +48,8 @@
 private:
     CSSValuePool();
 
+    RefPtr<CSSInheritedValue> m_inheritedValue;
+
     typedef HashMap<int, RefPtr<CSSPrimitiveValue> > IdentifierValueCache;
     IdentifierValueCache m_identifierValueCache;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to