Changeset 84877 in webkit


Ignore:
Timestamp:
Apr 25, 2011 10:05:05 PM (13 years ago)
Author:
jamesr@google.com
Message:

2011-04-25 James Robinson <jamesr@chromium.org>

Reviewed by Eric Seidel.

Fix OwnPtr strict errors in RenderStyle and make StyleRareInheritedData::textShadow an OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=59377

  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty):
  • page/animation/AnimationBase.cpp: (WebCore::PropertyWrapperShadow::PropertyWrapperShadow): (WebCore::PropertyWrapperShadow::blend):
  • rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::setTextShadow): (WebCore::RenderStyle::setBoxShadow):
  • rendering/style/RenderStyle.h: (WebCore::InheritedFlags::textShadow):
  • rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::~StyleRareInheritedData):
  • rendering/style/StyleRareInheritedData.h:
  • rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84871 r84877  
     12011-04-25  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Fix OwnPtr strict errors in RenderStyle and make StyleRareInheritedData::textShadow an OwnPtr
     6        https://bugs.webkit.org/show_bug.cgi?id=59377
     7
     8        * css/CSSStyleSelector.cpp:
     9        (WebCore::CSSStyleSelector::applyProperty):
     10        * page/animation/AnimationBase.cpp:
     11        (WebCore::PropertyWrapperShadow::PropertyWrapperShadow):
     12        (WebCore::PropertyWrapperShadow::blend):
     13        * rendering/style/RenderStyle.cpp:
     14        (WebCore::RenderStyle::setTextShadow):
     15        (WebCore::RenderStyle::setBoxShadow):
     16        * rendering/style/RenderStyle.h:
     17        (WebCore::InheritedFlags::textShadow):
     18        * rendering/style/StyleRareInheritedData.cpp:
     19        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     20        (WebCore::StyleRareInheritedData::~StyleRareInheritedData):
     21        * rendering/style/StyleRareInheritedData.h:
     22        * rendering/style/StyleRareNonInheritedData.cpp:
     23        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
     24
    1252011-04-25  Sheriff Bot  <webkit.review.bot@gmail.com>
    226
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r84729 r84877  
    51465146            if (id == CSSPropertyTextShadow)
    51475147                return m_style->setTextShadow(m_parentStyle->textShadow() ? new ShadowData(*m_parentStyle->textShadow()) : 0);
    5148             return m_style->setBoxShadow(m_parentStyle->boxShadow() ? new ShadowData(*m_parentStyle->boxShadow()) : 0);
     5148            return m_style->setBoxShadow(m_parentStyle->boxShadow() ? adoptPtr(new ShadowData(*m_parentStyle->boxShadow())) : PassOwnPtr<ShadowData>());
    51495149        }
    51505150        if (isInitial || primitiveValue) // initial | none
  • trunk/Source/WebCore/page/animation/AnimationBase.cpp

    r84538 r84877  
    330330class PropertyWrapperShadow : public PropertyWrapperBase {
    331331public:
    332     PropertyWrapperShadow(int prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(ShadowData*, bool))
     332    PropertyWrapperShadow(int prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassOwnPtr<ShadowData>, bool))
    333333        : PropertyWrapperBase(prop)
    334334        , m_getter(getter)
     
    366366        ShadowData defaultInsetShadowData(0, 0, 0, 0, Inset, property() == CSSPropertyWebkitBoxShadow, Color::transparent);
    367367
    368         ShadowData* newShadowData = 0;
     368        OwnPtr<ShadowData> newShadowData;
    369369        ShadowData* lastShadow = 0;
    370370       
     
    375375            ShadowData* blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
    376376            if (!lastShadow)
    377                 newShadowData = blendedShadow;
     377                newShadowData = adoptPtr(blendedShadow);
    378378            else
    379379                lastShadow->setNext(blendedShadow);
     
    385385        }
    386386       
    387         (dst->*m_setter)(newShadowData, false);
     387        (dst->*m_setter)(newShadowData.release(), false);
    388388    }
    389389
    390390private:
    391391    const ShadowData* (RenderStyle::*m_getter)() const;
    392     void (RenderStyle::*m_setter)(ShadowData*, bool);
     392    void (RenderStyle::*m_setter)(PassOwnPtr<ShadowData>, bool);
    393393};
    394394
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r84815 r84877  
    729729}
    730730
    731 void RenderStyle::setTextShadow(ShadowData* val, bool add)
    732 {
    733     ASSERT(!val || (!val->spread() && val->style() == Normal));
     731void RenderStyle::setTextShadow(PassOwnPtr<ShadowData> shadowData, bool add)
     732{
     733    ASSERT(!shadowData || (!shadowData->spread() && shadowData->style() == Normal));
    734734
    735735    StyleRareInheritedData* rareData = rareInheritedData.access();
    736736    if (!add) {
    737         delete rareData->textShadow;
    738         rareData->textShadow = val;
     737        rareData->textShadow = shadowData;
    739738        return;
    740739    }
    741740
    742     val->setNext(rareData->textShadow);
    743     rareData->textShadow = val;
    744 }
    745 
    746 void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add)
     741    rareData->textShadow = shadowData;
     742}
     743
     744void RenderStyle::setBoxShadow(PassOwnPtr<ShadowData> shadowData, bool add)
    747745{
    748746    StyleRareNonInheritedData* rareData = rareNonInheritedData.access();
    749747    if (!add) {
    750         rareData->m_boxShadow.set(shadowData);
     748        rareData->m_boxShadow = shadowData;
    751749        return;
    752750    }
    753751
    754752    shadowData->setNext(rareData->m_boxShadow.leakPtr());
    755     rareData->m_boxShadow.set(shadowData);
     753    rareData->m_boxShadow = shadowData;
    756754}
    757755
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r84380 r84877  
    651651    }
    652652
    653     const ShadowData* textShadow() const { return rareInheritedData->textShadow; }
     653    const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); }
    654654    void getTextShadowExtent(int& top, int& right, int& bottom, int& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
    655655    void getTextShadowHorizontalExtent(int& left, int& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
     
    10201020    // CSS3 Setters
    10211021    void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
    1022     void setTextShadow(ShadowData* val, bool add=false);
     1022    void setTextShadow(PassOwnPtr<ShadowData>, bool add = false);
    10231023    void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
    10241024    void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
     
    10351035    void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->flexibleBox, orient, o); }
    10361036    void setBoxPack(EBoxAlignment p) { SET_VAR(rareNonInheritedData.access()->flexibleBox, pack, p); }
    1037     void setBoxShadow(ShadowData* val, bool add=false);
     1037    void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false);
    10381038    void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
    10391039    void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r81684 r84877  
    3333StyleRareInheritedData::StyleRareInheritedData()
    3434    : textStrokeWidth(RenderStyle::initialTextStrokeWidth())
    35     , textShadow(0)
    3635    , indent(RenderStyle::initialTextIndent())
    3736    , m_effectiveZoom(RenderStyle::initialZoom())
     
    6564    , textFillColor(o.textFillColor)
    6665    , textEmphasisColor(o.textEmphasisColor)
    67     , textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
     66    , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : 0)
    6867    , highlight(o.highlight)
    6968    , cursorData(o.cursorData)
     
    9897StyleRareInheritedData::~StyleRareInheritedData()
    9998{
    100     delete textShadow;
    10199}
    102100
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r81684 r84877  
    5959    Color textEmphasisColor;
    6060
    61     ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
     61    OwnPtr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
    6262    AtomicString highlight; // Apple-specific extension for custom highlight rendering.
    6363   
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r81049 r84877  
    3535    : lineClamp(RenderStyle::initialLineClamp())
    3636    , opacity(RenderStyle::initialOpacity())
    37     , m_content(0)
    38     , m_counterDirectives(0)
    3937    , userDrag(RenderStyle::initialUserDrag())
    4038    , textOverflow(RenderStyle::initialTextOverflow())
     
    5048    , m_runningAcceleratedAnimation(false)
    5149#endif
    52     , m_boxShadow(0)
    53     , m_animations(0)
    54     , m_transitions(0)
    5550    , m_mask(FillLayer(MaskFillLayer))
    5651    , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
     
    7267    , m_multiCol(o.m_multiCol)
    7368    , m_transform(o.m_transform)
    74     , m_content(0)
    75     , m_counterDirectives(0)
    7669    , userDrag(o.userDrag)
    7770    , textOverflow(o.textOverflow)
     
    8780    , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
    8881#endif
    89     , m_boxShadow(o.m_boxShadow ? new ShadowData(*o.m_boxShadow) : 0)
     82    , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : PassOwnPtr<ShadowData>())
    9083    , m_boxReflect(o.m_boxReflect)
    91     , m_animations(o.m_animations ? new AnimationList(*o.m_animations) : 0)
    92     , m_transitions(o.m_transitions ? new AnimationList(*o.m_transitions) : 0)
     84    , m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : PassOwnPtr<AnimationList>())
     85    , m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : PassOwnPtr<AnimationList>())
    9386    , m_mask(o.m_mask)
    9487    , m_maskBoxImage(o.m_maskBoxImage)
Note: See TracChangeset for help on using the changeset viewer.