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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 supportedAttributes.add(SVGNames::rAttr); | 56 supportedAttributes.add(SVGNames::rAttr); |
57 } | 57 } |
58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
59 } | 59 } |
60 | 60 |
61 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 61 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
62 { | 62 { |
63 parseAttributeNew(name, value); | 63 parseAttributeNew(name, value); |
64 } | 64 } |
65 | 65 |
| 66 bool SVGCircleElement::isPresentationAttribute(const QualifiedName& attrName) co
nst |
| 67 { |
| 68 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 69 || attrName == SVGNames::rAttr) |
| 70 return true; |
| 71 return SVGGeometryElement::isPresentationAttribute(attrName); |
| 72 } |
| 73 |
| 74 bool SVGCircleElement::isPresentationAttributeWithSVGDOM(const QualifiedName& at
trName) const |
| 75 { |
| 76 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 77 || attrName == SVGNames::rAttr) |
| 78 return true; |
| 79 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); |
| 80 } |
| 81 |
| 82 void SVGCircleElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) |
| 83 { |
| 84 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute
(name); |
| 85 if (property == m_cx) |
| 86 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCx, *
m_cx->currentValue()); |
| 87 else if (property == m_cy) |
| 88 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCy, *
m_cy->currentValue()); |
| 89 else if (property == m_r) |
| 90 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyR, *m
_r->currentValue()); |
| 91 else |
| 92 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); |
| 93 } |
| 94 |
66 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) | 95 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) |
67 { | 96 { |
68 if (!isSupportedAttribute(attrName)) { | 97 if (!isSupportedAttribute(attrName)) { |
69 SVGGeometryElement::svgAttributeChanged(attrName); | 98 SVGGeometryElement::svgAttributeChanged(attrName); |
70 return; | 99 return; |
71 } | 100 } |
72 | 101 |
73 SVGElement::InvalidationGuard invalidationGuard(this); | 102 SVGElement::InvalidationGuard invalidationGuard(this); |
74 | 103 |
75 bool isLengthAttribute = attrName == SVGNames::cxAttr | 104 invalidateSVGPresentationAttributeStyle(); |
76 || attrName == SVGNames::cyAttr | 105 setNeedsStyleRecalc(LocalStyleChange, |
77 || attrName == SVGNames::rAttr; | 106 StyleChangeReasonForTracing::fromAttribute(attrName)); |
78 | 107 updateRelativeLengthsInformation(); |
79 if (isLengthAttribute) | |
80 updateRelativeLengthsInformation(); | |
81 | 108 |
82 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | 109 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); |
83 if (!renderer) | 110 if (!renderer) |
84 return; | 111 return; |
85 | 112 |
86 if (isLengthAttribute) { | 113 renderer->setNeedsShapeUpdate(); |
87 renderer->setNeedsShapeUpdate(); | 114 markForLayoutAndParentResourceInvalidation(renderer); |
88 markForLayoutAndParentResourceInvalidation(renderer); | |
89 return; | |
90 } | |
91 | |
92 ASSERT_NOT_REACHED(); | |
93 } | 115 } |
94 | 116 |
95 bool SVGCircleElement::selfHasRelativeLengths() const | 117 bool SVGCircleElement::selfHasRelativeLengths() const |
96 { | 118 { |
97 return m_cx->currentValue()->isRelative() | 119 return m_cx->currentValue()->isRelative() |
98 || m_cy->currentValue()->isRelative() | 120 || m_cy->currentValue()->isRelative() |
99 || m_r->currentValue()->isRelative(); | 121 || m_r->currentValue()->isRelative(); |
100 } | 122 } |
101 | 123 |
102 LayoutObject* SVGCircleElement::createLayoutObject(const LayoutStyle&) | 124 LayoutObject* SVGCircleElement::createLayoutObject(const LayoutStyle&) |
103 { | 125 { |
104 return new LayoutSVGEllipse(this); | 126 return new LayoutSVGEllipse(this); |
105 } | 127 } |
106 | 128 |
107 } | 129 } |
OLD | NEW |