Chromium Code Reviews| Index: Source/core/svg/SVGElement.cpp |
| diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp |
| index b73a0e6d79993ba563a7a2563b580e517f21065c..fa50ba4781fa2fa16fbbcd1edb73e041023d1dc3 100644 |
| --- a/Source/core/svg/SVGElement.cpp |
| +++ b/Source/core/svg/SVGElement.cpp |
| @@ -783,13 +783,14 @@ bool SVGElement::removeEventListener(const AtomicString& eventType, PassRefPtr<E |
| return true; |
| } |
| -static bool hasLoadListener(Element* element) |
| +static bool hasEventListener(Element* element, const AtomicString& eventType) |
| { |
| - if (element->hasEventListeners(EventTypeNames::load)) |
| + ASSERT(eventType == EventTypeNames::load || eventType == EventTypeNames::error); |
| + if (element->hasEventListeners(eventType)) |
| return true; |
| for (element = element->parentOrShadowHostElement(); element; element = element->parentOrShadowHostElement()) { |
| - const EventListenerVector& entry = element->getEventListeners(EventTypeNames::load); |
| + const EventListenerVector& entry = element->getEventListeners(eventType); |
| for (size_t i = 0; i < entry.size(); ++i) { |
| if (entry[i].useCapture) |
| return true; |
| @@ -803,7 +804,7 @@ bool SVGElement::sendSVGLoadEventIfPossible() |
| { |
| if (!haveLoadedRequiredResources()) |
| return false; |
| - if ((isStructurallyExternal() || isSVGSVGElement(*this)) && hasLoadListener(this)) |
| + if ((isStructurallyExternal() || isSVGSVGElement(*this)) && hasEventListener(this, EventTypeNames::load)) |
| dispatchEvent(Event::create(EventTypeNames::load)); |
| return true; |
| } |
| @@ -846,6 +847,31 @@ Timer<SVGElement>* SVGElement::svgLoadEventTimer() |
| return 0; |
| } |
| +bool SVGElement::sendSVGErrorEventIfPossible() |
| +{ |
| + if (!haveLoadedRequiredResources()) |
|
fs
2015/03/31 09:03:38
Why would we want to gate this on this (old oddity
jww
2015/03/31 21:31:42
Hm, nope, I think not. That's a remnant of the cop
|
| + return false; |
| + if (hasEventListener(this, EventTypeNames::error)) |
| + dispatchEvent(Event::create(EventTypeNames::error)); |
| + return true; |
| +} |
| + |
| +void SVGElement::sendSVGErrorEventIfPossibleAsynchronously() |
| +{ |
| + svgErrorEventTimer()->startOneShot(0, FROM_HERE); |
| +} |
| + |
| +void SVGElement::svgErrorEventTimerFired(Timer<SVGElement>*) |
| +{ |
| + sendSVGErrorEventIfPossible(); |
| +} |
| + |
| +Timer<SVGElement>* SVGElement::svgErrorEventTimer() |
| +{ |
| + ASSERT_NOT_REACHED(); |
| + return 0; |
| +} |
| + |
| void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason) |
| { |
| Element::attributeChanged(name, newValue); |