Changeset 148410 in webkit


Ignore:
Timestamp:
Apr 14, 2013 1:32:47 PM (11 years ago)
Author:
akling@apple.com
Message:

Only MutableStylePropertySets should be able to have CSSOM wrappers.
<http://webkit.org/b/114595>

Reviewed by Antti Koivisto.

Tighten typing so that only MutableStylePropertySets can have CSSOM wrappers associated.
This allows us to get rid of the out-of-line base class destructor.

  • WebCore.exp.in:
  • css/StylePropertySet.cpp:

(WebCore::MutableStylePropertySet::~MutableStylePropertySet):
(WebCore::MutableStylePropertySet::cssStyleDeclaration):
(WebCore::MutableStylePropertySet::ensureInlineCSSStyleDeclaration):

  • css/StylePropertySet.h:

(StylePropertySet):
(MutableStylePropertySet):

  • dom/StyledElement.cpp:

(WebCore::StyledElement::inlineStyleCSSOMWrapper):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148408 r148410  
     12013-04-14  Andreas Kling  <akling@apple.com>
     2
     3        Only MutableStylePropertySets should be able to have CSSOM wrappers.
     4        <http://webkit.org/b/114595>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Tighten typing so that only MutableStylePropertySets can have CSSOM wrappers associated.
     9        This allows us to get rid of the out-of-line base class destructor.
     10
     11        * WebCore.exp.in:
     12        * css/StylePropertySet.cpp:
     13        (WebCore::MutableStylePropertySet::~MutableStylePropertySet):
     14        (WebCore::MutableStylePropertySet::cssStyleDeclaration):
     15        (WebCore::MutableStylePropertySet::ensureInlineCSSStyleDeclaration):
     16        * css/StylePropertySet.h:
     17        (StylePropertySet):
     18        (MutableStylePropertySet):
     19        * dom/StyledElement.cpp:
     20        (WebCore::StyledElement::inlineStyleCSSOMWrapper):
     21
    1222013-04-14  Andreas Kling  <akling@apple.com>
    223
  • trunk/Source/WebCore/WebCore.exp.in

    r148396 r148410  
    534534__ZN7WebCore16ScriptController21processingUserGestureEv
    535535__ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE
    536 __ZN7WebCore16StylePropertySetD1Ev
    537536__ZN7WebCore16ThreadGlobalData10staticDataE
    538537__ZN7WebCore16ThreadGlobalDataC1Ev
     
    17901789__ZN7WebCore16FontPlatformDataC1EP6NSFontfbbbNS_15FontOrientationENS_16FontWidthVariantE
    17911790__ZN7WebCore16FontPlatformDataC2EP6NSFontfbbbNS_15FontOrientationENS_16FontWidthVariantE
    1792 __ZN7WebCore16StylePropertySetD2Ev
    17931791__ZN7WebCore16colorFromNSColorEP7NSColor
    17941792__ZN7WebCore16enclosingIntRectERK7_NSRect
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r148406 r148410  
    11/*
    22 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
    3  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
     3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
    44 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
    55 *
     
    5050namespace WebCore {
    5151
    52 typedef HashMap<const StylePropertySet*, OwnPtr<PropertySetCSSStyleDeclaration> > PropertySetCSSOMWrapperMap;
     52typedef HashMap<MutableStylePropertySet*, OwnPtr<PropertySetCSSStyleDeclaration> > PropertySetCSSOMWrapperMap;
    5353static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap()
    5454{
     
    122122}
    123123
    124 StylePropertySet::~StylePropertySet()
     124MutableStylePropertySet::~MutableStylePropertySet()
    125125{
    126126    ASSERT(!m_ownsCSSOMWrapper || propertySetCSSOMWrapperMap().contains(this));
     
    12101210}
    12111211
    1212 PropertySetCSSStyleDeclaration* StylePropertySet::cssStyleDeclaration()
     1212PropertySetCSSStyleDeclaration* MutableStylePropertySet::cssStyleDeclaration()
    12131213{
    12141214    if (!m_ownsCSSOMWrapper)
    12151215        return 0;
    1216     ASSERT(isMutable());
    12171216    return propertySetCSSOMWrapperMap().get(this);
    12181217}
     
    12311230}
    12321231
    1233 CSSStyleDeclaration* MutableStylePropertySet::ensureInlineCSSStyleDeclaration(const StyledElement* parentElement)
     1232CSSStyleDeclaration* MutableStylePropertySet::ensureInlineCSSStyleDeclaration(StyledElement* parentElement)
    12341233{
    12351234    if (m_ownsCSSOMWrapper) {
     
    12381237    }
    12391238    m_ownsCSSOMWrapper = true;
    1240     PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(this, const_cast<StyledElement*>(parentElement));
     1239    PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(this, parentElement);
    12411240    propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
    12421241    return cssomWrapper;
  • trunk/Source/WebCore/css/StylePropertySet.h

    r148408 r148410  
    4545    friend class PropertyReference;
    4646public:
    47     ~StylePropertySet();
    48 
    4947    // Override RefCounted's deref() to ensure operator delete is called on
    5048    // the appropriate subclass type.
     
    106104   
    107105    String asText() const;
    108 
    109     PropertySetCSSStyleDeclaration* cssStyleDeclaration();
    110106
    111107    bool isMutable() const { return m_isMutable; }
     
    187183class MutableStylePropertySet : public StylePropertySet {
    188184public:
     185    ~MutableStylePropertySet();
     186
    189187    static PassRefPtr<MutableStylePropertySet> create(CSSParserMode = CSSQuirksMode);
    190188    static PassRefPtr<MutableStylePropertySet> create(const CSSProperty* properties, unsigned count);
     
    193191
    194192    unsigned propertyCount() const { return m_propertyVector.size(); }
     193
     194    PropertySetCSSStyleDeclaration* cssStyleDeclaration();
    195195
    196196    void addParsedProperties(const Vector<CSSProperty>&);
     
    220220
    221221    CSSStyleDeclaration* ensureCSSStyleDeclaration();
    222     CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(const StyledElement* parentElement);
     222    CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(StyledElement* parentElement);
    223223
    224224    Vector<CSSProperty, 4> m_propertyVector;
  • trunk/Source/WebCore/dom/StyledElement.cpp

    r148397 r148410  
    174174    if (!inlineStyle() || !inlineStyle()->hasCSSOMWrapper())
    175175        return 0;
    176     PropertySetCSSStyleDeclaration* cssomWrapper = ensureUniqueElementData()->m_inlineStyle->cssStyleDeclaration();
     176    PropertySetCSSStyleDeclaration* cssomWrapper = ensureMutableInlineStyle()->cssStyleDeclaration();
    177177    ASSERT(cssomWrapper && cssomWrapper->parentElement() == this);
    178178    return cssomWrapper;
Note: See TracChangeset for help on using the changeset viewer.