| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterU
nits, filterUnits, SVGUnitTypes::SVGUnitType) | 36 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterU
nits, filterUnits, SVGUnitTypes::SVGUnitType) |
| 37 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, Prim
itiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) | 37 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, Prim
itiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) |
| 38 | 38 |
| 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterElement) | 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterElement) |
| 40 REGISTER_LOCAL_ANIMATED_PROPERTY(filterUnits) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(filterUnits) |
| 41 REGISTER_LOCAL_ANIMATED_PROPERTY(primitiveUnits) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(primitiveUnits) |
| 42 END_REGISTER_ANIMATED_PROPERTIES | 42 END_REGISTER_ANIMATED_PROPERTIES |
| 43 | 43 |
| 44 inline SVGFilterElement::SVGFilterElement(Document& document) | 44 inline SVGFilterElement::SVGFilterElement(Document& document) |
| 45 : SVGElement(SVGNames::filterTag, document) | 45 : SVGElement(SVGNames::filterTag, document) |
| 46 , SVGURIReference(this) |
| 46 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 47 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
| 47 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 48 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
| 48 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 49 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) |
| 49 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 50 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) |
| 50 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr
eate())) | |
| 51 , m_filterRes(SVGAnimatedIntegerOptionalInteger::create(this, SVGNames::filt
erResAttr)) | 51 , m_filterRes(SVGAnimatedIntegerOptionalInteger::create(this, SVGNames::filt
erResAttr)) |
| 52 , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 52 , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
| 53 , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 53 , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
| 54 { | 54 { |
| 55 ScriptWrappable::init(this); | 55 ScriptWrappable::init(this); |
| 56 | 56 |
| 57 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. | 57 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. |
| 58 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. | 58 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. |
| 59 m_x->setDefaultValueAsString("-10%"); | 59 m_x->setDefaultValueAsString("-10%"); |
| 60 m_y->setDefaultValueAsString("-10%"); | 60 m_y->setDefaultValueAsString("-10%"); |
| 61 m_width->setDefaultValueAsString("120%"); | 61 m_width->setDefaultValueAsString("120%"); |
| 62 m_height->setDefaultValueAsString("120%"); | 62 m_height->setDefaultValueAsString("120%"); |
| 63 | 63 |
| 64 addToPropertyMap(m_x); | 64 addToPropertyMap(m_x); |
| 65 addToPropertyMap(m_y); | 65 addToPropertyMap(m_y); |
| 66 addToPropertyMap(m_width); | 66 addToPropertyMap(m_width); |
| 67 addToPropertyMap(m_height); | 67 addToPropertyMap(m_height); |
| 68 addToPropertyMap(m_href); | |
| 69 addToPropertyMap(m_filterRes); | 68 addToPropertyMap(m_filterRes); |
| 70 registerAnimatedPropertiesForSVGFilterElement(); | 69 registerAnimatedPropertiesForSVGFilterElement(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 PassRefPtr<SVGFilterElement> SVGFilterElement::create(Document& document) | 72 PassRefPtr<SVGFilterElement> SVGFilterElement::create(Document& document) |
| 74 { | 73 { |
| 75 return adoptRef(new SVGFilterElement(document)); | 74 return adoptRef(new SVGFilterElement(document)); |
| 76 } | 75 } |
| 77 | 76 |
| 78 void SVGFilterElement::setFilterRes(unsigned x, unsigned y) | 77 void SVGFilterElement::setFilterRes(unsigned x, unsigned y) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 97 supportedAttributes.add(SVGNames::heightAttr); | 96 supportedAttributes.add(SVGNames::heightAttr); |
| 98 supportedAttributes.add(SVGNames::filterResAttr); | 97 supportedAttributes.add(SVGNames::filterResAttr); |
| 99 } | 98 } |
| 100 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 99 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 101 } | 100 } |
| 102 | 101 |
| 103 void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 102 void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 104 { | 103 { |
| 105 SVGParsingError parseError = NoError; | 104 SVGParsingError parseError = NoError; |
| 106 | 105 |
| 107 if (!isSupportedAttribute(name)) | 106 if (!isSupportedAttribute(name)) { |
| 108 SVGElement::parseAttribute(name, value); | 107 SVGElement::parseAttribute(name, value); |
| 109 else if (name == SVGNames::filterUnitsAttr) { | 108 } else if (name == SVGNames::filterUnitsAttr) { |
| 110 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 109 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
| 111 if (propertyValue > 0) | 110 if (propertyValue > 0) |
| 112 setFilterUnitsBaseValue(propertyValue); | 111 setFilterUnitsBaseValue(propertyValue); |
| 113 } else if (name == SVGNames::primitiveUnitsAttr) { | 112 } else if (name == SVGNames::primitiveUnitsAttr) { |
| 114 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 113 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
| 115 if (propertyValue > 0) | 114 if (propertyValue > 0) |
| 116 setPrimitiveUnitsBaseValue(propertyValue); | 115 setPrimitiveUnitsBaseValue(propertyValue); |
| 117 } else if (name == SVGNames::xAttr) | 116 } else if (name == SVGNames::xAttr) { |
| 118 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 117 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
| 119 else if (name == SVGNames::yAttr) | 118 } else if (name == SVGNames::yAttr) { |
| 120 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 119 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
| 121 else if (name == SVGNames::widthAttr) | 120 } else if (name == SVGNames::widthAttr) { |
| 122 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 121 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); |
| 123 else if (name == SVGNames::heightAttr) | 122 } else if (name == SVGNames::heightAttr) { |
| 124 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 123 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; |
| 125 else if (name == SVGNames::filterResAttr) | 124 } else if (name == SVGNames::filterResAttr) { |
| 126 m_filterRes->setBaseValueAsString(value, parseError); | 125 m_filterRes->setBaseValueAsString(value, parseError); |
| 127 else if (name.matches(XLinkNames::hrefAttr)) | 126 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { |
| 128 m_href->setBaseValueAsString(value, parseError); | 127 } else { |
| 129 else | |
| 130 ASSERT_NOT_REACHED(); | 128 ASSERT_NOT_REACHED(); |
| 129 } |
| 131 | 130 |
| 132 reportAttributeParsingError(parseError, name, value); | 131 reportAttributeParsingError(parseError, name, value); |
| 133 } | 132 } |
| 134 | 133 |
| 135 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) | 134 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) |
| 136 { | 135 { |
| 137 if (!isSupportedAttribute(attrName)) { | 136 if (!isSupportedAttribute(attrName)) { |
| 138 SVGElement::svgAttributeChanged(attrName); | 137 SVGElement::svgAttributeChanged(attrName); |
| 139 return; | 138 return; |
| 140 } | 139 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 m_clientsToAdd.add(client); | 188 m_clientsToAdd.add(client); |
| 190 } | 189 } |
| 191 | 190 |
| 192 void SVGFilterElement::removeClient(Node* client) | 191 void SVGFilterElement::removeClient(Node* client) |
| 193 { | 192 { |
| 194 ASSERT(client); | 193 ASSERT(client); |
| 195 m_clientsToAdd.remove(client); | 194 m_clientsToAdd.remove(client); |
| 196 } | 195 } |
| 197 | 196 |
| 198 } | 197 } |
| OLD | NEW |