OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2006 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 5 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/svg/SVGStyleElement.h" | 24 #include "core/svg/SVGStyleElement.h" |
25 | 25 |
26 #include "core/MediaTypeNames.h" | 26 #include "core/MediaTypeNames.h" |
27 #include "core/css/CSSStyleSheet.h" | 27 #include "core/css/CSSStyleSheet.h" |
| 28 #include "core/events/Event.h" |
| 29 #include "core/events/EventSender.h" |
| 30 #include "platform/Timer.h" |
28 #include "wtf/StdLibExtras.h" | 31 #include "wtf/StdLibExtras.h" |
29 | 32 |
30 namespace blink { | 33 namespace blink { |
31 | 34 |
| 35 static SVGStyleEventSender& styleErrorEventSender() |
| 36 { |
| 37 DEFINE_STATIC_LOCAL(SVGStyleEventSender, sharedErrorEventSender, (EventTypeN
ames::error)); |
| 38 return sharedErrorEventSender; |
| 39 } |
| 40 |
32 inline SVGStyleElement::SVGStyleElement(Document& document, bool createdByParser
) | 41 inline SVGStyleElement::SVGStyleElement(Document& document, bool createdByParser
) |
33 : SVGElement(SVGNames::styleTag, document) | 42 : SVGElement(SVGNames::styleTag, document) |
34 , StyleElement(&document, createdByParser) | 43 , StyleElement(&document, createdByParser) |
35 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) | 44 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) |
36 { | 45 { |
37 } | 46 } |
38 | 47 |
39 SVGStyleElement::~SVGStyleElement() | 48 SVGStyleElement::~SVGStyleElement() |
40 { | 49 { |
41 #if !ENABLE(OILPAN) | 50 #if !ENABLE(OILPAN) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 m_sheet->setTitle(value); | 111 m_sheet->setTitle(value); |
103 | 112 |
104 return; | 113 return; |
105 } | 114 } |
106 | 115 |
107 SVGElement::parseAttribute(name, value); | 116 SVGElement::parseAttribute(name, value); |
108 } | 117 } |
109 | 118 |
110 void SVGStyleElement::finishParsingChildren() | 119 void SVGStyleElement::finishParsingChildren() |
111 { | 120 { |
112 StyleElement::finishParsingChildren(this); | 121 StyleElement::ProcessingResult result = StyleElement::finishParsingChildren(
this); |
113 SVGElement::finishParsingChildren(); | 122 SVGElement::finishParsingChildren(); |
| 123 if (result == StyleElement::ProcessingFatalError) |
| 124 sendSVGErrorEventAsynchronously(); |
114 } | 125 } |
115 | 126 |
116 Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode*
insertionPoint) | 127 Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode*
insertionPoint) |
117 { | 128 { |
118 SVGElement::insertedInto(insertionPoint); | 129 SVGElement::insertedInto(insertionPoint); |
119 StyleElement::insertedInto(this, insertionPoint); | 130 StyleElement::insertedInto(this, insertionPoint); |
120 return InsertionShouldCallDidNotifySubtreeInsertions; | 131 return InsertionShouldCallDidNotifySubtreeInsertions; |
121 } | 132 } |
122 | 133 |
123 void SVGStyleElement::didNotifySubtreeInsertionsToDocument() | 134 void SVGStyleElement::didNotifySubtreeInsertionsToDocument() |
124 { | 135 { |
125 StyleElement::processStyleSheet(document(), this); | 136 if (StyleElement::processStyleSheet(document(), this) == StyleElement::Proce
ssingFatalError) |
| 137 sendSVGErrorEventAsynchronously(); |
126 } | 138 } |
127 | 139 |
128 void SVGStyleElement::removedFrom(ContainerNode* insertionPoint) | 140 void SVGStyleElement::removedFrom(ContainerNode* insertionPoint) |
129 { | 141 { |
130 SVGElement::removedFrom(insertionPoint); | 142 SVGElement::removedFrom(insertionPoint); |
131 StyleElement::removedFrom(this, insertionPoint); | 143 StyleElement::removedFrom(this, insertionPoint); |
132 } | 144 } |
133 | 145 |
134 void SVGStyleElement::childrenChanged(const ChildrenChange& change) | 146 void SVGStyleElement::childrenChanged(const ChildrenChange& change) |
135 { | 147 { |
136 SVGElement::childrenChanged(change); | 148 SVGElement::childrenChanged(change); |
137 StyleElement::childrenChanged(this); | 149 if (StyleElement::childrenChanged(this) == StyleElement::ProcessingFatalErro
r) |
| 150 sendSVGErrorEventAsynchronously(); |
| 151 } |
| 152 |
| 153 void SVGStyleElement::sendSVGErrorEventAsynchronously() |
| 154 { |
| 155 styleErrorEventSender().dispatchEventSoon(this); |
| 156 } |
| 157 |
| 158 void SVGStyleElement::dispatchPendingEvent(SVGStyleEventSender* eventSender) |
| 159 { |
| 160 ASSERT_UNUSED(eventSender, eventSender == &styleErrorEventSender()); |
| 161 dispatchEvent(Event::create(EventTypeNames::error)); |
138 } | 162 } |
139 | 163 |
140 DEFINE_TRACE(SVGStyleElement) | 164 DEFINE_TRACE(SVGStyleElement) |
141 { | 165 { |
142 StyleElement::trace(visitor); | 166 StyleElement::trace(visitor); |
143 SVGElement::trace(visitor); | 167 SVGElement::trace(visitor); |
144 } | 168 } |
145 | 169 |
146 } | 170 } |
OLD | NEW |