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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 , SVGURIReference(this) | 50 , SVGURIReference(this) |
51 , m_gradientTransform(SVGAnimatedTransformList::create(this, SVGNames::gradi
entTransformAttr, SVGTransformList::create())) | 51 , m_gradientTransform(SVGAnimatedTransformList::create(this, SVGNames::gradi
entTransformAttr, SVGTransformList::create())) |
52 , m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(this, S
VGNames::spreadMethodAttr, SVGSpreadMethodPad)) | 52 , m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(this, S
VGNames::spreadMethodAttr, SVGSpreadMethodPad)) |
53 , m_gradientUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(
this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
)) | 53 , m_gradientUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(
this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
)) |
54 { | 54 { |
55 addToPropertyMap(m_gradientTransform); | 55 addToPropertyMap(m_gradientTransform); |
56 addToPropertyMap(m_spreadMethod); | 56 addToPropertyMap(m_spreadMethod); |
57 addToPropertyMap(m_gradientUnits); | 57 addToPropertyMap(m_gradientUnits); |
58 } | 58 } |
59 | 59 |
60 bool SVGGradientElement::isPresentationAttribute(const QualifiedName& name) cons
t | |
61 { | |
62 if (name == SVGNames::gradientTransformAttr) | |
63 return true; | |
64 return SVGElement::isPresentationAttribute(name); | |
65 } | |
66 | |
67 void SVGGradientElement::collectStyleForPresentationAttribute(const QualifiedNam
e& name, const AtomicString& value, MutableStylePropertySet* style) | |
68 { | |
69 if (name == SVGNames::gradientTransformAttr) | |
70 addPropertyToPresentationAttributeStyle(style, CSSPropertyTransform, val
ue); | |
71 else | |
72 SVGElement::collectStyleForPresentationAttribute(name, value, style); | |
73 } | |
74 | |
75 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) | 60 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) |
76 { | 61 { |
77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
78 if (supportedAttributes.isEmpty()) { | 63 if (supportedAttributes.isEmpty()) { |
79 SVGURIReference::addSupportedAttributes(supportedAttributes); | 64 SVGURIReference::addSupportedAttributes(supportedAttributes); |
80 supportedAttributes.add(SVGNames::gradientUnitsAttr); | 65 supportedAttributes.add(SVGNames::gradientUnitsAttr); |
81 supportedAttributes.add(SVGNames::gradientTransformAttr); | 66 supportedAttributes.add(SVGNames::gradientTransformAttr); |
82 supportedAttributes.add(SVGNames::spreadMethodAttr); | 67 supportedAttributes.add(SVGNames::spreadMethodAttr); |
83 } | 68 } |
84 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 69 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
85 } | 70 } |
86 | 71 |
87 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 72 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
88 { | 73 { |
89 parseAttributeNew(name, value); | 74 parseAttributeNew(name, value); |
90 } | 75 } |
91 | 76 |
92 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) | 77 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) |
93 { | 78 { |
94 if (!isSupportedAttribute(attrName)) { | 79 if (!isSupportedAttribute(attrName)) { |
95 SVGElement::svgAttributeChanged(attrName); | 80 SVGElement::svgAttributeChanged(attrName); |
96 return; | 81 return; |
97 } | 82 } |
98 | 83 |
99 if (attrName == SVGNames::gradientTransformAttr) { | |
100 invalidateSVGPresentationAttributeStyle(); | |
101 setNeedsStyleRecalc(LocalStyleChange); | |
102 } | |
103 | |
104 SVGElement::InvalidationGuard invalidationGuard(this); | 84 SVGElement::InvalidationGuard invalidationGuard(this); |
105 | 85 |
106 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); | 86 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); |
107 if (renderer) | 87 if (renderer) |
108 renderer->invalidateCacheAndMarkForLayout(); | 88 renderer->invalidateCacheAndMarkForLayout(); |
109 } | 89 } |
110 | 90 |
111 void SVGGradientElement::childrenChanged(const ChildrenChange& change) | 91 void SVGGradientElement::childrenChanged(const ChildrenChange& change) |
112 { | 92 { |
113 SVGElement::childrenChanged(change); | 93 SVGElement::childrenChanged(change); |
(...skipping 16 matching lines...) Expand all Loading... |
130 offset = std::min(std::max(previousOffset, offset), 1.0f); | 110 offset = std::min(std::max(previousOffset, offset), 1.0f); |
131 previousOffset = offset; | 111 previousOffset = offset; |
132 | 112 |
133 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); | 113 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); |
134 } | 114 } |
135 | 115 |
136 return stops; | 116 return stops; |
137 } | 117 } |
138 | 118 |
139 } | 119 } |
OLD | NEW |