Changeset 121570 in webkit


Ignore:
Timestamp:
Jun 29, 2012 10:20:19 AM (12 years ago)
Author:
kling@webkit.org
Message:

Unreviewed, rolling out r121562.
http://trac.webkit.org/changeset/121562
https://bugs.webkit.org/show_bug.cgi?id=89945

Broke a couple of editing/pasteboard tests.

  • css/PropertySetCSSStyleDeclaration.cpp:

(WebCore::PropertySetCSSStyleDeclaration::length):
(WebCore::PropertySetCSSStyleDeclaration::item):
(WebCore::PropertySetCSSStyleDeclaration::cssText):
(WebCore::PropertySetCSSStyleDeclaration::setCssText):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand):
(WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit):
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::removeProperty):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
(WebCore::PropertySetCSSStyleDeclaration::copy):
(WebCore::PropertySetCSSStyleDeclaration::makeMutable):
(WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches):
(WebCore::InlineCSSStyleDeclaration::didMutate):
(WebCore::InlineCSSStyleDeclaration::parentStyleSheet):

  • css/PropertySetCSSStyleDeclaration.h:

(WebCore::PropertySetCSSStyleDeclaration::clearParentElement):
(PropertySetCSSStyleDeclaration):
(WebCore::InlineCSSStyleDeclaration::InlineCSSStyleDeclaration):

  • css/StylePropertySet.cpp:

(WebCore::StylePropertySet::ensureInlineCSSStyleDeclaration):
(WebCore::StylePropertySet::clearParentElement):
(WebCore):

  • css/StylePropertySet.h:

(StylePropertySet):

  • dom/ElementAttributeData.cpp:

(WebCore::ElementAttributeData::destroyInlineStyle):
(WebCore):

  • dom/ElementAttributeData.h:

(ElementAttributeData):

  • dom/StyledElement.cpp:

(WebCore::StyledElement::~StyledElement):
(WebCore):
(WebCore::StyledElement::styleAttributeChanged):

  • dom/StyledElement.h:

