Index: third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp |
index b150f6c6504ae0bb3c18126ea3256ce887912da8..8330940a1e10bc1dfc173bd82109f114eae8140b 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp |
@@ -59,33 +59,6 @@ void SVGDocumentExtensions::addWebAnimationsPendingSVGElement(SVGElement& elemen |
m_webAnimationsPendingSVGElements.add(&element); |
} |
-void SVGDocumentExtensions::addResource(const AtomicString& id, LayoutSVGResourceContainer* resource) |
-{ |
- ASSERT(resource); |
- |
- if (id.isEmpty()) |
- return; |
- |
- // Replaces resource if already present, to handle potential id changes |
- m_resources.set(id, resource); |
-} |
- |
-void SVGDocumentExtensions::removeResource(const AtomicString& id) |
-{ |
- if (id.isEmpty()) |
- return; |
- |
- m_resources.remove(id); |
-} |
- |
-LayoutSVGResourceContainer* SVGDocumentExtensions::resourceById(const AtomicString& id) const |
-{ |
- if (id.isEmpty()) |
- return nullptr; |
- |
- return m_resources.get(id); |
-} |
- |
void SVGDocumentExtensions::serviceOnAnimationFrame(Document& document) |
{ |
if (!document.svgExtensions()) |
@@ -154,150 +127,6 @@ void SVGDocumentExtensions::reportError(const String& message) |
m_document->addConsoleMessage(consoleMessage); |
} |
-void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element* element) |
-{ |
- ASSERT(element); |
- ASSERT(element->inShadowIncludingDocument()); |
- |
- if (id.isEmpty()) |
- return; |
- |
- HeapHashMap<AtomicString, Member<SVGPendingElements>>::AddResult result = m_pendingResources.add(id, nullptr); |
- if (result.isNewEntry) |
- result.storedValue->value = new SVGPendingElements; |
- result.storedValue->value->add(element); |
- |
- element->setHasPendingResources(); |
-} |
- |
-bool SVGDocumentExtensions::hasPendingResource(const AtomicString& id) const |
-{ |
- if (id.isEmpty()) |
- return false; |
- |
- return m_pendingResources.contains(id); |
-} |
- |
-bool SVGDocumentExtensions::isElementPendingResources(Element* element) const |
-{ |
- // This algorithm takes time proportional to the number of pending resources and need not. |
- // If performance becomes an issue we can keep a counted set of elements and answer the question efficiently. |
- |
- ASSERT(element); |
- |
- for (const auto& entry : m_pendingResources) { |
- SVGPendingElements* elements = entry.value.get(); |
- ASSERT(elements); |
- |
- if (elements->contains(element)) |
- return true; |
- } |
- return false; |
-} |
- |
-bool SVGDocumentExtensions::isElementPendingResource(Element* element, const AtomicString& id) const |
-{ |
- ASSERT(element); |
- |
- if (!hasPendingResource(id)) |
- return false; |
- |
- return m_pendingResources.get(id)->contains(element); |
-} |
- |
-void SVGDocumentExtensions::clearHasPendingResourcesIfPossible(Element* element) |
-{ |
- if (!isElementPendingResources(element)) |
- element->clearHasPendingResources(); |
-} |
- |
-void SVGDocumentExtensions::removeElementFromPendingResources(Element* element) |
-{ |
- ASSERT(element); |
- |
- // Remove the element from pending resources. |
- if (!m_pendingResources.isEmpty() && element->hasPendingResources()) { |
- Vector<AtomicString> toBeRemoved; |
- for (const auto& entry : m_pendingResources) { |
- SVGPendingElements* elements = entry.value.get(); |
- ASSERT(elements); |
- ASSERT(!elements->isEmpty()); |
- |
- elements->remove(element); |
- if (elements->isEmpty()) |
- toBeRemoved.append(entry.key); |
- } |
- |
- clearHasPendingResourcesIfPossible(element); |
- |
- // We use the removePendingResource function here because it deals with set lifetime correctly. |
- for (const AtomicString& id : toBeRemoved) |
- removePendingResource(id); |
- } |
- |
- // Remove the element from pending resources that were scheduled for removal. |
- if (!m_pendingResourcesForRemoval.isEmpty()) { |
- Vector<AtomicString> toBeRemoved; |
- for (const auto& entry : m_pendingResourcesForRemoval) { |
- SVGPendingElements* elements = entry.value.get(); |
- ASSERT(elements); |
- ASSERT(!elements->isEmpty()); |
- |
- elements->remove(element); |
- if (elements->isEmpty()) |
- toBeRemoved.append(entry.key); |
- } |
- |
- // We use the removePendingResourceForRemoval function here because it deals with set lifetime correctly. |
- for (const AtomicString& id : toBeRemoved) |
- removePendingResourceForRemoval(id); |
- } |
-} |
- |
-SVGDocumentExtensions::SVGPendingElements* SVGDocumentExtensions::removePendingResource(const AtomicString& id) |
-{ |
- ASSERT(m_pendingResources.contains(id)); |
- return m_pendingResources.take(id); |
-} |
- |
-SVGDocumentExtensions::SVGPendingElements* SVGDocumentExtensions::removePendingResourceForRemoval(const AtomicString& id) |
-{ |
- ASSERT(m_pendingResourcesForRemoval.contains(id)); |
- return m_pendingResourcesForRemoval.take(id); |
-} |
- |
-void SVGDocumentExtensions::markPendingResourcesForRemoval(const AtomicString& id) |
-{ |
- if (id.isEmpty()) |
- return; |
- |
- ASSERT(!m_pendingResourcesForRemoval.contains(id)); |
- |
- Member<SVGPendingElements> existing = m_pendingResources.take(id); |
- if (existing && !existing->isEmpty()) |
- m_pendingResourcesForRemoval.add(id, existing.release()); |
-} |
- |
-Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval(const AtomicString& id) |
-{ |
- if (id.isEmpty()) |
- return nullptr; |
- |
- SVGPendingElements* resourceSet = m_pendingResourcesForRemoval.get(id); |
- if (!resourceSet || resourceSet->isEmpty()) |
- return nullptr; |
- |
- SVGPendingElements::iterator firstElement = resourceSet->begin(); |
- Element* element = *firstElement; |
- |
- resourceSet->remove(firstElement); |
- |
- if (resourceSet->isEmpty()) |
- removePendingResourceForRemoval(id); |
- |
- return element; |
-} |
- |
void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(SVGSVGElement* svgRoot) |
{ |
ASSERT(!m_inRelativeLengthSVGRootsInvalidation); |
@@ -363,8 +192,6 @@ DEFINE_TRACE(SVGDocumentExtensions) |
visitor->trace(m_timeContainers); |
visitor->trace(m_webAnimationsPendingSVGElements); |
visitor->trace(m_relativeLengthSVGRoots); |
- visitor->trace(m_pendingResources); |
- visitor->trace(m_pendingResourcesForRemoval); |
} |
} // namespace blink |