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 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> | 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 visitor->trace(m_width); | 62 visitor->trace(m_width); |
63 visitor->trace(m_height); | 63 visitor->trace(m_height); |
64 visitor->trace(m_maskUnits); | 64 visitor->trace(m_maskUnits); |
65 visitor->trace(m_maskContentUnits); | 65 visitor->trace(m_maskContentUnits); |
66 SVGElement::trace(visitor); | 66 SVGElement::trace(visitor); |
67 SVGTests::trace(visitor); | 67 SVGTests::trace(visitor); |
68 } | 68 } |
69 | 69 |
70 DEFINE_NODE_FACTORY(SVGMaskElement) | 70 DEFINE_NODE_FACTORY(SVGMaskElement) |
71 | 71 |
72 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) | |
73 { | |
74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
75 if (supportedAttributes.isEmpty()) { | |
76 SVGTests::addSupportedAttributes(supportedAttributes); | |
77 supportedAttributes.add(SVGNames::maskUnitsAttr); | |
78 supportedAttributes.add(SVGNames::maskContentUnitsAttr); | |
79 supportedAttributes.add(SVGNames::xAttr); | |
80 supportedAttributes.add(SVGNames::yAttr); | |
81 supportedAttributes.add(SVGNames::widthAttr); | |
82 supportedAttributes.add(SVGNames::heightAttr); | |
83 } | |
84 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
85 } | |
86 | |
87 bool SVGMaskElement::isPresentationAttribute(const QualifiedName& attrName) cons
t | 72 bool SVGMaskElement::isPresentationAttribute(const QualifiedName& attrName) cons
t |
88 { | 73 { |
89 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr | 74 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
90 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) | 75 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) |
91 return true; | 76 return true; |
92 return SVGElement::isPresentationAttribute(attrName); | 77 return SVGElement::isPresentationAttribute(attrName); |
93 } | 78 } |
94 | 79 |
95 bool SVGMaskElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr
Name) const | 80 bool SVGMaskElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr
Name) const |
96 { | 81 { |
(...skipping 13 matching lines...) Expand all Loading... |
110 else if (property == m_width) | 95 else if (property == m_width) |
111 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth
, *m_width->currentValue()); | 96 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth
, *m_width->currentValue()); |
112 else if (property == m_height) | 97 else if (property == m_height) |
113 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeigh
t, *m_height->currentValue()); | 98 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeigh
t, *m_height->currentValue()); |
114 else | 99 else |
115 SVGElement::collectStyleForPresentationAttribute(name, value, style); | 100 SVGElement::collectStyleForPresentationAttribute(name, value, style); |
116 } | 101 } |
117 | 102 |
118 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) | 103 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) |
119 { | 104 { |
120 if (!isSupportedAttribute(attrName)) { | 105 bool isLengthAttr = attrName == SVGNames::xAttr |
121 SVGElement::svgAttributeChanged(attrName); | 106 || attrName == SVGNames::yAttr |
| 107 || attrName == SVGNames::widthAttr |
| 108 || attrName == SVGNames::heightAttr; |
| 109 |
| 110 if (isLengthAttr |
| 111 || attrName == SVGNames::maskUnitsAttr |
| 112 || attrName == SVGNames::maskContentUnitsAttr |
| 113 || SVGTests::isKnownAttribute(attrName)) { |
| 114 SVGElement::InvalidationGuard invalidationGuard(this); |
| 115 |
| 116 if (isLengthAttr) { |
| 117 invalidateSVGPresentationAttributeStyle(); |
| 118 setNeedsStyleRecalc(LocalStyleChange, |
| 119 StyleChangeReasonForTracing::fromAttribute(attrName)); |
| 120 updateRelativeLengthsInformation(); |
| 121 } |
| 122 |
| 123 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this
->layoutObject()); |
| 124 if (renderer) |
| 125 renderer->invalidateCacheAndMarkForLayout(); |
| 126 |
122 return; | 127 return; |
123 } | 128 } |
124 | 129 |
125 SVGElement::InvalidationGuard invalidationGuard(this); | 130 SVGElement::svgAttributeChanged(attrName); |
126 | |
127 if (attrName == SVGNames::xAttr | |
128 || attrName == SVGNames::yAttr | |
129 || attrName == SVGNames::widthAttr | |
130 || attrName == SVGNames::heightAttr) { | |
131 invalidateSVGPresentationAttributeStyle(); | |
132 setNeedsStyleRecalc(LocalStyleChange, | |
133 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
134 updateRelativeLengthsInformation(); | |
135 } | |
136 | |
137 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la
youtObject()); | |
138 if (renderer) | |
139 renderer->invalidateCacheAndMarkForLayout(); | |
140 } | 131 } |
141 | 132 |
142 void SVGMaskElement::childrenChanged(const ChildrenChange& change) | 133 void SVGMaskElement::childrenChanged(const ChildrenChange& change) |
143 { | 134 { |
144 SVGElement::childrenChanged(change); | 135 SVGElement::childrenChanged(change); |
145 | 136 |
146 if (change.byParser) | 137 if (change.byParser) |
147 return; | 138 return; |
148 | 139 |
149 if (LayoutObject* object = layoutObject()) | 140 if (LayoutObject* object = layoutObject()) |
150 object->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason:
:ChildChanged); | 141 object->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason:
:ChildChanged); |
151 } | 142 } |
152 | 143 |
153 LayoutObject* SVGMaskElement::createLayoutObject(const ComputedStyle&) | 144 LayoutObject* SVGMaskElement::createLayoutObject(const ComputedStyle&) |
154 { | 145 { |
155 return new LayoutSVGResourceMasker(this); | 146 return new LayoutSVGResourceMasker(this); |
156 } | 147 } |
157 | 148 |
158 bool SVGMaskElement::selfHasRelativeLengths() const | 149 bool SVGMaskElement::selfHasRelativeLengths() const |
159 { | 150 { |
160 return m_x->currentValue()->isRelative() | 151 return m_x->currentValue()->isRelative() |
161 || m_y->currentValue()->isRelative() | 152 || m_y->currentValue()->isRelative() |
162 || m_width->currentValue()->isRelative() | 153 || m_width->currentValue()->isRelative() |
163 || m_height->currentValue()->isRelative(); | 154 || m_height->currentValue()->isRelative(); |
164 } | 155 } |
165 | 156 |
166 } // namespace blink | 157 } // namespace blink |
OLD | NEW |