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

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

Issue 2737653006: Add a new mechanism for watching SVGElement 'href' targets (Closed)
Patch Set: Created 3 years, 9 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/SVGTextPathElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp
index f6d4b2338c5d43cedda8fa6a26f409dd3dadd9e2..583848c821e933cfd176a4dcfe5c6ed2bb192f0f 100644
--- a/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp
@@ -20,8 +20,8 @@
#include "core/svg/SVGTextPathElement.h"
+#include "core/dom/IdTargetObserver.h"
#include "core/layout/svg/LayoutSVGTextPath.h"
-#include "core/svg/SVGTreeScopeResources.h"
namespace blink {
@@ -75,11 +75,13 @@ DEFINE_TRACE(SVGTextPathElement) {
visitor->trace(m_startOffset);
visitor->trace(m_method);
visitor->trace(m_spacing);
+ visitor->trace(m_targetIdObserver);
SVGTextContentElement::trace(visitor);
SVGURIReference::trace(visitor);
}
void SVGTextPathElement::clearResourceReferences() {
+ unobserveTarget(m_targetIdObserver);
removeAllOutgoingReferences();
}
@@ -121,24 +123,12 @@ void SVGTextPathElement::buildPendingResource() {
clearResourceReferences();
if (!isConnected())
return;
-
- AtomicString id;
- Element* target = SVGURIReference::targetElementFromIRIString(
- hrefString(), treeScope(), &id);
- if (!target) {
- // Do not register as pending if we are already pending this resource.
- if (treeScope().ensureSVGTreeScopedResources().isElementPendingResource(
- *this, id))
- return;
- if (!id.isEmpty()) {
- treeScope().ensureSVGTreeScopedResources().addPendingResource(id, *this);
- DCHECK(hasPendingResources());
- }
- } else if (isSVGPathElement(*target)) {
+ Element* target = observeTarget(m_targetIdObserver, *this);
+ if (isSVGPathElement(target)) {
// Register us with the target in the dependencies map. Any change of
// hrefElement that leads to relayout/repainting now informs us, so we can
// react to it.
- addReferenceTo(toSVGElement((target)));
+ addReferenceTo(toSVGElement(target));
}
if (LayoutObject* layoutObject = this->layoutObject())
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGTextPathElement.h ('k') | third_party/WebKit/Source/core/svg/SVGURIReference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698