Index: Source/core/svg/SVGStyleElement.cpp |
diff --git a/Source/core/svg/SVGStyleElement.cpp b/Source/core/svg/SVGStyleElement.cpp |
index b4d0e79feef421c9f28cf4e95de8bf1778169d55..1b91159b015ef84573b0d6e78645ed663e8b1752 100644 |
--- a/Source/core/svg/SVGStyleElement.cpp |
+++ b/Source/core/svg/SVGStyleElement.cpp |
@@ -25,10 +25,17 @@ |
#include "core/MediaTypeNames.h" |
#include "core/css/CSSStyleSheet.h" |
+#include "core/events/Event.h" |
#include "wtf/StdLibExtras.h" |
namespace blink { |
+static SVGStyleEventSender& styleErrorEventSender() |
+{ |
+ DEFINE_STATIC_LOCAL(SVGStyleEventSender, sharedErrorEventSender, (EventTypeNames::error)); |
+ return sharedErrorEventSender; |
+} |
+ |
inline SVGStyleElement::SVGStyleElement(Document& document, bool createdByParser) |
: SVGElement(SVGNames::styleTag, document) |
, StyleElement(&document, createdByParser) |
@@ -41,6 +48,8 @@ SVGStyleElement::~SVGStyleElement() |
#if !ENABLE(OILPAN) |
StyleElement::clearDocumentData(document(), this); |
#endif |
+ |
+ styleErrorEventSender().cancelEvent(this); |
} |
PassRefPtrWillBeRawPtr<SVGStyleElement> SVGStyleElement::create(Document& document, bool createdByParser) |
@@ -109,8 +118,10 @@ void SVGStyleElement::parseAttribute(const QualifiedName& name, const AtomicStri |
void SVGStyleElement::finishParsingChildren() |
{ |
- StyleElement::finishParsingChildren(this); |
+ StyleElement::ProcessingResult result = StyleElement::finishParsingChildren(this); |
SVGElement::finishParsingChildren(); |
+ if (result == StyleElement::ProcessingFatalError) |
+ sendSVGErrorEventAsynchronously(); |
} |
Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode* insertionPoint) |
@@ -122,7 +133,8 @@ Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode* |
void SVGStyleElement::didNotifySubtreeInsertionsToDocument() |
{ |
- StyleElement::processStyleSheet(document(), this); |
+ if (StyleElement::processStyleSheet(document(), this) == StyleElement::ProcessingFatalError) |
+ sendSVGErrorEventAsynchronously(); |
} |
void SVGStyleElement::removedFrom(ContainerNode* insertionPoint) |
@@ -134,7 +146,19 @@ void SVGStyleElement::removedFrom(ContainerNode* insertionPoint) |
void SVGStyleElement::childrenChanged(const ChildrenChange& change) |
{ |
SVGElement::childrenChanged(change); |
- StyleElement::childrenChanged(this); |
+ if (StyleElement::childrenChanged(this) == StyleElement::ProcessingFatalError) |
+ sendSVGErrorEventAsynchronously(); |
+} |
+ |
+void SVGStyleElement::sendSVGErrorEventAsynchronously() |
+{ |
+ styleErrorEventSender().dispatchEventSoon(this); |
+} |
+ |
+void SVGStyleElement::dispatchPendingEvent(SVGStyleEventSender* eventSender) |
+{ |
+ ASSERT_UNUSED(eventSender, eventSender == &styleErrorEventSender()); |
+ dispatchEvent(Event::create(EventTypeNames::error)); |
} |
DEFINE_TRACE(SVGStyleElement) |