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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 visitor->trace(m_y); | 49 visitor->trace(m_y); |
50 visitor->trace(m_width); | 50 visitor->trace(m_width); |
51 visitor->trace(m_height); | 51 visitor->trace(m_height); |
52 visitor->trace(m_rx); | 52 visitor->trace(m_rx); |
53 visitor->trace(m_ry); | 53 visitor->trace(m_ry); |
54 SVGGeometryElement::trace(visitor); | 54 SVGGeometryElement::trace(visitor); |
55 } | 55 } |
56 | 56 |
57 DEFINE_NODE_FACTORY(SVGRectElement) | 57 DEFINE_NODE_FACTORY(SVGRectElement) |
58 | 58 |
59 bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName) | |
60 { | |
61 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
62 if (supportedAttributes.isEmpty()) { | |
63 supportedAttributes.add(SVGNames::xAttr); | |
64 supportedAttributes.add(SVGNames::yAttr); | |
65 supportedAttributes.add(SVGNames::widthAttr); | |
66 supportedAttributes.add(SVGNames::heightAttr); | |
67 supportedAttributes.add(SVGNames::rxAttr); | |
68 supportedAttributes.add(SVGNames::ryAttr); | |
69 } | |
70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
71 } | |
72 | |
73 bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) cons
t | 59 bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) cons
t |
74 { | 60 { |
75 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr | 61 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
76 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr | 62 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr |
77 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | 63 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) |
78 return true; | 64 return true; |
79 return SVGGeometryElement::isPresentationAttribute(attrName); | 65 return SVGGeometryElement::isPresentationAttribute(attrName); |
80 } | 66 } |
81 | 67 |
82 bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr
Name) const | 68 bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr
Name) const |
(...skipping 19 matching lines...) Expand all Loading... |
102 else if (property == m_rx) | 88 else if (property == m_rx) |
103 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *
m_rx->currentValue()); | 89 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *
m_rx->currentValue()); |
104 else if (property == m_ry) | 90 else if (property == m_ry) |
105 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *
m_ry->currentValue()); | 91 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *
m_ry->currentValue()); |
106 else | 92 else |
107 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); | 93 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); |
108 } | 94 } |
109 | 95 |
110 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) | 96 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) |
111 { | 97 { |
112 if (!isSupportedAttribute(attrName)) { | 98 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
113 SVGGeometryElement::svgAttributeChanged(attrName); | 99 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr |
| 100 || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) { |
| 101 SVGElement::InvalidationGuard invalidationGuard(this); |
| 102 |
| 103 invalidateSVGPresentationAttributeStyle(); |
| 104 setNeedsStyleRecalc(LocalStyleChange, |
| 105 StyleChangeReasonForTracing::fromAttribute(attrName)); |
| 106 updateRelativeLengthsInformation(); |
| 107 |
| 108 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); |
| 109 if (!renderer) |
| 110 return; |
| 111 |
| 112 renderer->setNeedsShapeUpdate(); |
| 113 markForLayoutAndParentResourceInvalidation(renderer); |
| 114 |
114 return; | 115 return; |
115 } | 116 } |
116 | 117 |
117 SVGElement::InvalidationGuard invalidationGuard(this); | 118 SVGGeometryElement::svgAttributeChanged(attrName); |
118 | |
119 invalidateSVGPresentationAttributeStyle(); | |
120 setNeedsStyleRecalc(LocalStyleChange, | |
121 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
122 updateRelativeLengthsInformation(); | |
123 | |
124 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | |
125 if (!renderer) | |
126 return; | |
127 | |
128 renderer->setNeedsShapeUpdate(); | |
129 markForLayoutAndParentResourceInvalidation(renderer); | |
130 } | 119 } |
131 | 120 |
132 bool SVGRectElement::selfHasRelativeLengths() const | 121 bool SVGRectElement::selfHasRelativeLengths() const |
133 { | 122 { |
134 return m_x->currentValue()->isRelative() | 123 return m_x->currentValue()->isRelative() |
135 || m_y->currentValue()->isRelative() | 124 || m_y->currentValue()->isRelative() |
136 || m_width->currentValue()->isRelative() | 125 || m_width->currentValue()->isRelative() |
137 || m_height->currentValue()->isRelative() | 126 || m_height->currentValue()->isRelative() |
138 || m_rx->currentValue()->isRelative() | 127 || m_rx->currentValue()->isRelative() |
139 || m_ry->currentValue()->isRelative(); | 128 || m_ry->currentValue()->isRelative(); |
140 } | 129 } |
141 | 130 |
142 LayoutObject* SVGRectElement::createLayoutObject(const ComputedStyle&) | 131 LayoutObject* SVGRectElement::createLayoutObject(const ComputedStyle&) |
143 { | 132 { |
144 return new LayoutSVGRect(this); | 133 return new LayoutSVGRect(this); |
145 } | 134 } |
146 | 135 |
147 } // namespace blink | 136 } // namespace blink |
OLD | NEW |