| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "core/svg/SVGAnimatedEnumeration.h" | 25 #include "core/svg/SVGAnimatedEnumeration.h" |
| 26 #include "core/svg/SVGAnimatedTransformList.h" | 26 #include "core/svg/SVGAnimatedTransformList.h" |
| 27 #include "core/svg/SVGElement.h" | 27 #include "core/svg/SVGElement.h" |
| 28 #include "core/svg/SVGURIReference.h" | 28 #include "core/svg/SVGURIReference.h" |
| 29 #include "core/svg/SVGUnitTypes.h" | 29 #include "core/svg/SVGUnitTypes.h" |
| 30 #include "platform/graphics/Gradient.h" | 30 #include "platform/graphics/Gradient.h" |
| 31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 struct GradientAttributes; |
| 36 |
| 35 enum SVGSpreadMethodType { | 37 enum SVGSpreadMethodType { |
| 36 SVGSpreadMethodUnknown = 0, | 38 SVGSpreadMethodUnknown = 0, |
| 37 SVGSpreadMethodPad, | 39 SVGSpreadMethodPad, |
| 38 SVGSpreadMethodReflect, | 40 SVGSpreadMethodReflect, |
| 39 SVGSpreadMethodRepeat | 41 SVGSpreadMethodRepeat |
| 40 }; | 42 }; |
| 41 template <> | 43 template <> |
| 42 const SVGEnumerationStringEntries& | 44 const SVGEnumerationStringEntries& |
| 43 getStaticStringEntries<SVGSpreadMethodType>(); | 45 getStaticStringEntries<SVGSpreadMethodType>(); |
| 44 | 46 |
| 45 class SVGGradientElement : public SVGElement, public SVGURIReference { | 47 class SVGGradientElement : public SVGElement, public SVGURIReference { |
| 46 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
| 47 USING_GARBAGE_COLLECTED_MIXIN(SVGGradientElement); | 49 USING_GARBAGE_COLLECTED_MIXIN(SVGGradientElement); |
| 48 | 50 |
| 49 public: | 51 public: |
| 50 Vector<Gradient::ColorStop> buildStops(); | 52 SVGAnimatedTransformList* gradientTransform() const { |
| 51 | |
| 52 SVGAnimatedTransformList* gradientTransform() { | |
| 53 return m_gradientTransform.get(); | 53 return m_gradientTransform.get(); |
| 54 } | 54 } |
| 55 SVGAnimatedEnumeration<SVGSpreadMethodType>* spreadMethod() { | 55 SVGAnimatedEnumeration<SVGSpreadMethodType>* spreadMethod() const { |
| 56 return m_spreadMethod.get(); | 56 return m_spreadMethod.get(); |
| 57 } | 57 } |
| 58 SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* gradientUnits() { | 58 SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* gradientUnits() const { |
| 59 return m_gradientUnits.get(); | 59 return m_gradientUnits.get(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 const SVGGradientElement* referencedElement() const; |
| 63 void collectCommonAttributes(GradientAttributes&) const; |
| 64 |
| 62 DECLARE_VIRTUAL_TRACE(); | 65 DECLARE_VIRTUAL_TRACE(); |
| 63 | 66 |
| 64 protected: | 67 protected: |
| 65 SVGGradientElement(const QualifiedName&, Document&); | 68 SVGGradientElement(const QualifiedName&, Document&); |
| 66 | 69 |
| 70 using VisitedSet = HeapHashSet<Member<const SVGGradientElement>>; |
| 71 |
| 67 void svgAttributeChanged(const QualifiedName&) override; | 72 void svgAttributeChanged(const QualifiedName&) override; |
| 68 | 73 |
| 69 private: | 74 private: |
| 70 bool needsPendingResourceHandling() const final { return false; } | 75 bool needsPendingResourceHandling() const final { return false; } |
| 71 | 76 |
| 72 void collectStyleForPresentationAttribute(const QualifiedName&, | 77 void collectStyleForPresentationAttribute(const QualifiedName&, |
| 73 const AtomicString&, | 78 const AtomicString&, |
| 74 MutableStylePropertySet*) override; | 79 MutableStylePropertySet*) override; |
| 75 | 80 |
| 76 void childrenChanged(const ChildrenChange&) final; | 81 void childrenChanged(const ChildrenChange&) final; |
| 77 | 82 |
| 83 Vector<Gradient::ColorStop> buildStops() const; |
| 84 |
| 78 Member<SVGAnimatedTransformList> m_gradientTransform; | 85 Member<SVGAnimatedTransformList> m_gradientTransform; |
| 79 Member<SVGAnimatedEnumeration<SVGSpreadMethodType>> m_spreadMethod; | 86 Member<SVGAnimatedEnumeration<SVGSpreadMethodType>> m_spreadMethod; |
| 80 Member<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>> m_gradientUnits; | 87 Member<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>> m_gradientUnits; |
| 81 }; | 88 }; |
| 82 | 89 |
| 83 inline bool isSVGGradientElement(const SVGElement& element) { | 90 inline bool isSVGGradientElement(const SVGElement& element) { |
| 84 return element.hasTagName(SVGNames::radialGradientTag) || | 91 return element.hasTagName(SVGNames::radialGradientTag) || |
| 85 element.hasTagName(SVGNames::linearGradientTag); | 92 element.hasTagName(SVGNames::linearGradientTag); |
| 86 } | 93 } |
| 87 | 94 |
| 88 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGGradientElement); | 95 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGGradientElement); |
| 89 | 96 |
| 90 } // namespace blink | 97 } // namespace blink |
| 91 | 98 |
| 92 #endif // SVGGradientElement_h | 99 #endif // SVGGradientElement_h |
| OLD | NEW |