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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 } | 71 } |
72 | 72 |
73 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) | 73 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) |
74 { | 74 { |
75 parseAttributeNew(name, value); | 75 parseAttributeNew(name, value); |
76 } | 76 } |
77 | 77 |
78 bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) cons t | 78 bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) cons t |
79 { | 79 { |
80 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr | 80 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
81 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr | |
81 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | 82 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) |
82 return true; | 83 return true; |
83 return SVGGeometryElement::isPresentationAttribute(attrName); | 84 return SVGGeometryElement::isPresentationAttribute(attrName); |
84 } | 85 } |
85 | 86 |
86 bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr Name) const | 87 bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr Name) const |
87 { | 88 { |
88 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr | 89 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
90 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr | |
89 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | 91 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) |
90 return true; | 92 return true; |
91 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); | 93 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); |
92 } | 94 } |
93 | 95 |
94 void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style) | 96 void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style) |
95 { | 97 { |
96 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); | 98 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); |
97 if (property == m_x) | 99 if (property == m_x) |
98 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue()); | 100 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue()); |
99 else if (property == m_y) | 101 else if (property == m_y) |
100 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue()); | 102 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue()); |
103 else if (property == m_width) | |
104 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth , *m_width->currentValue()); | |
105 else if (property == m_height) | |
106 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeigh t, *m_height->currentValue()); | |
101 else if (property == m_rx) | 107 else if (property == m_rx) |
102 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, * m_rx->currentValue()); | 108 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, * m_rx->currentValue()); |
103 else if (property == m_ry) | 109 else if (property == m_ry) |
104 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, * m_ry->currentValue()); | 110 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, * m_ry->currentValue()); |
105 else | 111 else |
106 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle); | 112 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle); |
107 } | 113 } |
108 | 114 |
109 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) | 115 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) |
110 { | 116 { |
111 if (!isSupportedAttribute(attrName)) { | 117 if (!isSupportedAttribute(attrName)) { |
112 SVGGeometryElement::svgAttributeChanged(attrName); | 118 SVGGeometryElement::svgAttributeChanged(attrName); |
113 return; | 119 return; |
114 } | 120 } |
115 | 121 |
116 SVGElement::InvalidationGuard invalidationGuard(this); | 122 SVGElement::InvalidationGuard invalidationGuard(this); |
117 | 123 |
118 bool isPresentationLengthAttribute = | 124 ASSERT(isSupportedAttribute(attrName)); |
fs
2015/03/12 14:28:48
Probably not the most enlightening assert as long
Erik Dahlström (inactive)
2015/03/12 16:14:56
I'm not sure the assert is very useful, it was an
fs
2015/03/12 16:40:07
I'm fine with dropping the assert altogether. The
Erik Dahlström (inactive)
2015/03/13 09:16:23
Dropped in patchset #5.
| |
119 attrName == SVGNames::xAttr | 125 invalidateSVGPresentationAttributeStyle(); |
120 || attrName == SVGNames::yAttr | 126 setNeedsStyleRecalc(LocalStyleChange, |
121 || attrName == SVGNames::rxAttr | 127 StyleChangeReasonForTracing::fromAttribute(attrName)); |
122 || attrName == SVGNames::ryAttr; | 128 updateRelativeLengthsInformation(); |
123 if (isPresentationLengthAttribute) { | |
124 invalidateSVGPresentationAttributeStyle(); | |
125 setNeedsStyleRecalc(LocalStyleChange, | |
126 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
127 } | |
128 | |
129 bool isLengthAttribute = isPresentationLengthAttribute | |
130 || attrName == SVGNames::widthAttr | |
131 || attrName == SVGNames::heightAttr; | |
132 | |
133 if (isLengthAttribute) | |
134 updateRelativeLengthsInformation(); | |
135 | 129 |
136 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | 130 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); |
137 if (!renderer) | 131 if (!renderer) |
138 return; | 132 return; |
139 | 133 |
140 if (isLengthAttribute) { | 134 renderer->setNeedsShapeUpdate(); |
141 renderer->setNeedsShapeUpdate(); | 135 markForLayoutAndParentResourceInvalidation(renderer); |
142 markForLayoutAndParentResourceInvalidation(renderer); | |
143 return; | |
144 } | |
145 | |
146 ASSERT_NOT_REACHED(); | |
147 } | 136 } |
148 | 137 |
149 bool SVGRectElement::selfHasRelativeLengths() const | 138 bool SVGRectElement::selfHasRelativeLengths() const |
150 { | 139 { |
151 return m_x->currentValue()->isRelative() | 140 return m_x->currentValue()->isRelative() |
152 || m_y->currentValue()->isRelative() | 141 || m_y->currentValue()->isRelative() |
153 || m_width->currentValue()->isRelative() | 142 || m_width->currentValue()->isRelative() |
154 || m_height->currentValue()->isRelative() | 143 || m_height->currentValue()->isRelative() |
155 || m_rx->currentValue()->isRelative() | 144 || m_rx->currentValue()->isRelative() |
156 || m_ry->currentValue()->isRelative(); | 145 || m_ry->currentValue()->isRelative(); |
157 } | 146 } |
158 | 147 |
159 LayoutObject* SVGRectElement::createLayoutObject(const LayoutStyle&) | 148 LayoutObject* SVGRectElement::createLayoutObject(const LayoutStyle&) |
160 { | 149 { |
161 return new LayoutSVGRect(this); | 150 return new LayoutSVGRect(this); |
162 } | 151 } |
163 | 152 |
164 } // namespace blink | 153 } // namespace blink |
OLD | NEW |