| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 { | 43 { |
| 44 visitor->trace(m_cx); | 44 visitor->trace(m_cx); |
| 45 visitor->trace(m_cy); | 45 visitor->trace(m_cy); |
| 46 visitor->trace(m_rx); | 46 visitor->trace(m_rx); |
| 47 visitor->trace(m_ry); | 47 visitor->trace(m_ry); |
| 48 SVGGeometryElement::trace(visitor); | 48 SVGGeometryElement::trace(visitor); |
| 49 } | 49 } |
| 50 | 50 |
| 51 DEFINE_NODE_FACTORY(SVGEllipseElement) | 51 DEFINE_NODE_FACTORY(SVGEllipseElement) |
| 52 | 52 |
| 53 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) | |
| 54 { | |
| 55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 56 if (supportedAttributes.isEmpty()) { | |
| 57 supportedAttributes.add(SVGNames::cxAttr); | |
| 58 supportedAttributes.add(SVGNames::cyAttr); | |
| 59 supportedAttributes.add(SVGNames::rxAttr); | |
| 60 supportedAttributes.add(SVGNames::ryAttr); | |
| 61 } | |
| 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 63 } | |
| 64 | |
| 65 bool SVGEllipseElement::isPresentationAttribute(const QualifiedName& attrName) c
onst | 53 bool SVGEllipseElement::isPresentationAttribute(const QualifiedName& attrName) c
onst |
| 66 { | 54 { |
| 67 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr | 55 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 68 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | 56 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) |
| 69 return true; | 57 return true; |
| 70 return SVGGeometryElement::isPresentationAttribute(attrName); | 58 return SVGGeometryElement::isPresentationAttribute(attrName); |
| 71 } | 59 } |
| 72 | 60 |
| 73 bool SVGEllipseElement::isPresentationAttributeWithSVGDOM(const QualifiedName& a
ttrName) const | 61 bool SVGEllipseElement::isPresentationAttributeWithSVGDOM(const QualifiedName& a
ttrName) const |
| 74 { | 62 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 89 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *
m_rx->currentValue()); | 77 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *
m_rx->currentValue()); |
| 90 else if (property == m_ry) | 78 else if (property == m_ry) |
| 91 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *
m_ry->currentValue()); | 79 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *
m_ry->currentValue()); |
| 92 else | 80 else |
| 93 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); | 81 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); |
| 94 } | 82 } |
| 95 | 83 |
| 96 | 84 |
| 97 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) | 85 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) |
| 98 { | 86 { |
| 99 if (!isSupportedAttribute(attrName)) { | 87 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 100 SVGGeometryElement::svgAttributeChanged(attrName); | 88 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) { |
| 89 SVGElement::InvalidationGuard invalidationGuard(this); |
| 90 |
| 91 invalidateSVGPresentationAttributeStyle(); |
| 92 setNeedsStyleRecalc(LocalStyleChange, |
| 93 StyleChangeReasonForTracing::fromAttribute(attrName)); |
| 94 updateRelativeLengthsInformation(); |
| 95 |
| 96 LayoutSVGShape* object = toLayoutSVGShape(this->layoutObject()); |
| 97 if (!object) |
| 98 return; |
| 99 |
| 100 object->setNeedsShapeUpdate(); |
| 101 markForLayoutAndParentResourceInvalidation(object); |
| 101 return; | 102 return; |
| 102 } | 103 } |
| 103 | 104 |
| 104 SVGElement::InvalidationGuard invalidationGuard(this); | 105 SVGGeometryElement::svgAttributeChanged(attrName); |
| 105 | |
| 106 invalidateSVGPresentationAttributeStyle(); | |
| 107 setNeedsStyleRecalc(LocalStyleChange, | |
| 108 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
| 109 updateRelativeLengthsInformation(); | |
| 110 | |
| 111 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | |
| 112 if (!renderer) | |
| 113 return; | |
| 114 | |
| 115 renderer->setNeedsShapeUpdate(); | |
| 116 markForLayoutAndParentResourceInvalidation(renderer); | |
| 117 } | 106 } |
| 118 | 107 |
| 119 bool SVGEllipseElement::selfHasRelativeLengths() const | 108 bool SVGEllipseElement::selfHasRelativeLengths() const |
| 120 { | 109 { |
| 121 return m_cx->currentValue()->isRelative() | 110 return m_cx->currentValue()->isRelative() |
| 122 || m_cy->currentValue()->isRelative() | 111 || m_cy->currentValue()->isRelative() |
| 123 || m_rx->currentValue()->isRelative() | 112 || m_rx->currentValue()->isRelative() |
| 124 || m_ry->currentValue()->isRelative(); | 113 || m_ry->currentValue()->isRelative(); |
| 125 } | 114 } |
| 126 | 115 |
| 127 LayoutObject* SVGEllipseElement::createLayoutObject(const ComputedStyle&) | 116 LayoutObject* SVGEllipseElement::createLayoutObject(const ComputedStyle&) |
| 128 { | 117 { |
| 129 return new LayoutSVGEllipse(this); | 118 return new LayoutSVGEllipse(this); |
| 130 } | 119 } |
| 131 | 120 |
| 132 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |