X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Fcss%2FCSSGradientValue.h;h=9b29da6c96f0f74d2d1c123e26d30b262dea8612;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=7179b6fff8030d9220e50e4c19394af70c7c7107;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/css/CSSGradientValue.h b/src/third_party/WebKit/Source/core/css/CSSGradientValue.h index 7179b6f..9b29da6 100644 --- a/src/third_party/WebKit/Source/core/css/CSSGradientValue.h +++ b/src/third_party/WebKit/Source/core/css/CSSGradientValue.h @@ -47,10 +47,17 @@ enum CSSGradientType { }; enum CSSGradientRepeat { NonRepeating, Repeating }; +// This struct is stack allocated and allocated as part of vectors. +// When allocated on the stack its members are found by conservative +// stack scanning. When allocated as part of Vectors in heap-allocated +// objects its members are visited via the containing object's +// (CSSGradientValue) traceAfterDispatch method. struct CSSGradientColorStop { + ALLOW_ONLY_INLINE_ALLOCATION(); +public: CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; - RefPtr m_position; // percentage or length - RefPtr m_color; + RefPtrWillBeMember m_position; // percentage or length + RefPtrWillBeMember m_color; Color m_resolvedColor; bool m_colorIsDerivedFromElement; bool operator==(const CSSGradientColorStop& other) const @@ -58,16 +65,18 @@ struct CSSGradientColorStop { return compareCSSValuePtr(m_color, other.m_color) && compareCSSValuePtr(m_position, other.m_position); } + + void trace(Visitor*); }; class CSSGradientValue : public CSSImageGeneratorValue { public: PassRefPtr image(RenderObject*, const IntSize&); - void setFirstX(PassRefPtr val) { m_firstX = val; } - void setFirstY(PassRefPtr val) { m_firstY = val; } - void setSecondX(PassRefPtr val) { m_secondX = val; } - void setSecondY(PassRefPtr val) { m_secondY = val; } + void setFirstX(PassRefPtrWillBeRawPtr val) { m_firstX = val; } + void setFirstY(PassRefPtrWillBeRawPtr val) { m_firstY = val; } + void setSecondX(PassRefPtrWillBeRawPtr val) { m_secondX = val; } + void setSecondY(PassRefPtrWillBeRawPtr val) { m_secondY = val; } void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } @@ -86,7 +95,9 @@ public: bool knownToBeOpaque(const RenderObject*) const; void loadSubimages(ResourceFetcher*) { } - PassRefPtr gradientWithStylesResolved(const TextLinkColors&, Color currentColor); + PassRefPtrWillBeRawPtr gradientWithStylesResolved(const TextLinkColors&, Color currentColor); + + void traceAfterDispatch(Visitor*); protected: CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientType gradientType) @@ -118,14 +129,14 @@ protected: bool isCacheable() const; // Points. Some of these may be null. - RefPtr m_firstX; - RefPtr m_firstY; + RefPtrWillBeMember m_firstX; + RefPtrWillBeMember m_firstY; - RefPtr m_secondX; - RefPtr m_secondY; + RefPtrWillBeMember m_secondX; + RefPtrWillBeMember m_secondY; // Stops - Vector m_stops; + WillBeHeapVector m_stops; bool m_stopsSorted; CSSGradientType m_gradientType; bool m_repeating; @@ -136,25 +147,27 @@ DEFINE_CSS_VALUE_TYPE_CASTS(CSSGradientValue, isGradientValue()); class CSSLinearGradientValue : public CSSGradientValue { public: - static PassRefPtr create(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSLinearGradient) + static PassRefPtrWillBeRawPtr create(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSLinearGradient) { - return adoptRef(new CSSLinearGradientValue(repeat, gradientType)); + return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSLinearGradientValue(repeat, gradientType)); } - void setAngle(PassRefPtr val) { m_angle = val; } + void setAngle(PassRefPtrWillBeRawPtr val) { m_angle = val; } String customCSSText() const; // Create the gradient for a given size. PassRefPtr createGradient(const CSSToLengthConversionData&, const IntSize&); - PassRefPtr clone() const + PassRefPtrWillBeRawPtr clone() const { - return adoptRef(new CSSLinearGradientValue(*this)); + return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSLinearGradientValue(*this)); } bool equals(const CSSLinearGradientValue&) const; + void traceAfterDispatch(Visitor*); + private: CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSLinearGradient) : CSSGradientValue(LinearGradientClass, repeat, gradientType) @@ -167,39 +180,41 @@ private: { } - RefPtr m_angle; // may be null. + RefPtrWillBeMember m_angle; // may be null. }; DEFINE_CSS_VALUE_TYPE_CASTS(CSSLinearGradientValue, isLinearGradientValue()); class CSSRadialGradientValue : public CSSGradientValue { public: - static PassRefPtr create(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSRadialGradient) + static PassRefPtrWillBeRawPtr create(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSRadialGradient) { - return adoptRef(new CSSRadialGradientValue(repeat, gradientType)); + return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSRadialGradientValue(repeat, gradientType)); } - PassRefPtr clone() const + PassRefPtrWillBeRawPtr clone() const { - return adoptRef(new CSSRadialGradientValue(*this)); + return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSRadialGradientValue(*this)); } String customCSSText() const; - void setFirstRadius(PassRefPtr val) { m_firstRadius = val; } - void setSecondRadius(PassRefPtr val) { m_secondRadius = val; } + void setFirstRadius(PassRefPtrWillBeRawPtr val) { m_firstRadius = val; } + void setSecondRadius(PassRefPtrWillBeRawPtr val) { m_secondRadius = val; } - void setShape(PassRefPtr val) { m_shape = val; } - void setSizingBehavior(PassRefPtr val) { m_sizingBehavior = val; } + void setShape(PassRefPtrWillBeRawPtr val) { m_shape = val; } + void setSizingBehavior(PassRefPtrWillBeRawPtr val) { m_sizingBehavior = val; } - void setEndHorizontalSize(PassRefPtr val) { m_endHorizontalSize = val; } - void setEndVerticalSize(PassRefPtr val) { m_endVerticalSize = val; } + void setEndHorizontalSize(PassRefPtrWillBeRawPtr val) { m_endHorizontalSize = val; } + void setEndVerticalSize(PassRefPtrWillBeRawPtr val) { m_endVerticalSize = val; } // Create the gradient for a given size. PassRefPtr createGradient(const CSSToLengthConversionData&, const IntSize&); bool equals(const CSSRadialGradientValue&) const; + void traceAfterDispatch(Visitor*); + private: CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSRadialGradient) : CSSGradientValue(RadialGradientClass, repeat, gradientType) @@ -222,15 +237,15 @@ private: float resolveRadius(CSSPrimitiveValue*, const CSSToLengthConversionData&, float* widthOrHeight = 0); // These may be null for non-deprecated gradients. - RefPtr m_firstRadius; - RefPtr m_secondRadius; + RefPtrWillBeMember m_firstRadius; + RefPtrWillBeMember m_secondRadius; // The below are only used for non-deprecated gradients. Any of them may be null. - RefPtr m_shape; - RefPtr m_sizingBehavior; + RefPtrWillBeMember m_shape; + RefPtrWillBeMember m_sizingBehavior; - RefPtr m_endHorizontalSize; - RefPtr m_endVerticalSize; + RefPtrWillBeMember m_endHorizontalSize; + RefPtrWillBeMember m_endVerticalSize; }; DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue());