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

Unified Diff: Source/core/svg/SVGStyleElement.cpp

Issue 1049513003: Add error dispatch events to SVGStyleElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Nits Created 5 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 | « Source/core/svg/SVGStyleElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/svg/SVGStyleElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698