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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
63 } | 63 } |
64 | 64 |
65 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 65 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
66 { | 66 { |
67 parseAttributeNew(name, value); | 67 parseAttributeNew(name, value); |
68 } | 68 } |
69 | 69 |
70 bool SVGEllipseElement::isPresentationAttribute(const QualifiedName& attrName) c
onst | 70 bool SVGEllipseElement::isPresentationAttribute(const QualifiedName& attrName) c
onst |
71 { | 71 { |
72 if (attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | 72 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 73 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) |
73 return true; | 74 return true; |
74 return SVGGeometryElement::isPresentationAttribute(attrName); | 75 return SVGGeometryElement::isPresentationAttribute(attrName); |
75 } | 76 } |
76 | 77 |
77 bool SVGEllipseElement::isPresentationAttributeWithSVGDOM(const QualifiedName& a
ttrName) const | 78 bool SVGEllipseElement::isPresentationAttributeWithSVGDOM(const QualifiedName& a
ttrName) const |
78 { | 79 { |
79 if (attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | 80 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr |
| 81 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) |
80 return true; | 82 return true; |
81 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); | 83 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); |
82 } | 84 } |
83 | 85 |
84 void SVGEllipseElement::collectStyleForPresentationAttribute(const QualifiedName
& name, const AtomicString& value, MutableStylePropertySet* style) | 86 void SVGEllipseElement::collectStyleForPresentationAttribute(const QualifiedName
& name, const AtomicString& value, MutableStylePropertySet* style) |
85 { | 87 { |
86 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute
(name); | 88 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute
(name); |
87 if (property == m_rx) | 89 if (property == m_cx) |
| 90 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCx, *
m_cx->currentValue()); |
| 91 else if (property == m_cy) |
| 92 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCy, *
m_cy->currentValue()); |
| 93 else if (property == m_rx) |
88 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *
m_rx->currentValue()); | 94 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *
m_rx->currentValue()); |
89 else if (property == m_ry) | 95 else if (property == m_ry) |
90 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *
m_ry->currentValue()); | 96 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *
m_ry->currentValue()); |
91 else | 97 else |
92 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); | 98 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); |
93 } | 99 } |
94 | 100 |
95 | 101 |
96 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) | 102 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) |
97 { | 103 { |
98 if (!isSupportedAttribute(attrName)) { | 104 if (!isSupportedAttribute(attrName)) { |
99 SVGGeometryElement::svgAttributeChanged(attrName); | 105 SVGGeometryElement::svgAttributeChanged(attrName); |
100 return; | 106 return; |
101 } | 107 } |
102 | 108 |
103 SVGElement::InvalidationGuard invalidationGuard(this); | 109 SVGElement::InvalidationGuard invalidationGuard(this); |
104 | 110 |
105 bool isPresentationLengthAttribute = | 111 invalidateSVGPresentationAttributeStyle(); |
106 attrName == SVGNames::rxAttr | 112 setNeedsStyleRecalc(LocalStyleChange, |
107 || attrName == SVGNames::ryAttr; | 113 StyleChangeReasonForTracing::fromAttribute(attrName)); |
108 if (isPresentationLengthAttribute) { | 114 updateRelativeLengthsInformation(); |
109 invalidateSVGPresentationAttributeStyle(); | |
110 setNeedsStyleRecalc(LocalStyleChange, | |
111 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
112 } | |
113 | |
114 bool isLengthAttribute = attrName == SVGNames::cxAttr | |
115 || attrName == SVGNames::cyAttr | |
116 || isPresentationLengthAttribute; | |
117 | |
118 if (isLengthAttribute) | |
119 updateRelativeLengthsInformation(); | |
120 | 115 |
121 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | 116 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); |
122 if (!renderer) | 117 if (!renderer) |
123 return; | 118 return; |
124 | 119 |
125 if (isLengthAttribute) { | 120 renderer->setNeedsShapeUpdate(); |
126 renderer->setNeedsShapeUpdate(); | 121 markForLayoutAndParentResourceInvalidation(renderer); |
127 markForLayoutAndParentResourceInvalidation(renderer); | |
128 return; | |
129 } | |
130 | |
131 ASSERT_NOT_REACHED(); | |
132 } | 122 } |
133 | 123 |
134 bool SVGEllipseElement::selfHasRelativeLengths() const | 124 bool SVGEllipseElement::selfHasRelativeLengths() const |
135 { | 125 { |
136 return m_cx->currentValue()->isRelative() | 126 return m_cx->currentValue()->isRelative() |
137 || m_cy->currentValue()->isRelative() | 127 || m_cy->currentValue()->isRelative() |
138 || m_rx->currentValue()->isRelative() | 128 || m_rx->currentValue()->isRelative() |
139 || m_ry->currentValue()->isRelative(); | 129 || m_ry->currentValue()->isRelative(); |
140 } | 130 } |
141 | 131 |
142 LayoutObject* SVGEllipseElement::createLayoutObject(const LayoutStyle&) | 132 LayoutObject* SVGEllipseElement::createLayoutObject(const LayoutStyle&) |
143 { | 133 { |
144 return new LayoutSVGEllipse(this); | 134 return new LayoutSVGEllipse(this); |
145 } | 135 } |
146 | 136 |
147 } // namespace blink | 137 } // namespace blink |
OLD | NEW |