Chromium Code Reviews| 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. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 static SVGStyleEventSender& styleErrorEventSender() | 33 static SVGStyleEventSender& styleErrorEventSender() |
| 34 { | 34 { |
| 35 DEFINE_STATIC_LOCAL(SVGStyleEventSender, sharedErrorEventSender, (EventTypeN ames::error)); | 35 DEFINE_STATIC_LOCAL(SVGStyleEventSender, sharedErrorEventSender, (EventTypeN ames::error)); |
| 36 return sharedErrorEventSender; | 36 return sharedErrorEventSender; |
| 37 } | 37 } |
| 38 | 38 |
| 39 inline SVGStyleElement::SVGStyleElement(Document& document, bool createdByParser ) | 39 inline SVGStyleElement::SVGStyleElement(Document& document, bool createdByParser ) |
| 40 : SVGElement(SVGNames::styleTag, document) | 40 : SVGElement(SVGNames::styleTag, document) |
| 41 , StyleElement(&document, createdByParser) | 41 , StyleElement(&document, createdByParser) |
| 42 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) | |
| 43 { | 42 { |
| 44 } | 43 } |
| 45 | 44 |
| 46 SVGStyleElement::~SVGStyleElement() | 45 SVGStyleElement::~SVGStyleElement() |
| 47 { | 46 { |
| 48 #if !ENABLE(OILPAN) | 47 #if !ENABLE(OILPAN) |
| 49 StyleElement::clearDocumentData(document(), this); | 48 StyleElement::clearDocumentData(document(), this); |
| 50 #endif | 49 #endif |
| 51 | 50 |
| 52 styleErrorEventSender().cancelEvent(this); | 51 styleErrorEventSender().cancelEvent(this); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 } | 113 } |
| 115 | 114 |
| 116 SVGElement::parseAttribute(name, value); | 115 SVGElement::parseAttribute(name, value); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void SVGStyleElement::finishParsingChildren() | 118 void SVGStyleElement::finishParsingChildren() |
| 120 { | 119 { |
| 121 StyleElement::ProcessingResult result = StyleElement::finishParsingChildren( this); | 120 StyleElement::ProcessingResult result = StyleElement::finishParsingChildren( this); |
| 122 SVGElement::finishParsingChildren(); | 121 SVGElement::finishParsingChildren(); |
| 123 if (result == StyleElement::ProcessingFatalError) | 122 if (result == StyleElement::ProcessingFatalError) |
| 124 sendSVGErrorEventAsynchronously(); | 123 notifyLoadedSheetAndAllCriticalSubresources(ErrorOccurredLoadingSubresou rce); |
| 125 } | 124 } |
| 126 | 125 |
| 127 Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode* insertionPoint) | 126 Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode* insertionPoint) |
| 128 { | 127 { |
| 129 SVGElement::insertedInto(insertionPoint); | 128 SVGElement::insertedInto(insertionPoint); |
| 130 StyleElement::insertedInto(this, insertionPoint); | 129 StyleElement::insertedInto(this, insertionPoint); |
| 131 return InsertionShouldCallDidNotifySubtreeInsertions; | 130 return InsertionShouldCallDidNotifySubtreeInsertions; |
| 132 } | 131 } |
| 133 | 132 |
| 134 void SVGStyleElement::didNotifySubtreeInsertionsToDocument() | 133 void SVGStyleElement::didNotifySubtreeInsertionsToDocument() |
| 135 { | 134 { |
| 136 if (StyleElement::processStyleSheet(document(), this) == StyleElement::Proce ssingFatalError) | 135 if (StyleElement::processStyleSheet(document(), this) == StyleElement::Proce ssingFatalError) |
| 137 sendSVGErrorEventAsynchronously(); | 136 notifyLoadedSheetAndAllCriticalSubresources(ErrorOccurredLoadingSubresou rce); |
| 138 } | 137 } |
| 139 | 138 |
| 140 void SVGStyleElement::removedFrom(ContainerNode* insertionPoint) | 139 void SVGStyleElement::removedFrom(ContainerNode* insertionPoint) |
| 141 { | 140 { |
| 142 SVGElement::removedFrom(insertionPoint); | 141 SVGElement::removedFrom(insertionPoint); |
| 143 StyleElement::removedFrom(this, insertionPoint); | 142 StyleElement::removedFrom(this, insertionPoint); |
| 144 } | 143 } |
| 145 | 144 |
| 146 void SVGStyleElement::childrenChanged(const ChildrenChange& change) | 145 void SVGStyleElement::childrenChanged(const ChildrenChange& change) |
| 147 { | 146 { |
| 148 SVGElement::childrenChanged(change); | 147 SVGElement::childrenChanged(change); |
| 149 if (StyleElement::childrenChanged(this) == StyleElement::ProcessingFatalErro r) | 148 if (StyleElement::childrenChanged(this) == StyleElement::ProcessingFatalErro r) |
| 150 sendSVGErrorEventAsynchronously(); | 149 notifyLoadedSheetAndAllCriticalSubresources(ErrorOccurredLoadingSubresou rce); |
| 151 } | 150 } |
| 152 | 151 |
| 153 void SVGStyleElement::sendSVGErrorEventAsynchronously() | 152 void SVGStyleElement::notifyLoadedSheetAndAllCriticalSubresources(LoadedSheetErr orStatus errorStatus) |
| 154 { | 153 { |
| 155 styleErrorEventSender().dispatchEventSoon(this); | 154 if (errorStatus != NoErrorLoadingSubresource) |
|
fs
2015/05/20 14:43:34
HTMLStyleElement actually dispatches 'load' events
| |
| 155 styleErrorEventSender().dispatchEventSoon(this); | |
| 156 } | 156 } |
| 157 | 157 |
| 158 void SVGStyleElement::dispatchPendingEvent(SVGStyleEventSender* eventSender) | 158 void SVGStyleElement::dispatchPendingEvent(SVGStyleEventSender* eventSender) |
| 159 { | 159 { |
| 160 ASSERT_UNUSED(eventSender, eventSender == &styleErrorEventSender()); | 160 ASSERT_UNUSED(eventSender, eventSender == &styleErrorEventSender()); |
| 161 dispatchEvent(Event::create(EventTypeNames::error)); | 161 dispatchEvent(Event::create(EventTypeNames::error)); |
| 162 } | 162 } |
| 163 | 163 |
| 164 DEFINE_TRACE(SVGStyleElement) | 164 DEFINE_TRACE(SVGStyleElement) |
| 165 { | 165 { |
| 166 StyleElement::trace(visitor); | 166 StyleElement::trace(visitor); |
| 167 SVGElement::trace(visitor); | 167 SVGElement::trace(visitor); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } | 170 } |
| OLD | NEW |