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

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

Issue 2742293006: Support event handling in SVG's use-element shadow trees (Closed)
Patch Set: needs rebaseline 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGUseElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
index 0c0d7c0bd3c5401c8e7e1d59916f6e39e5420b8d..2d62599715dd4a8b8b2e414497c51f6c929c8b51 100644
--- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
@@ -441,8 +441,10 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement& target) {
addReferencesToFirstDegreeNestedUseElements(target);
- if (instanceTreeIsLoading())
+ if (instanceTreeIsLoading()) {
+ cloneNonMarkupEventListeners();
return;
+ }
// Assure shadow tree building was successful.
DCHECK(m_targetElementInstance);
@@ -462,6 +464,8 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement& target) {
m_targetElementInstance = toSVGElementOrDie(shadowRoot.firstChild());
DCHECK_EQ(m_targetElementInstance->parentNode(), shadowRoot);
+ cloneNonMarkupEventListeners();
+
// Update relative length information.
updateRelativeLengthsInformation();
}
@@ -535,6 +539,17 @@ void SVGUseElement::addReferencesToFirstDegreeNestedUseElements(
addReferenceTo(useElement);
}
+void SVGUseElement::cloneNonMarkupEventListeners() {
+ for (SVGElement& element :
+ Traversal<SVGElement>::descendantsOf(useShadowRoot())) {
+ if (EventTargetData* data =
+ element.correspondingElement()->eventTargetData()) {
+ data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(
+ &element);
+ }
+ }
+}
+
bool SVGUseElement::hasCycleUseReferencing(const SVGUseElement& use,
const ContainerNode& targetInstance,
SVGElement*& newTarget) const {
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698