Changeset 148400 in webkit


Ignore:
Timestamp:
Apr 14, 2013 9:43:35 AM (11 years ago)
Author:
akling@apple.com
Message:

Move addParsedProperty/addParsedProperties to MutableStylePropertySet.
<http://webkit.org/b/114587>

Reviewed by Antti Koivisto.

All CSSParser methods that mutate an existing StylePropertySet now take a MutableStylePropertySet*
instead of a StylePropertySet*.

  • css/CSSParser.cpp:

(WebCore::parseColorValue):
(WebCore::parseSimpleLengthValue):
(WebCore::parseKeywordValue):
(WebCore::parseTranslateTransformValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseDeclaration):

  • css/CSSParser.h:

(CSSParser):

  • css/StylePropertySet.cpp:

(WebCore::StylePropertySet::setProperty):
(WebCore::MutableStylePropertySet::addParsedProperties):
(WebCore::MutableStylePropertySet::addParsedProperty):

  • css/StylePropertySet.h:

(StylePropertySet):
(MutableStylePropertySet):

  • css/ViewportStyleResolver.h:

(ViewportStyleResolver):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148399 r148400  
     12013-04-14  Andreas Kling  <akling@apple.com>
     2
     3        Move addParsedProperty/addParsedProperties to MutableStylePropertySet.
     4        <http://webkit.org/b/114587>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        All CSSParser methods that mutate an existing StylePropertySet now take a MutableStylePropertySet*
     9        instead of a StylePropertySet*.
     10
     11        * css/CSSParser.cpp:
     12        (WebCore::parseColorValue):
     13        (WebCore::parseSimpleLengthValue):
     14        (WebCore::parseKeywordValue):
     15        (WebCore::parseTranslateTransformValue):
     16        (WebCore::CSSParser::parseValue):
     17        (WebCore::CSSParser::parseDeclaration):
     18        * css/CSSParser.h:
     19        (CSSParser):
     20        * css/StylePropertySet.cpp:
     21        (WebCore::StylePropertySet::setProperty):
     22        (WebCore::MutableStylePropertySet::addParsedProperties):
     23        (WebCore::MutableStylePropertySet::addParsedProperty):
     24        * css/StylePropertySet.h:
     25        (StylePropertySet):
     26        (MutableStylePropertySet):
     27        * css/ViewportStyleResolver.h:
     28        (ViewportStyleResolver):
     29
    1302013-04-14  Andreas Kling  <akling@apple.com>
    231
  • trunk/Source/WebCore/css/CSSParser.cpp

    r148399 r148400  
    536536}
    537537
    538 static bool parseColorValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
     538static bool parseColorValue(MutableStylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
    539539{
    540540    ASSERT(!string.isEmpty());
     
    634634}
    635635
    636 static bool parseSimpleLengthValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
     636static bool parseSimpleLengthValue(MutableStylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
    637637{
    638638    ASSERT(!string.isEmpty());
     
    11901190}
    11911191
    1192 static bool parseKeywordValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext)
     1192static bool parseKeywordValue(MutableStylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext)
    11931193{
    11941194    ASSERT(!string.isEmpty());
     
    12471247}
    12481248
    1249 static bool parseTranslateTransformValue(StylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important)
     1249static bool parseTranslateTransformValue(MutableStylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important)
    12501250{
    12511251    if (propertyID != CSSPropertyWebkitTransform)
     
    13051305
    13061306#if ENABLE(CSS_VARIABLES)
    1307 bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, Document* document)
     1307bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, Document* document)
    13081308{
    13091309    ASSERT(!string.isEmpty());
     
    13231323#endif
    13241324
    1325 bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)
     1325bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)
    13261326{
    13271327    ASSERT(!string.isEmpty());
     
    13461346}
    13471347
    1348 bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, StyleSheetContents* contextStyleSheet)
     1348bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, StyleSheetContents* contextStyleSheet)
    13491349{
    13501350    setStyleSheet(contextStyleSheet);
     
    14561456
    14571457
    1458 bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, PassRefPtr<CSSRuleSourceData> prpRuleSourceData, StyleSheetContents* contextStyleSheet)
     1458bool CSSParser::parseDeclaration(MutableStylePropertySet* declaration, const String& string, PassRefPtr<CSSRuleSourceData> prpRuleSourceData, StyleSheetContents* contextStyleSheet)
    14591459{
    14601460    // Length of the "@-webkit-decls{" prefix.
  • trunk/Source/WebCore/css/CSSParser.h

    r148399 r148400  
    5858class MediaQueryExp;
    5959class MediaQuerySet;
     60class MutableStylePropertySet;
    6061class StyleKeyframe;
    61 class StylePropertySet;
    6262class StylePropertyShorthand;
    6363class StyleRuleBase;
     
    9393    bool parseSupportsCondition(const String&);
    9494#endif
    95     static bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*);
     95    static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*);
    9696    static bool parseColor(RGBA32& color, const String&, bool strict = false);
    9797    static bool parseSystemColor(RGBA32& color, const String&, Document*);
    9898    static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&);
    9999    PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int ident, CSSParserValue*);
    100     bool parseDeclaration(StylePropertySet*, const String&, PassRefPtr<CSSRuleSourceData>, StyleSheetContents* contextStyleSheet);
     100    bool parseDeclaration(MutableStylePropertySet*, const String&, PassRefPtr<CSSRuleSourceData>, StyleSheetContents* contextStyleSheet);
    101101    static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(const String&, Element*);
    102102    PassOwnPtr<MediaQuery> parseMediaQuery(const String&);
     
    115115
    116116#if ENABLE(CSS_VARIABLES)
    117     static bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, Document*);
     117    static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, Document*);
    118118    bool cssVariablesEnabled() const;
    119119    void storeVariableDeclaration(const CSSParserString&, PassOwnPtr<CSSParserValueList>, bool important);
     
    547547    bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&);
    548548
    549     bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet);
     549    bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet);
    550550    PassRefPtr<ImmutableStylePropertySet> parseDeclaration(const String&, StyleSheetContents* contextStyleSheet);
    551551
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r148398 r148400  
    689689    // When replacing an existing property value, this moves the property to the end of the list.
    690690    // Firefox preserves the position, and MSIE moves the property to the beginning.
    691     return CSSParser::parseValue(this, propertyID, value, important, cssParserMode(), contextStyleSheet);
     691    return CSSParser::parseValue(static_cast<MutableStylePropertySet*>(this), propertyID, value, important, cssParserMode(), contextStyleSheet);
    692692}
    693693
     
    759759}
    760760
    761 void StylePropertySet::addParsedProperties(const Vector<CSSProperty>& properties)
    762 {
    763     ASSERT(isMutable());
     761void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty>& properties)
     762{
    764763    mutablePropertyVector().reserveCapacity(mutablePropertyVector().size() + properties.size());
    765764    for (unsigned i = 0; i < properties.size(); ++i)
     
    767766}
    768767
    769 void StylePropertySet::addParsedProperty(const CSSProperty& property)
    770 {
    771     ASSERT(isMutable());
     768void MutableStylePropertySet::addParsedProperty(const CSSProperty& property)
     769{
    772770    // Only add properties that have no !important counterpart present
    773771    if (!propertyIsImportant(property.id()) || property.isImportant())
  • trunk/Source/WebCore/css/StylePropertySet.h

    r148398 r148400  
    118118    void removePrefixedOrUnprefixedProperty(CSSPropertyID);
    119119
    120     void addParsedProperties(const Vector<CSSProperty>&);
    121     void addParsedProperty(const CSSProperty&);
    122 
    123120    PassRefPtr<StylePropertySet> copyBlockProperties() const;
    124121    void removeBlockProperties();
     
    233230    MutableStylePropertySet(const StylePropertySet&);
    234231
     232    void addParsedProperties(const Vector<CSSProperty>&);
     233    void addParsedProperty(const CSSProperty&);
     234
    235235    void clear();
    236236    void parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet);
  • trunk/Source/WebCore/css/ViewportStyleResolver.h

    r143926 r148400  
    4242class CSSPrimitiveValue;
    4343class Document;
     44class MutableStylePropertySet;
    4445class StyleRuleViewport;
    45 class StylePropertySet;
    4646
    4747class ViewportStyleResolver : public RefCounted<ViewportStyleResolver> {
     
    6565
    6666    Document* m_document;
    67     RefPtr<StylePropertySet> m_propertySet;
     67    RefPtr<MutableStylePropertySet> m_propertySet;
    6868};
    6969
Note: See TracChangeset for help on using the changeset viewer.