| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/svg/SVGElementInstance.h" | 29 #include "core/svg/SVGElementInstance.h" |
| 30 #include "platform/transforms/AffineTransform.h" | 30 #include "platform/transforms/AffineTransform.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 // Animated property definitions | 34 // Animated property definitions |
| 35 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, Patte
rnUnits, patternUnits, SVGUnitTypes::SVGUnitType) | 35 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, Patte
rnUnits, patternUnits, SVGUnitTypes::SVGUnitType) |
| 36 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr
, PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) | 36 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr
, PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) |
| 37 DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr
, PatternTransform, patternTransform) | 37 DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr
, PatternTransform, patternTransform) |
| 38 DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href) | 38 DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href) |
| 39 DEFINE_ANIMATED_RECT(SVGPatternElement, SVGNames::viewBoxAttr, ViewBox, viewBox) | |
| 40 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGPatternElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) | 39 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGPatternElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) |
| 41 | 40 |
| 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) | 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) |
| 43 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) |
| 44 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) |
| 45 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) |
| 46 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
| 47 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) | |
| 48 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 46 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
| 49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
| 50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 48 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
| 51 END_REGISTER_ANIMATED_PROPERTIES | 49 END_REGISTER_ANIMATED_PROPERTIES |
| 52 | 50 |
| 53 inline SVGPatternElement::SVGPatternElement(Document& document) | 51 inline SVGPatternElement::SVGPatternElement(Document& document) |
| 54 : SVGElement(SVGNames::patternTag, document) | 52 : SVGElement(SVGNames::patternTag, document) |
| 55 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 53 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
| 56 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 54 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
| 57 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 55 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) |
| 58 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 56 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) |
| 57 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) |
| 59 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 58 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
| 60 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 59 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
| 61 { | 60 { |
| 62 ScriptWrappable::init(this); | 61 ScriptWrappable::init(this); |
| 63 | 62 |
| 64 addToPropertyMap(m_x); | 63 addToPropertyMap(m_x); |
| 65 addToPropertyMap(m_y); | 64 addToPropertyMap(m_y); |
| 66 addToPropertyMap(m_width); | 65 addToPropertyMap(m_width); |
| 67 addToPropertyMap(m_height); | 66 addToPropertyMap(m_height); |
| 67 addToPropertyMap(m_viewBox); |
| 68 registerAnimatedPropertiesForSVGPatternElement(); | 68 registerAnimatedPropertiesForSVGPatternElement(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) | 71 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) |
| 72 { | 72 { |
| 73 return adoptRef(new SVGPatternElement(document)); | 73 return adoptRef(new SVGPatternElement(document)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) | 76 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) |
| 77 { | 77 { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 if (!attributes.hasY() && current->hasAttribute(SVGNames::yAttr)) | 178 if (!attributes.hasY() && current->hasAttribute(SVGNames::yAttr)) |
| 179 attributes.setY(current->y()->currentValue()); | 179 attributes.setY(current->y()->currentValue()); |
| 180 | 180 |
| 181 if (!attributes.hasWidth() && current->hasAttribute(SVGNames::widthAttr)
) | 181 if (!attributes.hasWidth() && current->hasAttribute(SVGNames::widthAttr)
) |
| 182 attributes.setWidth(current->width()->currentValue()); | 182 attributes.setWidth(current->width()->currentValue()); |
| 183 | 183 |
| 184 if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAtt
r)) | 184 if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAtt
r)) |
| 185 attributes.setHeight(current->height()->currentValue()); | 185 attributes.setHeight(current->height()->currentValue()); |
| 186 | 186 |
| 187 if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxA
ttr) && current->viewBoxCurrentValue().isValid()) | 187 if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxA
ttr) && current->viewBox()->currentValue()->isValid()) |
| 188 attributes.setViewBox(current->viewBoxCurrentValue()); | 188 attributes.setViewBox(current->viewBox()->currentValue()->value()); |
| 189 | 189 |
| 190 if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNam
es::preserveAspectRatioAttr)) | 190 if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNam
es::preserveAspectRatioAttr)) |
| 191 attributes.setPreserveAspectRatio(current->preserveAspectRatioCurren
tValue()); | 191 attributes.setPreserveAspectRatio(current->preserveAspectRatioCurren
tValue()); |
| 192 | 192 |
| 193 if (!attributes.hasPatternUnits() && current->hasAttribute(SVGNames::pat
ternUnitsAttr)) | 193 if (!attributes.hasPatternUnits() && current->hasAttribute(SVGNames::pat
ternUnitsAttr)) |
| 194 attributes.setPatternUnits(current->patternUnitsCurrentValue()); | 194 attributes.setPatternUnits(current->patternUnitsCurrentValue()); |
| 195 | 195 |
| 196 if (!attributes.hasPatternContentUnits() && current->hasAttribute(SVGNam
es::patternContentUnitsAttr)) | 196 if (!attributes.hasPatternContentUnits() && current->hasAttribute(SVGNam
es::patternContentUnitsAttr)) |
| 197 attributes.setPatternContentUnits(current->patternContentUnitsCurren
tValue()); | 197 attributes.setPatternContentUnits(current->patternContentUnitsCurren
tValue()); |
| 198 | 198 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 bool SVGPatternElement::selfHasRelativeLengths() const | 232 bool SVGPatternElement::selfHasRelativeLengths() const |
| 233 { | 233 { |
| 234 return m_x->currentValue()->isRelative() | 234 return m_x->currentValue()->isRelative() |
| 235 || m_y->currentValue()->isRelative() | 235 || m_y->currentValue()->isRelative() |
| 236 || m_width->currentValue()->isRelative() | 236 || m_width->currentValue()->isRelative() |
| 237 || m_height->currentValue()->isRelative(); | 237 || m_height->currentValue()->isRelative(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } | 240 } |
| OLD | NEW |