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 |
60 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) | 75 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) |
61 { | 76 { |
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
63 if (supportedAttributes.isEmpty()) { | 78 if (supportedAttributes.isEmpty()) { |
64 SVGURIReference::addSupportedAttributes(supportedAttributes); | 79 SVGURIReference::addSupportedAttributes(supportedAttributes); |
65 supportedAttributes.add(SVGNames::gradientUnitsAttr); | 80 supportedAttributes.add(SVGNames::gradientUnitsAttr); |
66 supportedAttributes.add(SVGNames::gradientTransformAttr); | 81 supportedAttributes.add(SVGNames::gradientTransformAttr); |
67 supportedAttributes.add(SVGNames::spreadMethodAttr); | 82 supportedAttributes.add(SVGNames::spreadMethodAttr); |
68 } | 83 } |
69 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 84 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
70 } | 85 } |
71 | 86 |
72 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 87 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
73 { | 88 { |
74 parseAttributeNew(name, value); | 89 parseAttributeNew(name, value); |
75 } | 90 } |
76 | 91 |
77 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) | 92 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) |
78 { | 93 { |
79 if (!isSupportedAttribute(attrName)) { | 94 if (!isSupportedAttribute(attrName)) { |
80 SVGElement::svgAttributeChanged(attrName); | 95 SVGElement::svgAttributeChanged(attrName); |
81 return; | 96 return; |
82 } | 97 } |
83 | 98 |
| 99 if (attrName == SVGNames::gradientTransformAttr) { |
| 100 invalidateSVGPresentationAttributeStyle(); |
| 101 setNeedsStyleRecalc(LocalStyleChange); |
| 102 } |
| 103 |
84 SVGElement::InvalidationGuard invalidationGuard(this); | 104 SVGElement::InvalidationGuard invalidationGuard(this); |
85 | 105 |
86 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); | 106 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); |
87 if (renderer) | 107 if (renderer) |
88 renderer->invalidateCacheAndMarkForLayout(); | 108 renderer->invalidateCacheAndMarkForLayout(); |
89 } | 109 } |
90 | 110 |
91 void SVGGradientElement::childrenChanged(const ChildrenChange& change) | 111 void SVGGradientElement::childrenChanged(const ChildrenChange& change) |
92 { | 112 { |
93 SVGElement::childrenChanged(change); | 113 SVGElement::childrenChanged(change); |
(...skipping 16 matching lines...) Expand all Loading... |
110 offset = std::min(std::max(previousOffset, offset), 1.0f); | 130 offset = std::min(std::max(previousOffset, offset), 1.0f); |
111 previousOffset = offset; | 131 previousOffset = offset; |
112 | 132 |
113 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); | 133 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); |
114 } | 134 } |
115 | 135 |
116 return stops; | 136 return stops; |
117 } | 137 } |
118 | 138 |
119 } | 139 } |
OLD | NEW |