Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(778)

Unified Diff: third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp

Issue 2633143002: SVG objects with same idrefs conflict when under different shadow root (Closed)
Patch Set: ensureSVGTreeScopedResources(); add comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2314a2701c3d20c4513e214c710952343f4fbc24..9c656a46483a7fbb922ebb3913d3ed7f79e39149 100644
--- a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
@@ -23,11 +23,9 @@
#include "core/dom/Document.h"
#include "core/inspector/ConsoleMessage.h"
-#include "core/layout/svg/LayoutSVGResourceContainer.h"
#include "core/svg/SVGSVGElement.h"
#include "core/svg/animation/SMILTimeContainer.h"
#include "wtf/AutoReset.h"
-#include "wtf/text/AtomicString.h"
namespace blink {
@@ -52,32 +50,6 @@ void SVGDocumentExtensions::addWebAnimationsPendingSVGElement(
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())
return;
@@ -147,94 +119,6 @@ void SVGDocumentExtensions::reportError(const String& message) {
m_document->addConsoleMessage(consoleMessage);
}
-void SVGDocumentExtensions::addPendingResource(const AtomicString& id,
- Element* element) {
- ASSERT(element);
- ASSERT(element->isConnected());
-
- 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) {
- DCHECK(element);
-
- // Remove the element from pending resources.
- if (m_pendingResources.isEmpty() || !element->hasPendingResources())
- return;
-
- Vector<AtomicString> toBeRemoved;
- for (const auto& entry : m_pendingResources) {
- SVGPendingElements* elements = entry.value.get();
- DCHECK(elements);
- DCHECK(!elements->isEmpty());
-
- elements->remove(element);
- if (elements->isEmpty())
- toBeRemoved.push_back(entry.key);
- }
-
- clearHasPendingResourcesIfPossible(element);
-
- m_pendingResources.removeAll(toBeRemoved);
-}
-
-SVGDocumentExtensions::SVGPendingElements*
-SVGDocumentExtensions::removePendingResource(const AtomicString& id) {
- ASSERT(m_pendingResources.contains(id));
- return m_pendingResources.take(id);
-}
-
void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(
SVGSVGElement* svgRoot) {
ASSERT(!m_inRelativeLengthSVGRootsInvalidation);
@@ -297,7 +181,6 @@ DEFINE_TRACE(SVGDocumentExtensions) {
visitor->trace(m_timeContainers);
visitor->trace(m_webAnimationsPendingSVGElements);
visitor->trace(m_relativeLengthSVGRoots);
- visitor->trace(m_pendingResources);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h ('k') | third_party/WebKit/Source/core/svg/SVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698