2011-04-25 James Robinson <jamesr@chromium.org>
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Apr 2011 05:05:05 +0000 (05:05 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Apr 2011 05:05:05 +0000 (05:05 +0000)
        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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84877 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

index 070755e..4d1264f 100644 (file)
@@ -1,3 +1,27 @@
+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):
+
 2011-04-25  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r84864.
index ff39ab2..e486e53 100644 (file)
@@ -5145,7 +5145,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         if (isInherit) {
             if (id == CSSPropertyTextShadow)
                 return m_style->setTextShadow(m_parentStyle->textShadow() ? new ShadowData(*m_parentStyle->textShadow()) : 0);
-            return m_style->setBoxShadow(m_parentStyle->boxShadow() ? new ShadowData(*m_parentStyle->boxShadow()) : 0);
+            return m_style->setBoxShadow(m_parentStyle->boxShadow() ? adoptPtr(new ShadowData(*m_parentStyle->boxShadow())) : PassOwnPtr<ShadowData>());
         }
         if (isInitial || primitiveValue) // initial | none
             return id == CSSPropertyTextShadow ? m_style->setTextShadow(0) : m_style->setBoxShadow(0);
index 7d8f218..94c6bfa 100644 (file)
@@ -329,7 +329,7 @@ public:
 
 class PropertyWrapperShadow : public PropertyWrapperBase {
 public:
-    PropertyWrapperShadow(int prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(ShadowData*, bool))
+    PropertyWrapperShadow(int prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassOwnPtr<ShadowData>, bool))
         : PropertyWrapperBase(prop)
         , m_getter(getter)
         , m_setter(setter)
@@ -365,7 +365,7 @@ public:
         ShadowData defaultShadowData(0, 0, 0, 0, Normal, property() == CSSPropertyWebkitBoxShadow, Color::transparent);
         ShadowData defaultInsetShadowData(0, 0, 0, 0, Inset, property() == CSSPropertyWebkitBoxShadow, Color::transparent);
 
-        ShadowData* newShadowData = 0;
+        OwnPtr<ShadowData> newShadowData;
         ShadowData* lastShadow = 0;
         
         while (shadowA || shadowB) {
@@ -374,7 +374,7 @@ public:
 
             ShadowData* blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
             if (!lastShadow)
-                newShadowData = blendedShadow;
+                newShadowData = adoptPtr(blendedShadow);
             else
                 lastShadow->setNext(blendedShadow);
 
@@ -384,12 +384,12 @@ public:
             shadowB = shadowB ? shadowB->next() : 0;
         }
         
-        (dst->*m_setter)(newShadowData, false);
+        (dst->*m_setter)(newShadowData.release(), false);
     }
 
 private:
     const ShadowData* (RenderStyle::*m_getter)() const;
-    void (RenderStyle::*m_setter)(ShadowData*, bool);
+    void (RenderStyle::*m_setter)(PassOwnPtr<ShadowData>, bool);
 };
 
 class PropertyWrapperMaybeInvalidColor : public PropertyWrapperBase {
index 6e4c788..5add5ca 100644 (file)
@@ -728,31 +728,29 @@ void RenderStyle::setPageScaleTransform(float scale)
     setTransformOriginY(Length(0, Fixed));
 }
 
-void RenderStyle::setTextShadow(ShadowData* val, bool add)
+void RenderStyle::setTextShadow(PassOwnPtr<ShadowData> shadowData, bool add)
 {
-    ASSERT(!val || (!val->spread() && val->style() == Normal));
+    ASSERT(!shadowData || (!shadowData->spread() && shadowData->style() == Normal));
 
     StyleRareInheritedData* rareData = rareInheritedData.access();
     if (!add) {
-        delete rareData->textShadow;
-        rareData->textShadow = val;
+        rareData->textShadow = shadowData;
         return;
     }
 
-    val->setNext(rareData->textShadow);
-    rareData->textShadow = val;
+    rareData->textShadow = shadowData;
 }
 
-void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add)
+void RenderStyle::setBoxShadow(PassOwnPtr<ShadowData> shadowData, bool add)
 {
     StyleRareNonInheritedData* rareData = rareNonInheritedData.access();
     if (!add) {
-        rareData->m_boxShadow.set(shadowData);
+        rareData->m_boxShadow = shadowData;
         return;
     }
 
     shadowData->setNext(rareData->m_boxShadow.leakPtr());
-    rareData->m_boxShadow.set(shadowData);
+    rareData->m_boxShadow = shadowData;
 }
 
 static RoundedIntRect::Radii calcRadiiFor(const BorderData& border, int width, int height)
