Changeset 148402 in webkit


Ignore:
Timestamp:
Apr 14, 2013 10:33:13 AM (11 years ago)
Author:
akling@apple.com
Message:

EditingStyle should have a MutableStylePropertySet internally.
<http://webkit.org/b/114588>

Reviewed by Anders Carlsson.

Switch EditingStyle::m_mutableStyle to a RefPtr<MutableStylePropertySet>.

  • css/StylePropertySet.cpp:

(WebCore::StylePropertySet::copyBlockProperties):

  • css/StylePropertySet.h:

(StylePropertySet):

  • editing/EditingStyle.cpp:

(WebCore::EditingStyle::setStyle):
(WebCore::EditingStyle::mergeStyleFromRules):
(WebCore::StyleChange::StyleChange):
(WebCore::setTextDecorationProperty):
(WebCore::StyleChange::extractTextStyles):
(WebCore::diffTextDecorations):
(WebCore::getPropertiesNotIn):

  • editing/EditingStyle.h:

(WebCore::EditingStyle::style):
(EditingStyle):
(StyleChange):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148400 r148402  
     12013-04-14  Andreas Kling  <akling@apple.com>
     2
     3        EditingStyle should have a MutableStylePropertySet internally.
     4        <http://webkit.org/b/114588>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Switch EditingStyle::m_mutableStyle to a RefPtr<MutableStylePropertySet>.
     9
     10        * css/StylePropertySet.cpp:
     11        (WebCore::StylePropertySet::copyBlockProperties):
     12        * css/StylePropertySet.h:
     13        (StylePropertySet):
     14        * editing/EditingStyle.cpp:
     15        (WebCore::EditingStyle::setStyle):
     16        (WebCore::EditingStyle::mergeStyleFromRules):
     17        (WebCore::StyleChange::StyleChange):
     18        (WebCore::setTextDecorationProperty):
     19        (WebCore::StyleChange::extractTextStyles):
     20        (WebCore::diffTextDecorations):
     21        (WebCore::getPropertiesNotIn):
     22        * editing/EditingStyle.h:
     23        (WebCore::EditingStyle::style):
     24        (EditingStyle):
     25        (StyleChange):
     26
    1272013-04-14  Andreas Kling  <akling@apple.com>
    228
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r148400 r148402  
    11071107const unsigned numBlockProperties = WTF_ARRAY_LENGTH(blockProperties);
    11081108
    1109 PassRefPtr<StylePropertySet> StylePropertySet::copyBlockProperties() const
     1109PassRefPtr<MutableStylePropertySet> StylePropertySet::copyBlockProperties() const
    11101110{
    11111111    return copyPropertiesInSet(blockProperties, numBlockProperties);
  • trunk/Source/WebCore/css/StylePropertySet.h

    r148400 r148402  
    118118    void removePrefixedOrUnprefixedProperty(CSSPropertyID);
    119119
    120     PassRefPtr<StylePropertySet> copyBlockProperties() const;
     120    PassRefPtr<MutableStylePropertySet> copyBlockProperties() const;
    121121    void removeBlockProperties();
    122122    bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
  • trunk/Source/WebCore/editing/EditingStyle.cpp

    r148396 r148402  
    109109}
    110110
    111 static PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle);
     111static PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle);
    112112enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelValuesMatch };
    113113static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode);
     
    524524}
    525525
    526 void EditingStyle::setStyle(PassRefPtr<StylePropertySet> style)
     526void EditingStyle::setStyle(PassRefPtr<MutableStylePropertySet> style)
    527527{
    528528    m_mutableStyle = style;
     
    10891089void EditingStyle::mergeStyleFromRules(StyledElement* element)
    10901090{
    1091     RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element,
     1091    RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element,
    10921092        StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules);
    10931093    // Styles from the inline style declaration, held in the variable "style", take precedence
     
    13431343    RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle();
    13441344    // FIXME: take care of background-color in effect
    1345     RefPtr<StylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());
     1345    RefPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());
    13461346
    13471347    reconcileTextDecorationProperties(mutableStyle.get());
     
    13621362}
    13631363
    1364 static void setTextDecorationProperty(StylePropertySet* style, const CSSValueList* newTextDecoration, CSSPropertyID propertyID)
     1364static void setTextDecorationProperty(MutableStylePropertySet* style, const CSSValueList* newTextDecoration, CSSPropertyID propertyID)
    13651365{
    13661366    if (newTextDecoration->length())
     
    13731373}
    13741374
    1375 void StyleChange::extractTextStyles(Document* document, StylePropertySet* style, bool shouldUseFixedFontDefaultSize)
     1375void StyleChange::extractTextStyles(Document* document, MutableStylePropertySet* style, bool shouldUseFixedFontDefaultSize)
    13761376{
    13771377    ASSERT(style);
     
    14381438}
    14391439
    1440 static void diffTextDecorations(StylePropertySet* style, CSSPropertyID propertID, CSSValue* refTextDecoration)
     1440static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID propertID, CSSValue* refTextDecoration)
    14411441{
    14421442    RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(propertID);
     
    14961496}
    14971497
    1498 PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle)
     1498PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle)
    14991499{
    15001500    ASSERT(styleWithRedundantProperties);
     
    15211521        result->removeProperty(CSSPropertyBackgroundColor);
    15221522
    1523     return result;
     1523    return result.release();
    15241524}
    15251525
  • trunk/Source/WebCore/editing/EditingStyle.h

    r141588 r148402  
    5151class Element;
    5252class HTMLElement;
     53class MutableStylePropertySet;
    5354class Node;
    5455class Position;
     
    99100    ~EditingStyle();
    100101
    101     StylePropertySet* style() { return m_mutableStyle.get(); }
     102    MutableStylePropertySet* style() { return m_mutableStyle.get(); }
    102103    bool textDirection(WritingDirection&) const;
    103104    bool isEmpty() const;
    104     void setStyle(PassRefPtr<StylePropertySet>);
     105    void setStyle(PassRefPtr<MutableStylePropertySet>);
    105106    void overrideWithStyle(const StylePropertySet*);
    106107    void clear();
     
    164165    void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode);
    165166
    166     RefPtr<StylePropertySet> m_mutableStyle;
     167    RefPtr<MutableStylePropertySet> m_mutableStyle;
    167168    bool m_shouldUseFixedDefaultFontSize;
    168169    float m_fontSizeDelta;
     
    218219    }
    219220private:
    220     void extractTextStyles(Document*, StylePropertySet*, bool shouldUseFixedFontDefaultSize);
     221    void extractTextStyles(Document*, MutableStylePropertySet*, bool shouldUseFixedFontDefaultSize);
    221222
    222223    String m_cssStyle;
Note: See TracChangeset for help on using the changeset viewer.