| 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 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2) | 35 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2) |
| 36 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2) | 36 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2) |
| 37 DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | 37 DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) |
| 38 | 38 |
| 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement) | 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement) |
| 40 REGISTER_LOCAL_ANIMATED_PROPERTY(x1) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(x1) |
| 41 REGISTER_LOCAL_ANIMATED_PROPERTY(y1) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(y1) |
| 42 REGISTER_LOCAL_ANIMATED_PROPERTY(x2) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(x2) |
| 43 REGISTER_LOCAL_ANIMATED_PROPERTY(y2) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(y2) |
| 44 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) | 45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | |
| 47 END_REGISTER_ANIMATED_PROPERTIES | 46 END_REGISTER_ANIMATED_PROPERTIES |
| 48 | 47 |
| 49 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document* do
cument) | 48 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document* do
cument) |
| 50 : SVGStyledTransformableElement(tagName, document) | 49 : SVGGraphicsElement(tagName, document) |
| 51 , m_x1(LengthModeWidth) | 50 , m_x1(LengthModeWidth) |
| 52 , m_y1(LengthModeHeight) | 51 , m_y1(LengthModeHeight) |
| 53 , m_x2(LengthModeWidth) | 52 , m_x2(LengthModeWidth) |
| 54 , m_y2(LengthModeHeight) | 53 , m_y2(LengthModeHeight) |
| 55 { | 54 { |
| 56 ASSERT(hasTagName(SVGNames::lineTag)); | 55 ASSERT(hasTagName(SVGNames::lineTag)); |
| 57 ScriptWrappable::init(this); | 56 ScriptWrappable::init(this); |
| 58 registerAnimatedPropertiesForSVGLineElement(); | 57 registerAnimatedPropertiesForSVGLineElement(); |
| 59 } | 58 } |
| 60 | 59 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 76 supportedAttributes.add(SVGNames::y2Attr); | 75 supportedAttributes.add(SVGNames::y2Attr); |
| 77 } | 76 } |
| 78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 77 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 79 } | 78 } |
| 80 | 79 |
| 81 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 80 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 82 { | 81 { |
| 83 SVGParsingError parseError = NoError; | 82 SVGParsingError parseError = NoError; |
| 84 | 83 |
| 85 if (!isSupportedAttribute(name)) | 84 if (!isSupportedAttribute(name)) |
| 86 SVGStyledTransformableElement::parseAttribute(name, value); | 85 SVGGraphicsElement::parseAttribute(name, value); |
| 87 else if (name == SVGNames::x1Attr) | 86 else if (name == SVGNames::x1Attr) |
| 88 setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 87 setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
| 89 else if (name == SVGNames::y1Attr) | 88 else if (name == SVGNames::y1Attr) |
| 90 setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 89 setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
| 91 else if (name == SVGNames::x2Attr) | 90 else if (name == SVGNames::x2Attr) |
| 92 setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 91 setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
| 93 else if (name == SVGNames::y2Attr) | 92 else if (name == SVGNames::y2Attr) |
| 94 setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 93 setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
| 95 else if (SVGTests::parseAttribute(name, value) | 94 else if (SVGTests::parseAttribute(name, value) |
| 96 || SVGLangSpace::parseAttribute(name, value) | 95 || SVGLangSpace::parseAttribute(name, value) |
| 97 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 96 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
| 98 } else | 97 } else |
| 99 ASSERT_NOT_REACHED(); | 98 ASSERT_NOT_REACHED(); |
| 100 | 99 |
| 101 reportAttributeParsingError(parseError, name, value); | 100 reportAttributeParsingError(parseError, name, value); |
| 102 } | 101 } |
| 103 | 102 |
| 104 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) | 103 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) |
| 105 { | 104 { |
| 106 if (!isSupportedAttribute(attrName)) { | 105 if (!isSupportedAttribute(attrName)) { |
| 107 SVGStyledTransformableElement::svgAttributeChanged(attrName); | 106 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 108 return; | 107 return; |
| 109 } | 108 } |
| 110 | 109 |
| 111 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 110 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 112 | 111 |
| 113 bool isLengthAttribute = attrName == SVGNames::x1Attr | 112 bool isLengthAttribute = attrName == SVGNames::x1Attr |
| 114 || attrName == SVGNames::y1Attr | 113 || attrName == SVGNames::y1Attr |
| 115 || attrName == SVGNames::x2Attr | 114 || attrName == SVGNames::x2Attr |
| 116 || attrName == SVGNames::y2Attr; | 115 || attrName == SVGNames::y2Attr; |
| 117 | 116 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 141 | 140 |
| 142 bool SVGLineElement::selfHasRelativeLengths() const | 141 bool SVGLineElement::selfHasRelativeLengths() const |
| 143 { | 142 { |
| 144 return x1().isRelative() | 143 return x1().isRelative() |
| 145 || y1().isRelative() | 144 || y1().isRelative() |
| 146 || x2().isRelative() | 145 || x2().isRelative() |
| 147 || y2().isRelative(); | 146 || y2().isRelative(); |
| 148 } | 147 } |
| 149 | 148 |
| 150 } | 149 } |
| OLD | NEW |