index 32e41bc..f6cc07c 100644 (file)
@@ -650,7 +650,7 @@ public:
         return m_background->outline().offset();
     }
 
-    const ShadowData* textShadow() const { return rareInheritedData->textShadow; }
+    const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); }
     void getTextShadowExtent(int& top, int& right, int& bottom, int& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
     void getTextShadowHorizontalExtent(int& left, int& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
     void getTextShadowVerticalExtent(int& top, int& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
@@ -1019,7 +1019,7 @@ public:
 
     // CSS3 Setters
     void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
-    void setTextShadow(ShadowData* val, bool add=false);
+    void setTextShadow(PassOwnPtr<ShadowData>, bool add = false);
     void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
     void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
     void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c) }
@@ -1034,7 +1034,7 @@ public:
     void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->flexibleBox, ordinal_group, og); }
     void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->flexibleBox, orient, o); }
     void setBoxPack(EBoxAlignment p) { SET_VAR(rareNonInheritedData.access()->flexibleBox, pack, p); }
-    void setBoxShadow(ShadowData* val, bool add=false);
+    void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false);
     void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
     void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
     void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->marquee, increment, f); }
index a6a19ea..940a0d9 100644 (file)
@@ -32,7 +32,6 @@ namespace WebCore {
 
 StyleRareInheritedData::StyleRareInheritedData()
     : textStrokeWidth(RenderStyle::initialTextStrokeWidth())
-    , textShadow(0)
     , indent(RenderStyle::initialTextIndent())
     , m_effectiveZoom(RenderStyle::initialZoom())
     , widows(RenderStyle::initialWidows())
@@ -64,7 +63,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
     , textStrokeWidth(o.textStrokeWidth)
     , textFillColor(o.textFillColor)
     , textEmphasisColor(o.textEmphasisColor)
-    , textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
+    , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : 0)
     , highlight(o.highlight)
     , cursorData(o.cursorData)
     , indent(o.indent)
@@ -97,7 +96,6 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
 
 StyleRareInheritedData::~StyleRareInheritedData()
 {
-    delete textShadow;
 }
 
 static bool cursorDataEquivalent(const CursorList* c1, const CursorList* c2)
index bf28f29..da410f1 100644 (file)
@@ -58,7 +58,7 @@ public:
     Color textFillColor;
     Color textEmphasisColor;
 
-    ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
+    OwnPtr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
     AtomicString highlight; // Apple-specific extension for custom highlight rendering.
     
     RefPtr<CursorList> cursorData;
index 3771f13..d85235c 100644 (file)
@@ -34,8 +34,6 @@ namespace WebCore {
 StyleRareNonInheritedData::StyleRareNonInheritedData()
     : lineClamp(RenderStyle::initialLineClamp())
     , opacity(RenderStyle::initialOpacity())
-    , m_content(0)
-    , m_counterDirectives(0)
     , userDrag(RenderStyle::initialUserDrag())
     , textOverflow(RenderStyle::initialTextOverflow())
     , marginBeforeCollapse(MCOLLAPSE)
@@ -49,9 +47,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
 #if USE(ACCELERATED_COMPOSITING)
     , m_runningAcceleratedAnimation(false)
 #endif
-    , m_boxShadow(0)
-    , m_animations(0)
-    , m_transitions(0)
     , m_mask(FillLayer(MaskFillLayer))
     , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
     , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
@@ -71,8 +66,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
     , marquee(o.marquee)
     , m_multiCol(o.m_multiCol)
     , m_transform(o.m_transform)
-    , m_content(0)
-    , m_counterDirectives(0)
     , userDrag(o.userDrag)
     , textOverflow(o.textOverflow)
     , marginBeforeCollapse(o.marginBeforeCollapse)
@@ -86,10 +79,10 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
 #if USE(ACCELERATED_COMPOSITING)
     , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
 #endif
-    , m_boxShadow(o.m_boxShadow ? new ShadowData(*o.m_boxShadow) : 0)
+    , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : PassOwnPtr<ShadowData>())
     , m_boxReflect(o.m_boxReflect)
-    , m_animations(o.m_animations ? new AnimationList(*o.m_animations) : 0)
-    , m_transitions(o.m_transitions ? new AnimationList(*o.m_transitions) : 0)
+    , m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : PassOwnPtr<AnimationList>())
+    , m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : PassOwnPtr<AnimationList>())
     , m_mask(o.m_mask)
     , m_maskBoxImage(o.m_maskBoxImage)
     , m_transformStyle3D(o.m_transformStyle3D)