| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAt
tr, GradientTransform, gradientTransform) | 43 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAt
tr, GradientTransform, gradientTransform) |
| 44 DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href) | 44 DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href) |
| 45 DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredA
ttr, ExternalResourcesRequired, externalResourcesRequired) | 45 DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredA
ttr, ExternalResourcesRequired, externalResourcesRequired) |
| 46 | 46 |
| 47 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement) | 47 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement) |
| 48 REGISTER_LOCAL_ANIMATED_PROPERTY(spreadMethod) | 48 REGISTER_LOCAL_ANIMATED_PROPERTY(spreadMethod) |
| 49 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientUnits) | 49 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientUnits) |
| 50 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform) | 50 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform) |
| 51 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 51 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
| 52 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 52 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 53 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement) | 53 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
| 54 END_REGISTER_ANIMATED_PROPERTIES | 54 END_REGISTER_ANIMATED_PROPERTIES |
| 55 | 55 |
| 56 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* d
ocument) | 56 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* d
ocument) |
| 57 : SVGStyledElement(tagName, document) | 57 : SVGElement(tagName, document) |
| 58 , m_spreadMethod(SVGSpreadMethodPad) | 58 , m_spreadMethod(SVGSpreadMethodPad) |
| 59 , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 59 , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
| 60 { | 60 { |
| 61 ScriptWrappable::init(this); | 61 ScriptWrappable::init(this); |
| 62 registerAnimatedPropertiesForSVGGradientElement(); | 62 registerAnimatedPropertiesForSVGGradientElement(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) | 65 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) |
| 66 { | 66 { |
| 67 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 67 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 68 if (supportedAttributes.isEmpty()) { | 68 if (supportedAttributes.isEmpty()) { |
| 69 SVGURIReference::addSupportedAttributes(supportedAttributes); | 69 SVGURIReference::addSupportedAttributes(supportedAttributes); |
| 70 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 70 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 71 supportedAttributes.add(SVGNames::gradientUnitsAttr); | 71 supportedAttributes.add(SVGNames::gradientUnitsAttr); |
| 72 supportedAttributes.add(SVGNames::gradientTransformAttr); | 72 supportedAttributes.add(SVGNames::gradientTransformAttr); |
| 73 supportedAttributes.add(SVGNames::spreadMethodAttr); | 73 supportedAttributes.add(SVGNames::spreadMethodAttr); |
| 74 } | 74 } |
| 75 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 75 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 78 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
| 79 { | 79 { |
| 80 if (!isSupportedAttribute(name)) { | 80 if (!isSupportedAttribute(name)) { |
| 81 SVGStyledElement::parseAttribute(name, value); | 81 SVGElement::parseAttribute(name, value); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (name == SVGNames::gradientUnitsAttr) { | 85 if (name == SVGNames::gradientUnitsAttr) { |
| 86 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 86 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
| 87 if (propertyValue > 0) | 87 if (propertyValue > 0) |
| 88 setGradientUnitsBaseValue(propertyValue); | 88 setGradientUnitsBaseValue(propertyValue); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 | 91 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 108 return; | 108 return; |
| 109 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 109 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
| 110 return; | 110 return; |
| 111 | 111 |
| 112 ASSERT_NOT_REACHED(); | 112 ASSERT_NOT_REACHED(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) | 115 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) |
| 116 { | 116 { |
| 117 if (!isSupportedAttribute(attrName)) { | 117 if (!isSupportedAttribute(attrName)) { |
| 118 SVGStyledElement::svgAttributeChanged(attrName); | 118 SVGElement::svgAttributeChanged(attrName); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 122 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 123 | 123 |
| 124 if (RenderObject* object = renderer()) | 124 if (RenderObject* object = renderer()) |
| 125 object->setNeedsLayout(true); | 125 object->setNeedsLayout(true); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) | 128 void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) |
| 129 { | 129 { |
| 130 SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange
, childCountDelta); | 130 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
| 131 | 131 |
| 132 if (changedByParser) | 132 if (changedByParser) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 if (RenderObject* object = renderer()) | 135 if (RenderObject* object = renderer()) |
| 136 object->setNeedsLayout(true); | 136 object->setNeedsLayout(true); |
| 137 } | 137 } |
| 138 | 138 |
| 139 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() | 139 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() |
| 140 { | 140 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 159 float r, g, b, a; | 159 float r, g, b, a; |
| 160 color.getRGBA(r, g, b, a); | 160 color.getRGBA(r, g, b, a); |
| 161 | 161 |
| 162 stops.append(Gradient::ColorStop(offset, r, g, b, a)); | 162 stops.append(Gradient::ColorStop(offset, r, g, b, a)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 return stops; | 165 return stops; |
| 166 } | 166 } |
| 167 | 167 |
| 168 } | 168 } |
| OLD | NEW |