(StyledElement):
(WebCore::StyledElement::destroyInlineStyle):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121569 r121570  
     12012-06-29  Andreas Kling  <kling@webkit.org>
     2
     3        Unreviewed, rolling out r121562.
     4        http://trac.webkit.org/changeset/121562
     5        https://bugs.webkit.org/show_bug.cgi?id=89945
     6
     7        Broke a couple of editing/pasteboard tests.
     8
     9        * css/PropertySetCSSStyleDeclaration.cpp:
     10        (WebCore::PropertySetCSSStyleDeclaration::length):
     11        (WebCore::PropertySetCSSStyleDeclaration::item):
     12        (WebCore::PropertySetCSSStyleDeclaration::cssText):
     13        (WebCore::PropertySetCSSStyleDeclaration::setCssText):
     14        (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
     15        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
     16        (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority):
     17        (WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand):
     18        (WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit):
     19        (WebCore::PropertySetCSSStyleDeclaration::setProperty):
     20        (WebCore::PropertySetCSSStyleDeclaration::removeProperty):
     21        (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
     22        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
     23        (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
     24        (WebCore::PropertySetCSSStyleDeclaration::copy):
     25        (WebCore::PropertySetCSSStyleDeclaration::makeMutable):
     26        (WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches):
     27        (WebCore::InlineCSSStyleDeclaration::didMutate):
     28        (WebCore::InlineCSSStyleDeclaration::parentStyleSheet):
     29        * css/PropertySetCSSStyleDeclaration.h:
     30        (WebCore::PropertySetCSSStyleDeclaration::clearParentElement):
     31        (PropertySetCSSStyleDeclaration):
     32        (WebCore::InlineCSSStyleDeclaration::InlineCSSStyleDeclaration):
     33        * css/StylePropertySet.cpp:
     34        (WebCore::StylePropertySet::ensureInlineCSSStyleDeclaration):
     35        (WebCore::StylePropertySet::clearParentElement):
     36        (WebCore):
     37        * css/StylePropertySet.h:
     38        (StylePropertySet):
     39        * dom/ElementAttributeData.cpp:
     40        (WebCore::ElementAttributeData::destroyInlineStyle):
     41        (WebCore):
     42        * dom/ElementAttributeData.h:
     43        (ElementAttributeData):
     44        * dom/StyledElement.cpp:
     45        (WebCore::StyledElement::~StyledElement):
     46        (WebCore):
     47        (WebCore::StyledElement::styleAttributeChanged):
     48        * dom/StyledElement.h:
     49        (StyledElement):
     50        (WebCore::StyledElement::destroyInlineStyle):
     51
    1522012-06-29  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
    253
  • trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp

    r121562 r121570  
    133133unsigned PropertySetCSSStyleDeclaration::length() const
    134134{
    135     return propertySet()->propertyCount();
     135    return m_propertySet->propertyCount();
    136136}
    137137
    138138String PropertySetCSSStyleDeclaration::item(unsigned i) const
    139139{
    140     if (i >= propertySet()->propertyCount())
     140    if (i >= m_propertySet->propertyCount())
    141141        return "";
    142     return getPropertyName(propertySet()->propertyAt(i).id());
     142    return getPropertyName(m_propertySet->propertyAt(i).id());
    143143}
    144144
    145145String PropertySetCSSStyleDeclaration::cssText() const
    146146{
    147     return propertySet()->asText();
     147    return m_propertySet->asText();
    148148}
    149149   
     
    157157    ec = 0;
    158158    // FIXME: Detect syntax errors and set ec.
    159     ensureMutablePropertySet()->parseDeclaration(text, contextStyleSheet());
     159    m_propertySet->parseDeclaration(text, contextStyleSheet());
    160160
    161161    didMutate(PropertyChanged);
     
    171171    if (!propertyID)
    172172        return 0;
    173     return cloneAndCacheForCSSOM(propertySet()->getPropertyCSSValue(propertyID).get());
     173    return cloneAndCacheForCSSOM(m_propertySet->getPropertyCSSValue(propertyID).get());
    174174}
    175175
     
    179179    if (!propertyID)
    180180        return String();
    181     return propertySet()->getPropertyValue(propertyID);
     181    return m_propertySet->getPropertyValue(propertyID);
    182182}
    183183
     
    187187    if (!propertyID)
    188188        return String();
    189     return propertySet()->propertyIsImportant(propertyID) ? "important" : "";
     189    return m_propertySet->propertyIsImportant(propertyID) ? "important" : "";
    190190}
    191191
     
    195195    if (!propertyID)
    196196        return String();
    197     CSSPropertyID shorthandID = propertySet()->getPropertyShorthand(propertyID);
     197    CSSPropertyID shorthandID = m_propertySet->getPropertyShorthand(propertyID);
    198198    if (!shorthandID)
    199199        return String();
     
    206206    if (!propertyID)
    207207        return false;
    208     return propertySet()->isPropertyImplicit(propertyID);
     208    return m_propertySet->isPropertyImplicit(propertyID);
    209209}
    210210
     
    223223
    224224    ec = 0;
    225     bool changed = ensureMutablePropertySet()->setProperty(propertyID, value, important, contextStyleSheet());
     225    bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet());
    226226
    227227    didMutate(changed ? PropertyChanged : NoChanges);
     
    249249    ec = 0;
    250250    String result;
    251     bool changed = ensureMutablePropertySet()->removeProperty(propertyID, &result);
     251    bool changed = m_propertySet->removeProperty(propertyID, &result);
    252252
    253253    didMutate(changed ? PropertyChanged : NoChanges);
     
    263263PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
    264264{
    265     return propertySet()->getPropertyCSSValue(propertyID);
     265    return m_propertySet->getPropertyCSSValue(propertyID);
    266266}
    267267
    268268String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
    269269{
    270     return propertySet()->getPropertyValue(propertyID);
     270    return m_propertySet->getPropertyValue(propertyID);
    271271}
    272272
     
    279279
    280280    ec = 0;
    281     bool changed = ensureMutablePropertySet()->setProperty(propertyID, value, important, contextStyleSheet());
     281    bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet());
    282282
    283283    didMutate(changed ? PropertyChanged : NoChanges);
     
    314314PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const
    315315{
    316     return propertySet()->copy();
     316    return m_propertySet->copy();
    317317}
    318318
    319319PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable()
    320320{
    321     return ensureMutablePropertySet();
     321    return m_propertySet;
    322322}
    323323
    324324bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
    325325{
    326     return propertySet()->propertyMatches(property);
     326    return m_propertySet->propertyMatches(property);
    327327}
    328328   
     
    381381}
    382382
    383 InlineCSSStyleDeclaration::InlineCSSStyleDeclaration(StyledElement* parentElement)
    384     : PropertySetCSSStyleDeclaration(const_cast<StylePropertySet*>(parentElement->inlineStyle()))
    385     , m_parentElement(parentElement)
    386 {
    387 }
    388 
    389 void InlineCSSStyleDeclaration::ref()
    390 {
    391     m_parentElement->ref();
    392 }
    393 
    394 void InlineCSSStyleDeclaration::deref()
    395 {
    396     m_parentElement->deref();
    397 }
    398 
    399383void InlineCSSStyleDeclaration::didMutate(MutationType type)
    400384{
     
    404388    m_cssomCSSValueClones.clear();
    405389
     390    if (!m_parentElement)
     391        return;
    406392    m_parentElement->setNeedsStyleRecalc(InlineStyleChange);
    407393    m_parentElement->invalidateStyleAttribute();
     
    411397CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const
    412398{
    413     return m_parentElement->document()->elementSheet();
    414 }
    415 
    416 StylePropertySet* InlineCSSStyleDeclaration::ensureMutablePropertySet()
    417 {
    418     ASSERT(m_propertySet);
    419     ASSERT(m_propertySet == m_parentElement->inlineStyle());
    420     return m_propertySet;
     399    return m_parentElement ? m_parentElement->document()->elementSheet() : 0;
    421400}
    422401
  • trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h

    r121562 r121570  
    4343   
    4444    virtual StyledElement* parentElement() const { return 0; }
     45    virtual void clearParentElement() { ASSERT_NOT_REACHED(); }
    4546    StyleSheetContents* contextStyleSheet() const;
    4647   
    4748    virtual void ref() OVERRIDE;
    4849    virtual void deref() OVERRIDE;
    49 
    50 protected:
    51     const StylePropertySet* propertySet() const { return m_propertySet; }
    52     virtual StylePropertySet* ensureMutablePropertySet() { return m_propertySet; }
    5350
    5451private:
     
    110107    virtual void didMutate(MutationType) OVERRIDE;
    111108
    112     virtual StylePropertySet* ensureMutablePropertySet() OVERRIDE { return m_propertySet; }
    113 
    114109    unsigned m_refCount;
    115110    CSSRule* m_parentRule;
     
    119114{
    120115public:
    121     InlineCSSStyleDeclaration(StyledElement*);
    122 
    123     virtual void ref() OVERRIDE;
    124     virtual void deref() OVERRIDE;
     116    InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* parentElement)
     117        : PropertySetCSSStyleDeclaration(propertySet)
     118        , m_parentElement(parentElement)
     119    {
     120    }
    125121   
    126122private:
    127123    virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
    128124    virtual StyledElement* parentElement() const OVERRIDE { return m_parentElement; }
     125    virtual void clearParentElement() OVERRIDE { m_parentElement = 0; }
    129126
    130127    virtual void didMutate(MutationType) OVERRIDE;
    131 
    132     virtual StylePropertySet* ensureMutablePropertySet() OVERRIDE;
    133128   
    134129    StyledElement* m_parentElement;
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r121562 r121570  
    10521052    }
    10531053    m_ownsCSSOMWrapper = true;
    1054     PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<StyledElement*>(parentElement));
     1054    PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<StylePropertySet*>(this), const_cast<StyledElement*>(parentElement));
    10551055    propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
    10561056    return cssomWrapper;
     1057}
     1058
     1059void StylePropertySet::clearParentElement(StyledElement* element)
     1060{
     1061    if (!m_ownsCSSOMWrapper)
     1062        return;
     1063    ASSERT_UNUSED(element, propertySetCSSOMWrapperMap().get(this)->parentElement() == element);
     1064    propertySetCSSOMWrapperMap().get(this)->clearParentElement();
    10571065}
    10581066
  • trunk/Source/WebCore/css/StylePropertySet.h

    r121562 r121570  
    104104    String asText() const;
    105105   
     106    void clearParentElement(StyledElement*);
     107
    106108    CSSStyleDeclaration* ensureCSSStyleDeclaration() const;
    107109    CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(const StyledElement* parentElement) const;
  • trunk/Source/WebCore/dom/ElementAttributeData.cpp

    r121562 r121570  
    162162}
    163163
     164void ElementAttributeData::destroyInlineStyle(StyledElement* element)
     165{
     166    if (!m_inlineStyleDecl)
     167        return;
     168    m_inlineStyleDecl->clearParentElement(element);
     169    m_inlineStyleDecl = 0;
     170}
     171
    164172void ElementAttributeData::addAttribute(const Attribute& attribute, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute)
    165173{
  • trunk/Source/WebCore/dom/ElementAttributeData.h

    r121562 r121570  
    6868    StylePropertySet* ensureMutableInlineStyle(StyledElement*);
    6969    void updateInlineStyleAvoidingMutation(StyledElement*, const String& text);
     70    void destroyInlineStyle(StyledElement*);
    7071
    7172    StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); }
  • trunk/Source/WebCore/dom/StyledElement.cpp

    r121562 r121570  
    136136}
    137137
     138StyledElement::~StyledElement()
     139{
     140    destroyInlineStyle();
     141}
     142
    138143CSSStyleDeclaration* StyledElement::style()
    139144{
     
    179184        if (document() && document()->scriptableDocumentParser() && !document()->isInDocumentWrite())
    180185            startLineNumber = document()->scriptableDocumentParser()->lineNumber();
    181         if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))
     186        if (newStyleString.isNull())
     187            destroyInlineStyle();
     188        else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))
    182189            ensureAttributeData()->updateInlineStyleAvoidingMutation(this, newStyleString);
    183190        setIsStyleAttributeValid();
  • trunk/Source/WebCore/dom/StyledElement.h

    r121562 r121570  
    3636class StyledElement : public Element {
    3737public:
    38     virtual ~StyledElement() { }
     38    virtual ~StyledElement();
    3939
    4040    virtual StylePropertySet* additionalAttributeStyle() { return 0; }
     
    8787    void makePresentationAttributeCacheKey(PresentationAttributeCacheKey&) const;
    8888    void updateAttributeStyle();
     89
     90    void destroyInlineStyle()
     91    {
     92        if (attributeData())
     93            attributeData()->destroyInlineStyle(this);
     94    }
    8995};
    9096
Note: See TracChangeset for help on using the changeset viewer.