Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 DEFINE_TRACE(SVGCircleElement) | 40 DEFINE_TRACE(SVGCircleElement) |
| 41 { | 41 { |
| 42 visitor->trace(m_cx); | 42 visitor->trace(m_cx); |
| 43 visitor->trace(m_cy); | 43 visitor->trace(m_cy); |
| 44 visitor->trace(m_r); | 44 visitor->trace(m_r); |
| 45 SVGGeometryElement::trace(visitor); | 45 SVGGeometryElement::trace(visitor); |
| 46 } | 46 } |
| 47 | 47 |
| 48 DEFINE_NODE_FACTORY(SVGCircleElement) | 48 DEFINE_NODE_FACTORY(SVGCircleElement) |
| 49 | 49 |
| 50 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) | |
| 51 { | |
| 52 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 53 if (supportedAttributes.isEmpty()) { | |
| 54 supportedAttributes.add(SVGNames::cxAttr); | |
| 55 supportedAttributes.add(SVGNames::cyAttr); | |
| 56 supportedAttributes.add(SVGNames::rAttr); | |
| 57 } | |
| 58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 59 } | |
| 60 | |
| 61 bool SVGCircleElement::isPresentationAttribute(const QualifiedName& attrName) co nst | 50 bool SVGCircleElement::isPresentationAttribute(const QualifiedName& attrName) co nst |
| 62 { | 51 { |
| 63 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr | 52 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 64 || attrName == SVGNames::rAttr) | 53 || attrName == SVGNames::rAttr) |
| 65 return true; | 54 return true; |
| 66 return SVGGeometryElement::isPresentationAttribute(attrName); | 55 return SVGGeometryElement::isPresentationAttribute(attrName); |
| 67 } | 56 } |
| 68 | 57 |
| 69 bool SVGCircleElement::isPresentationAttributeWithSVGDOM(const QualifiedName& at trName) const | 58 bool SVGCircleElement::isPresentationAttributeWithSVGDOM(const QualifiedName& at trName) const |
| 70 { | 59 { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 82 else if (property == m_cy) | 71 else if (property == m_cy) |
| 83 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCy, * m_cy->currentValue()); | 72 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCy, * m_cy->currentValue()); |
| 84 else if (property == m_r) | 73 else if (property == m_r) |
| 85 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyR, *m _r->currentValue()); | 74 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyR, *m _r->currentValue()); |
| 86 else | 75 else |
| 87 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle); | 76 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle); |
| 88 } | 77 } |
| 89 | 78 |
| 90 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) | 79 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) |
| 91 { | 80 { |
| 92 if (!isSupportedAttribute(attrName)) { | 81 if (attrName == SVGNames::rAttr |
| 93 SVGGeometryElement::svgAttributeChanged(attrName); | 82 || attrName == SVGNames::cxAttr |
| 83 || attrName == SVGNames::cyAttr) { | |
| 84 SVGElement::InvalidationGuard invalidationGuard(this); | |
| 85 | |
| 86 invalidateSVGPresentationAttributeStyle(); | |
| 87 setNeedsStyleRecalc(LocalStyleChange, | |
| 88 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
| 89 updateRelativeLengthsInformation(); | |
| 90 | |
| 91 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | |
| 92 if (!renderer) | |
| 93 return; | |
| 94 | |
| 95 renderer->setNeedsShapeUpdate(); | |
| 96 markForLayoutAndParentResourceInvalidation(renderer); | |
| 97 | |
|
fs
2015/04/10 14:25:23
Drop this blank line.
Erik Dahlström (inactive)
2015/04/10 15:33:43
Done.
| |
| 94 return; | 98 return; |
| 95 } | 99 } |
| 96 | 100 |
| 97 SVGElement::InvalidationGuard invalidationGuard(this); | 101 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 98 | |
| 99 invalidateSVGPresentationAttributeStyle(); | |
| 100 setNeedsStyleRecalc(LocalStyleChange, | |
| 101 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
| 102 updateRelativeLengthsInformation(); | |
| 103 | |
| 104 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | |
| 105 if (!renderer) | |
| 106 return; | |
| 107 | |
| 108 renderer->setNeedsShapeUpdate(); | |
| 109 markForLayoutAndParentResourceInvalidation(renderer); | |
| 110 } | 102 } |
| 111 | 103 |
| 112 bool SVGCircleElement::selfHasRelativeLengths() const | 104 bool SVGCircleElement::selfHasRelativeLengths() const |
| 113 { | 105 { |
| 114 return m_cx->currentValue()->isRelative() | 106 return m_cx->currentValue()->isRelative() |
| 115 || m_cy->currentValue()->isRelative() | 107 || m_cy->currentValue()->isRelative() |
| 116 || m_r->currentValue()->isRelative(); | 108 || m_r->currentValue()->isRelative(); |
| 117 } | 109 } |
| 118 | 110 |
| 119 LayoutObject* SVGCircleElement::createLayoutObject(const ComputedStyle&) | 111 LayoutObject* SVGCircleElement::createLayoutObject(const ComputedStyle&) |
| 120 { | 112 { |
| 121 return new LayoutSVGEllipse(this); | 113 return new LayoutSVGEllipse(this); |
| 122 } | 114 } |
| 123 | 115 |
| 124 } | 116 } |
| OLD | NEW |