| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann |
| 3 * <zimmermann@kde.org> | 3 * <zimmermann@kde.org> |
| 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 void SVGElement::buildPendingResourcesIfNeeded() { | 107 void SVGElement::buildPendingResourcesIfNeeded() { |
| 108 Document& document = this->document(); | 108 Document& document = this->document(); |
| 109 if (!needsPendingResourceHandling() || !isConnected() || inUseShadowTree()) | 109 if (!needsPendingResourceHandling() || !isConnected() || inUseShadowTree()) |
| 110 return; | 110 return; |
| 111 | 111 |
| 112 SVGDocumentExtensions& extensions = document.accessSVGExtensions(); | 112 SVGDocumentExtensions& extensions = document.accessSVGExtensions(); |
| 113 AtomicString resourceId = getIdAttribute(); | 113 AtomicString resourceId = getIdAttribute(); |
| 114 if (!extensions.hasPendingResource(resourceId)) | 114 if (!extensions.hasPendingResource(resourceId)) |
| 115 return; | 115 return; |
| 116 // Guaranteed by hasPendingResource. |
| 117 DCHECK(!resourceId.isEmpty()); |
| 116 | 118 |
| 117 // Mark pending resources as pending for removal. | 119 // Get pending elements for this id. |
| 118 extensions.markPendingResourcesForRemoval(resourceId); | 120 SVGDocumentExtensions::SVGPendingElements* pendingElements = |
| 121 extensions.removePendingResource(resourceId); |
| 122 if (!pendingElements || pendingElements->isEmpty()) |
| 123 return; |
| 119 | 124 |
| 120 // Rebuild pending resources for each client of a pending resource that is | 125 // Rebuild pending resources for each client of a pending resource that is |
| 121 // being removed. | 126 // being removed. |
| 122 while ( | 127 for (Element* clientElement : *pendingElements) { |
| 123 Element* clientElement = | 128 DCHECK(clientElement->hasPendingResources()); |
| 124 extensions.removeElementFromPendingResourcesForRemoval(resourceId)) { | 129 if (!clientElement->hasPendingResources()) |
| 125 ASSERT(clientElement->hasPendingResources()); | 130 continue; |
| 126 if (clientElement->hasPendingResources()) { | 131 // TODO(fs): Ideally we'd always resolve pending resources async instead of |
| 127 // FIXME: Ideally we'd always resolve pending resources async instead of | 132 // inside insertedInto and svgAttributeChanged. For now we only do it for |
| 128 // inside insertedInto and svgAttributeChanged. For now we only do it for | 133 // <use> since that would stamp out DOM. |
| 129 // <use> since that would stamp out DOM. | 134 if (isSVGUseElement(clientElement)) |
| 130 if (isSVGUseElement(clientElement)) | 135 toSVGUseElement(clientElement)->invalidateShadowTree(); |
| 131 toSVGUseElement(clientElement)->invalidateShadowTree(); | 136 else |
| 132 else | 137 clientElement->buildPendingResource(); |
| 133 clientElement->buildPendingResource(); | 138 extensions.clearHasPendingResourcesIfPossible(clientElement); |
| 134 extensions.clearHasPendingResourcesIfPossible(clientElement); | |
| 135 } | |
| 136 } | 139 } |
| 137 } | 140 } |
| 138 | 141 |
| 139 SVGElementRareData* SVGElement::ensureSVGRareData() { | 142 SVGElementRareData* SVGElement::ensureSVGRareData() { |
| 140 if (hasSVGRareData()) | 143 if (hasSVGRareData()) |
| 141 return svgRareData(); | 144 return svgRareData(); |
| 142 | 145 |
| 143 m_SVGRareData = new SVGElementRareData(this); | 146 m_SVGRareData = new SVGElementRareData(this); |
| 144 return m_SVGRareData.get(); | 147 return m_SVGRareData.get(); |
| 145 } | 148 } |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 visitor->trace(m_className); | 1229 visitor->trace(m_className); |
| 1227 Element::trace(visitor); | 1230 Element::trace(visitor); |
| 1228 } | 1231 } |
| 1229 | 1232 |
| 1230 const AtomicString& SVGElement::eventParameterName() { | 1233 const AtomicString& SVGElement::eventParameterName() { |
| 1231 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 1234 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
| 1232 return evtString; | 1235 return evtString; |
| 1233 } | 1236 } |
| 1234 | 1237 |
| 1235 } // namespace blink | 1238 } // namespace blink |
| OLD | NEW |