| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 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) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
| 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 { | 82 { |
| 83 visitor->trace(m_x); | 83 visitor->trace(m_x); |
| 84 visitor->trace(m_y); | 84 visitor->trace(m_y); |
| 85 visitor->trace(m_width); | 85 visitor->trace(m_width); |
| 86 visitor->trace(m_height); | 86 visitor->trace(m_height); |
| 87 visitor->trace(m_targetElementInstance); | 87 visitor->trace(m_targetElementInstance); |
| 88 SVGGraphicsElement::trace(visitor); | 88 SVGGraphicsElement::trace(visitor); |
| 89 SVGURIReference::trace(visitor); | 89 SVGURIReference::trace(visitor); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool SVGUseElement::isSupportedAttribute(const QualifiedName& attrName) | |
| 93 { | |
| 94 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 95 if (supportedAttributes.isEmpty()) { | |
| 96 SVGURIReference::addSupportedAttributes(supportedAttributes); | |
| 97 supportedAttributes.add(SVGNames::xAttr); | |
| 98 supportedAttributes.add(SVGNames::yAttr); | |
| 99 supportedAttributes.add(SVGNames::widthAttr); | |
| 100 supportedAttributes.add(SVGNames::heightAttr); | |
| 101 } | |
| 102 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 103 } | |
| 104 | |
| 105 #if ENABLE(ASSERT) | 92 #if ENABLE(ASSERT) |
| 106 static inline bool isWellFormedDocument(Document* document) | 93 static inline bool isWellFormedDocument(Document* document) |
| 107 { | 94 { |
| 108 if (document->isXMLDocument()) | 95 if (document->isXMLDocument()) |
| 109 return static_cast<XMLDocumentParser*>(document->parser())->wellFormed()
; | 96 return static_cast<XMLDocumentParser*>(document->parser())->wellFormed()
; |
| 110 return true; | 97 return true; |
| 111 } | 98 } |
| 112 #endif | 99 #endif |
| 113 | 100 |
| 114 Node::InsertionNotificationRequest SVGUseElement::insertedInto(ContainerNode* ro
otParent) | 101 Node::InsertionNotificationRequest SVGUseElement::insertedInto(ContainerNode* ro
otParent) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (property == m_x) | 183 if (property == m_x) |
| 197 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m
_x->currentValue()); | 184 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m
_x->currentValue()); |
| 198 else if (property == m_y) | 185 else if (property == m_y) |
| 199 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m
_y->currentValue()); | 186 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m
_y->currentValue()); |
| 200 else | 187 else |
| 201 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); | 188 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); |
| 202 } | 189 } |
| 203 | 190 |
| 204 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) | 191 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) |
| 205 { | 192 { |
| 206 if (!isSupportedAttribute(attrName)) { | |
| 207 SVGGraphicsElement::svgAttributeChanged(attrName); | |
| 208 return; | |
| 209 } | |
| 210 | |
| 211 SVGElement::InvalidationGuard invalidationGuard(this); | |
| 212 | |
| 213 if (attrName == SVGNames::xAttr | |
| 214 || attrName == SVGNames::yAttr) { | |
| 215 invalidateSVGPresentationAttributeStyle(); | |
| 216 setNeedsStyleRecalc(LocalStyleChange, | |
| 217 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
| 218 } | |
| 219 | |
| 220 LayoutObject* renderer = this->layoutObject(); | |
| 221 if (attrName == SVGNames::xAttr | 193 if (attrName == SVGNames::xAttr |
| 222 || attrName == SVGNames::yAttr | 194 || attrName == SVGNames::yAttr |
| 223 || attrName == SVGNames::widthAttr | 195 || attrName == SVGNames::widthAttr |
| 224 || attrName == SVGNames::heightAttr) { | 196 || attrName == SVGNames::heightAttr) { |
| 197 SVGElement::InvalidationGuard invalidationGuard(this); |
| 198 |
| 199 if (attrName == SVGNames::xAttr |
| 200 || attrName == SVGNames::yAttr) { |
| 201 invalidateSVGPresentationAttributeStyle(); |
| 202 setNeedsStyleRecalc(LocalStyleChange, |
| 203 StyleChangeReasonForTracing::fromAttribute(attrName)); |
| 204 } |
| 205 |
| 225 updateRelativeLengthsInformation(); | 206 updateRelativeLengthsInformation(); |
| 226 if (m_targetElementInstance) { | 207 if (m_targetElementInstance) { |
| 227 ASSERT(m_targetElementInstance->correspondingElement()); | 208 ASSERT(m_targetElementInstance->correspondingElement()); |
| 228 transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get
(), *m_targetElementInstance->correspondingElement()); | 209 transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get
(), *m_targetElementInstance->correspondingElement()); |
| 229 } | 210 } |
| 230 if (renderer) | 211 |
| 231 markForLayoutAndParentResourceInvalidation(renderer); | 212 LayoutObject* object = this->layoutObject(); |
| 213 if (object) |
| 214 markForLayoutAndParentResourceInvalidation(object); |
| 232 return; | 215 return; |
| 233 } | 216 } |
| 234 | 217 |
| 235 if (SVGURIReference::isKnownAttribute(attrName)) { | 218 if (SVGURIReference::isKnownAttribute(attrName)) { |
| 219 SVGElement::InvalidationGuard invalidationGuard(this); |
| 236 bool isExternalReference = isExternalURIReference(hrefString(), document
()); | 220 bool isExternalReference = isExternalURIReference(hrefString(), document
()); |
| 237 if (isExternalReference) { | 221 if (isExternalReference) { |
| 238 KURL url = document().completeURL(hrefString()); | 222 KURL url = document().completeURL(hrefString()); |
| 239 if (url.hasFragmentIdentifier()) { | 223 if (url.hasFragmentIdentifier()) { |
| 240 FetchRequest request(ResourceRequest(url), localName()); | 224 FetchRequest request(ResourceRequest(url), localName()); |
| 241 setDocumentResource(document().fetcher()->fetchSVGDocument(reque
st)); | 225 setDocumentResource(document().fetcher()->fetchSVGDocument(reque
st)); |
| 242 } | 226 } |
| 243 } else { | 227 } else { |
| 244 setDocumentResource(0); | 228 setDocumentResource(0); |
| 245 } | 229 } |
| 246 | 230 |
| 247 invalidateShadowTree(); | 231 invalidateShadowTree(); |
| 248 | 232 |
| 249 return; | 233 return; |
| 250 } | 234 } |
| 251 | 235 |
| 252 if (!renderer) | 236 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 253 return; | |
| 254 | |
| 255 ASSERT_NOT_REACHED(); | |
| 256 } | 237 } |
| 257 | 238 |
| 258 static bool isDisallowedElement(Node* node) | 239 static bool isDisallowedElement(Node* node) |
| 259 { | 240 { |
| 260 // Spec: "Any 'svg', 'symbol', 'g', graphics element or other 'use' is poten
tially a template object that can be re-used | 241 // Spec: "Any 'svg', 'symbol', 'g', graphics element or other 'use' is poten
tially a template object that can be re-used |
| 261 // (i.e., "instanced") in the SVG document via a 'use' element." | 242 // (i.e., "instanced") in the SVG document via a 'use' element." |
| 262 // "Graphics Element" is defined as 'circle', 'ellipse', 'image', 'line', 'p
ath', 'polygon', 'polyline', 'rect', 'text' | 243 // "Graphics Element" is defined as 'circle', 'ellipse', 'image', 'line', 'p
ath', 'polygon', 'polyline', 'rect', 'text' |
| 263 // Excluded are anything that is used by reference or that only make sense t
o appear once in a document. | 244 // Excluded are anything that is used by reference or that only make sense t
o appear once in a document. |
| 264 // We must also allow the shadow roots of other use elements. | 245 // We must also allow the shadow roots of other use elements. |
| 265 if (node->isShadowRoot() || node->isTextNode()) | 246 if (node->isShadowRoot() || node->isTextNode()) |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 762 |
| 782 if (m_resource) | 763 if (m_resource) |
| 783 m_resource->removeClient(this); | 764 m_resource->removeClient(this); |
| 784 | 765 |
| 785 m_resource = resource; | 766 m_resource = resource; |
| 786 if (m_resource) | 767 if (m_resource) |
| 787 m_resource->addClient(this); | 768 m_resource->addClient(this); |
| 788 } | 769 } |
| 789 | 770 |
| 790 } | 771 } |
| OLD | NEW |