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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.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/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 5ebdd6f1b632681a517a0e87bd03f273c6cb287b..1c6a0366896a644be21bfb80e623041b545e954a 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -48,6 +48,7 @@
#include "core/svg/SVGGraphicsElement.h"
#include "core/svg/SVGSVGElement.h"
#include "core/svg/SVGTitleElement.h"
+#include "core/svg/SVGTreeScopeResources.h"
#include "core/svg/SVGUseElement.h"
#include "core/svg/properties/SVGProperty.h"
#include "wtf/AutoReset.h"
@@ -84,6 +85,13 @@ void SVGElement::attachLayoutTree(const AttachContext& context) {
element->mapInstanceToElement(this);
}
+TreeScope& SVGElement::treeScopeForIdResolution() const {
+ const SVGElement* treeScopeElement = this;
+ if (const SVGElement* element = correspondingElement())
+ treeScopeElement = element;
+ return treeScopeElement->treeScope();
+}
+
int SVGElement::tabIndex() const {
if (supportsFocus())
return Element::tabIndex();
@@ -101,20 +109,20 @@ void SVGElement::willRecalcStyle(StyleRecalcChange change) {
}
void SVGElement::buildPendingResourcesIfNeeded() {
- Document& document = this->document();
if (!needsPendingResourceHandling() || !isConnected() || inUseShadowTree())
return;
- SVGDocumentExtensions& extensions = document.accessSVGExtensions();
+ SVGTreeScopeResources& treeScopeResources =
+ treeScope().ensureSVGTreeScopedResources();
AtomicString resourceId = getIdAttribute();
- if (!extensions.hasPendingResource(resourceId))
+ if (!treeScopeResources.hasPendingResource(resourceId))
return;
// Guaranteed by hasPendingResource.
DCHECK(!resourceId.isEmpty());
// Get pending elements for this id.
- SVGDocumentExtensions::SVGPendingElements* pendingElements =
- extensions.removePendingResource(resourceId);
+ SVGTreeScopeResources::SVGPendingElements* pendingElements =
+ treeScopeResources.removePendingResource(resourceId);
if (!pendingElements || pendingElements->isEmpty())
return;
@@ -131,7 +139,7 @@ void SVGElement::buildPendingResourcesIfNeeded() {
toSVGUseElement(clientElement)->invalidateShadowTree();
else
clientElement->buildPendingResource();
- extensions.clearHasPendingResourcesIfPossible(clientElement);
+ treeScopeResources.clearHasPendingResourcesIfPossible(clientElement);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.h ('k') | third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698