| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 PassRefPtr<SVGLineElement> SVGLineElement::create(Document& document) | 58 PassRefPtr<SVGLineElement> SVGLineElement::create(Document& document) |
| 59 { | 59 { |
| 60 return adoptRef(new SVGLineElement(document)); | 60 return adoptRef(new SVGLineElement(document)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName) | 63 bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName) |
| 64 { | 64 { |
| 65 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 65 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 66 if (supportedAttributes.isEmpty()) { | 66 if (supportedAttributes.isEmpty()) { |
| 67 SVGLangSpace::addSupportedAttributes(supportedAttributes); | |
| 68 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 67 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 69 supportedAttributes.add(SVGNames::x1Attr); | 68 supportedAttributes.add(SVGNames::x1Attr); |
| 70 supportedAttributes.add(SVGNames::x2Attr); | 69 supportedAttributes.add(SVGNames::x2Attr); |
| 71 supportedAttributes.add(SVGNames::y1Attr); | 70 supportedAttributes.add(SVGNames::y1Attr); |
| 72 supportedAttributes.add(SVGNames::y2Attr); | 71 supportedAttributes.add(SVGNames::y2Attr); |
| 73 } | 72 } |
| 74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 73 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 76 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 78 { | 77 { |
| 79 SVGParsingError parseError = NoError; | 78 SVGParsingError parseError = NoError; |
| 80 | 79 |
| 81 if (!isSupportedAttribute(name)) | 80 if (!isSupportedAttribute(name)) |
| 82 SVGGeometryElement::parseAttribute(name, value); | 81 SVGGeometryElement::parseAttribute(name, value); |
| 83 else if (name == SVGNames::x1Attr) | 82 else if (name == SVGNames::x1Attr) |
| 84 setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 83 setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
| 85 else if (name == SVGNames::y1Attr) | 84 else if (name == SVGNames::y1Attr) |
| 86 setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 85 setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
| 87 else if (name == SVGNames::x2Attr) | 86 else if (name == SVGNames::x2Attr) |
| 88 setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 87 setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
| 89 else if (name == SVGNames::y2Attr) | 88 else if (name == SVGNames::y2Attr) |
| 90 setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 89 setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
| 91 else if (SVGLangSpace::parseAttribute(name, value) | 90 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { |
| 92 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
| 93 } else | 91 } else |
| 94 ASSERT_NOT_REACHED(); | 92 ASSERT_NOT_REACHED(); |
| 95 | 93 |
| 96 reportAttributeParsingError(parseError, name, value); | 94 reportAttributeParsingError(parseError, name, value); |
| 97 } | 95 } |
| 98 | 96 |
| 99 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) | 97 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) |
| 100 { | 98 { |
| 101 if (!isSupportedAttribute(attrName)) { | 99 if (!isSupportedAttribute(attrName)) { |
| 102 SVGGeometryElement::svgAttributeChanged(attrName); | 100 SVGGeometryElement::svgAttributeChanged(attrName); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 116 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 114 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
| 117 if (!renderer) | 115 if (!renderer) |
| 118 return; | 116 return; |
| 119 | 117 |
| 120 if (isLengthAttribute) { | 118 if (isLengthAttribute) { |
| 121 renderer->setNeedsShapeUpdate(); | 119 renderer->setNeedsShapeUpdate(); |
| 122 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 120 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 123 return; | 121 return; |
| 124 } | 122 } |
| 125 | 123 |
| 126 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired
::isKnownAttribute(attrName)) { | 124 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { |
| 127 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 125 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 128 return; | 126 return; |
| 129 } | 127 } |
| 130 | 128 |
| 131 ASSERT_NOT_REACHED(); | 129 ASSERT_NOT_REACHED(); |
| 132 } | 130 } |
| 133 | 131 |
| 134 bool SVGLineElement::selfHasRelativeLengths() const | 132 bool SVGLineElement::selfHasRelativeLengths() const |
| 135 { | 133 { |
| 136 return x1CurrentValue().isRelative() | 134 return x1CurrentValue().isRelative() |
| 137 || y1CurrentValue().isRelative() | 135 || y1CurrentValue().isRelative() |
| 138 || x2CurrentValue().isRelative() | 136 || x2CurrentValue().isRelative() |
| 139 || y2CurrentValue().isRelative(); | 137 || y2CurrentValue().isRelative(); |
| 140 } | 138 } |
| 141 | 139 |
| 142 } | 140 } |
| OLD | NEW |