OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. |
6 * (C) 2007 Rob Buis (buis@kde.org) | 6 * (C) 2007 Rob Buis (buis@kde.org) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } else if (name == mediaAttr && inDocument() && document().isActive() && m_s
heet) { | 70 } else if (name == mediaAttr && inDocument() && document().isActive() && m_s
heet) { |
71 m_sheet->setMediaQueries(MediaQuerySet::create(value)); | 71 m_sheet->setMediaQueries(MediaQuerySet::create(value)); |
72 document().modifiedStyleSheet(m_sheet.get()); | 72 document().modifiedStyleSheet(m_sheet.get()); |
73 } else { | 73 } else { |
74 HTMLElement::parseAttribute(name, value); | 74 HTMLElement::parseAttribute(name, value); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 void HTMLStyleElement::finishParsingChildren() | 78 void HTMLStyleElement::finishParsingChildren() |
79 { | 79 { |
80 StyleElement::finishParsingChildren(this); | 80 StyleElement::ProcessingResult result = StyleElement::finishParsingChildren(
this); |
81 HTMLElement::finishParsingChildren(); | 81 HTMLElement::finishParsingChildren(); |
| 82 if (result == StyleElement::ProcessingFatalError) |
| 83 notifyLoadedSheetAndAllCriticalSubresources(ErrorOccurredLoadingSubresou
rce); |
82 } | 84 } |
83 | 85 |
84 Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(ContainerNode*
insertionPoint) | 86 Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(ContainerNode*
insertionPoint) |
85 { | 87 { |
86 HTMLElement::insertedInto(insertionPoint); | 88 HTMLElement::insertedInto(insertionPoint); |
87 StyleElement::insertedInto(this, insertionPoint); | 89 StyleElement::insertedInto(this, insertionPoint); |
88 return InsertionShouldCallDidNotifySubtreeInsertions; | 90 return InsertionShouldCallDidNotifySubtreeInsertions; |
89 } | 91 } |
90 | 92 |
91 void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) | 93 void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) |
92 { | 94 { |
93 HTMLElement::removedFrom(insertionPoint); | 95 HTMLElement::removedFrom(insertionPoint); |
94 StyleElement::removedFrom(this, insertionPoint); | 96 StyleElement::removedFrom(this, insertionPoint); |
95 } | 97 } |
96 | 98 |
97 void HTMLStyleElement::didNotifySubtreeInsertionsToDocument() | 99 void HTMLStyleElement::didNotifySubtreeInsertionsToDocument() |
98 { | 100 { |
99 StyleElement::processStyleSheet(document(), this); | 101 if (StyleElement::processStyleSheet(document(), this) == StyleElement::Proce
ssingFatalError) |
| 102 notifyLoadedSheetAndAllCriticalSubresources(ErrorOccurredLoadingSubresou
rce); |
100 } | 103 } |
101 | 104 |
102 void HTMLStyleElement::childrenChanged(const ChildrenChange& change) | 105 void HTMLStyleElement::childrenChanged(const ChildrenChange& change) |
103 { | 106 { |
104 HTMLElement::childrenChanged(change); | 107 HTMLElement::childrenChanged(change); |
105 StyleElement::childrenChanged(this); | 108 if (StyleElement::childrenChanged(this) == StyleElement::ProcessingFatalErro
r) |
| 109 notifyLoadedSheetAndAllCriticalSubresources(ErrorOccurredLoadingSubresou
rce); |
106 } | 110 } |
107 | 111 |
108 const AtomicString& HTMLStyleElement::media() const | 112 const AtomicString& HTMLStyleElement::media() const |
109 { | 113 { |
110 return getAttribute(mediaAttr); | 114 return getAttribute(mediaAttr); |
111 } | 115 } |
112 | 116 |
113 const AtomicString& HTMLStyleElement::type() const | 117 const AtomicString& HTMLStyleElement::type() const |
114 { | 118 { |
115 return getAttribute(typeAttr); | 119 return getAttribute(typeAttr); |
(...skipping 14 matching lines...) Expand all Loading... |
130 { | 134 { |
131 styleLoadEventSender().dispatchPendingEvents(); | 135 styleLoadEventSender().dispatchPendingEvents(); |
132 } | 136 } |
133 | 137 |
134 void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender) | 138 void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender) |
135 { | 139 { |
136 ASSERT_UNUSED(eventSender, eventSender == &styleLoadEventSender()); | 140 ASSERT_UNUSED(eventSender, eventSender == &styleLoadEventSender()); |
137 dispatchEvent(Event::create(m_loadedSheet ? EventTypeNames::load : EventType
Names::error)); | 141 dispatchEvent(Event::create(m_loadedSheet ? EventTypeNames::load : EventType
Names::error)); |
138 } | 142 } |
139 | 143 |
140 void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources(bool errorOcc
urred) | 144 void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources(LoadedSheetEr
rorStatus errorStatus) |
141 { | 145 { |
142 if (m_firedLoad) | 146 if (m_firedLoad) |
143 return; | 147 return; |
144 m_loadedSheet = !errorOccurred; | 148 m_loadedSheet = (errorStatus == NoErrorLoadingSubresource); |
145 styleLoadEventSender().dispatchEventSoon(this); | 149 styleLoadEventSender().dispatchEventSoon(this); |
146 m_firedLoad = true; | 150 m_firedLoad = true; |
147 } | 151 } |
148 | 152 |
149 bool HTMLStyleElement::disabled() const | 153 bool HTMLStyleElement::disabled() const |
150 { | 154 { |
151 if (!m_sheet) | 155 if (!m_sheet) |
152 return false; | 156 return false; |
153 | 157 |
154 return m_sheet->disabled(); | 158 return m_sheet->disabled(); |
155 } | 159 } |
156 | 160 |
157 void HTMLStyleElement::setDisabled(bool setDisabled) | 161 void HTMLStyleElement::setDisabled(bool setDisabled) |
158 { | 162 { |
159 if (CSSStyleSheet* styleSheet = sheet()) | 163 if (CSSStyleSheet* styleSheet = sheet()) |
160 styleSheet->setDisabled(setDisabled); | 164 styleSheet->setDisabled(setDisabled); |
161 } | 165 } |
162 | 166 |
163 DEFINE_TRACE(HTMLStyleElement) | 167 DEFINE_TRACE(HTMLStyleElement) |
164 { | 168 { |
165 StyleElement::trace(visitor); | 169 StyleElement::trace(visitor); |
166 HTMLElement::trace(visitor); | 170 HTMLElement::trace(visitor); |
167 } | 171 } |
168 | 172 |
169 } | 173 } |
OLD | NEW |