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

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

Issue 2744613002: Use IdTargetObserver in SVGUseElement (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/SVGURIReference.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGURIReference.cpp b/third_party/WebKit/Source/core/svg/SVGURIReference.cpp
index 86b61bdf9a6a228bff4d6ac487db5bd735e923f5..3606053b47217abd58d79ab7933ae173741197a5 100644
--- a/third_party/WebKit/Source/core/svg/SVGURIReference.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGURIReference.cpp
@@ -21,6 +21,7 @@
#include "core/svg/SVGURIReference.h"
#include "core/XLinkNames.h"
+#include "core/dom/Document.h"
#include "core/dom/IdTargetObserver.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/svg/SVGElement.h"
@@ -117,15 +118,21 @@ Element* SVGURIReference::targetElementFromIRIString(
Element* SVGURIReference::observeTarget(Member<IdTargetObserver>& observer,
SVGElement& contextElement) {
- DCHECK(!observer);
TreeScope& treeScope = contextElement.treeScope();
AtomicString id = fragmentIdentifierFromIRIString(hrefString(), treeScope);
+ return observeTarget(observer, treeScope, id,
+ WTF::bind(&SVGElement::buildPendingResource,
+ wrapWeakPersistent(&contextElement)));
+}
+
+Element* SVGURIReference::observeTarget(Member<IdTargetObserver>& observer,
+ TreeScope& treeScope,
+ const AtomicString& id,
+ std::unique_ptr<WTF::Closure> closure) {
+ DCHECK(!observer);
if (id.isEmpty())
return nullptr;
- observer = new SVGElementReferenceObserver(
- treeScope, id,
- WTF::bind(&SVGElement::buildPendingResource,
- wrapWeakPersistent(&contextElement)));
+ observer = new SVGElementReferenceObserver(treeScope, id, std::move(closure));
return treeScope.getElementById(id);
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGURIReference.h ('k') | third_party/WebKit/Source/core/svg/SVGUseElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698