| 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 a729dbd6fa17cf14f72deb7affcff23adccee23f..f449147d68e725b0572e83348094a954857bb73f 100644
|
| --- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
|
| +++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
|
| @@ -377,8 +377,6 @@ static PassRefPtrWillBeRawPtr<Node> cloneNodeAndAssociate(Node& toClone)
|
| SVGElement& svgElement = toSVGElement(toClone);
|
| ASSERT(!svgElement.correspondingElement());
|
| toSVGElement(clone.get())->setCorrespondingElement(&svgElement);
|
| - if (EventTargetData* data = toClone.eventTargetData())
|
| - data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(clone.get());
|
| TrackExceptionState exceptionState;
|
| for (RefPtrWillBeRawPtr<Node> node = toClone.firstChild(); node && !exceptionState.hadException(); node = node->nextSibling())
|
| clone->appendChild(cloneNodeAndAssociate(*node), exceptionState);
|
| @@ -413,8 +411,10 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
|
| // Non-appearing <use> content is easier to debug, then half-appearing content.
|
| buildShadowTree(target, m_targetElementInstance.get(), false);
|
|
|
| - if (instanceTreeIsLoading(m_targetElementInstance.get()))
|
| + if (instanceTreeIsLoading(m_targetElementInstance.get())) {
|
| + cloneNonMarkupEventListeners();
|
| return;
|
| + }
|
|
|
| // Assure shadow tree building was successful.
|
| ASSERT(m_targetElementInstance);
|
| @@ -434,6 +434,7 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
|
|
|
| m_targetElementInstance = toSVGElement(shadowTreeRootElement->firstChild());
|
| transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get(), *m_targetElementInstance->correspondingElement());
|
| + cloneNonMarkupEventListeners();
|
|
|
| ASSERT(m_targetElementInstance->parentNode() == shadowTreeRootElement);
|
|
|
| @@ -517,8 +518,6 @@ void SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan
|
| }
|
|
|
| targetInstance->setCorrespondingElement(target);
|
| - if (EventTargetData* data = target->eventTargetData())
|
| - data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(targetInstance);
|
|
|
| for (RefPtrWillBeRawPtr<Node> child = target->firstChild(); child; child = child->nextSibling()) {
|
| // Skip any disallowed element.
|
| @@ -534,6 +533,14 @@ void SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan
|
| }
|
| }
|
|
|
| +void SVGUseElement::cloneNonMarkupEventListeners()
|
| +{
|
| + for (SVGElement& element : Traversal<SVGElement>::descendantsOf(*userAgentShadowRoot())) {
|
| + if (EventTargetData* data = element.correspondingElement()->eventTargetData())
|
| + data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(&element);
|
| + }
|
| +}
|
| +
|
| bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, ContainerNode* targetInstance, SVGElement*& newTarget)
|
| {
|
| ASSERT(referencedScope());
|
|
|