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

Unified Diff: third_party/WebKit/Source/core/svg/SVGMPathElement.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/SVGMPathElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp
index 5ce2f931b40015922af34a03daee3f72499928b6..7de98e4f75fcf902f17a1deb484dc67c61a1c2f8 100644
--- a/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp
@@ -19,10 +19,11 @@
#include "core/svg/SVGMPathElement.h"
+#include "core/SVGNames.h"
#include "core/dom/Document.h"
+#include "core/dom/IdTargetObserver.h"
#include "core/svg/SVGAnimateMotionElement.h"
#include "core/svg/SVGPathElement.h"
-#include "core/svg/SVGTreeScopeResources.h"
namespace blink {
@@ -32,6 +33,7 @@ inline SVGMPathElement::SVGMPathElement(Document& document)
}
DEFINE_TRACE(SVGMPathElement) {
+ visitor->trace(m_targetIdObserver);
SVGElement::trace(visitor);
SVGURIReference::trace(visitor);
}
@@ -44,30 +46,18 @@ void SVGMPathElement::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));
}
-
targetPathChanged();
}
void SVGMPathElement::clearResourceReferences() {
+ unobserveTarget(m_targetIdObserver);
removeAllOutgoingReferences();
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGMPathElement.h ('k') | third_party/WebKit/Source/core/svg/SVGTextPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698