Changeset 101934 in webkit


Ignore:
Timestamp:
Dec 3, 2011, 1:45:35 PM (14 years ago)
Author:
kling@webkit.org
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:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r101932 r101934  
     12011-12-03  Andreas Kling  <kling@webkit.org>
     2
     3        Keep CSSInheritedValue in the CSS value pool.
     4        <http://webkit.org/b/73747>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        We only need one CSSInheritedValue instance per document, so cache it
     9        in CSSValuePool and have the parser create it through there.
     10
     11        * css/CSSParser.cpp:
     12        (WebCore::CSSParser::parseValue):
     13        * css/CSSValuePool.cpp:
     14        (WebCore::CSSValuePool::CSSValuePool):
     15        (WebCore::CSSValuePool::createInheritedValue):
     16        * css/CSSValuePool.h:
     17
    1182011-12-03  Andreas Kling  <kling@webkit.org>
    219
  • trunk/Source/WebCore/css/CSSParser.cpp

    r101932 r101934  
    845845        if (num != 1)
    846846            return false;
    847         addProperty(propId, CSSInheritedValue::create(), important);
     847        addProperty(propId, cssValuePool()->createInheritedValue(), important);
    848848        return true;
    849849    }
  • trunk/Source/WebCore/css/CSSValuePool.cpp

    r101932 r101934  
    3131
    3232CSSValuePool::CSSValuePool()
    33     : m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent))
     33    : m_inheritedValue(CSSInheritedValue::create())
     34    , m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent))
    3435    , m_colorWhite(CSSPrimitiveValue::createColor(Color::white))
    3536    , m_colorBlack(CSSPrimitiveValue::createColor(Color::black))
     
    4243CSSValuePool::~CSSValuePool()
    4344{
     45}
     46
     47PassRefPtr<CSSInheritedValue> CSSValuePool::createInheritedValue()
     48{
     49    return m_inheritedValue;
    4450}
    4551
  • trunk/Source/WebCore/css/CSSValuePool.h

    r101932 r101934  
    2727#define CSSValuePool_h
    2828
     29#include "CSSInheritedValue.h"
    2930#include "CSSPrimitiveValue.h"
    3031#include <wtf/HashMap.h>
     
    3839    ~CSSValuePool();
    3940
     41    PassRefPtr<CSSInheritedValue> createInheritedValue();
    4042    PassRefPtr<CSSPrimitiveValue> createIdentifierValue(int identifier);
    4143    PassRefPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
     
    4648private:
    4749    CSSValuePool();
     50
     51    RefPtr<CSSInheritedValue> m_inheritedValue;
    4852
    4953    typedef HashMap<int, RefPtr<CSSPrimitiveValue> > IdentifierValueCache;
Note: See TracChangeset for help on using the changeset viewer.