| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (!inDocument()) { | 169 if (!inDocument()) { |
| 170 ASSERT(!m_sheet); | 170 ASSERT(!m_sheet); |
| 171 return; | 171 return; |
| 172 } | 172 } |
| 173 | 173 |
| 174 ASSERT(m_isCSS); | 174 ASSERT(m_isCSS); |
| 175 CSSParserContext parserContext(document(), 0, baseURL, charset); | 175 CSSParserContext parserContext(document(), 0, baseURL, charset); |
| 176 | 176 |
| 177 RefPtrWillBeRawPtr<StyleSheetContents> newSheet = StyleSheetContents::create
(href, parserContext); | 177 RefPtrWillBeRawPtr<StyleSheetContents> newSheet = StyleSheetContents::create
(href, parserContext); |
| 178 | 178 |
| 179 RefPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet, this); | 179 RefPtrWillBeRawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet,
this); |
| 180 cssSheet->setDisabled(m_alternate); | 180 cssSheet->setDisabled(m_alternate); |
| 181 cssSheet->setTitle(m_title); | 181 cssSheet->setTitle(m_title); |
| 182 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); | 182 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); |
| 183 | 183 |
| 184 m_sheet = cssSheet.release(); | 184 m_sheet = cssSheet.release(); |
| 185 | 185 |
| 186 // We don't need the cross-origin security check here because we are | 186 // We don't need the cross-origin security check here because we are |
| 187 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME | 187 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME |
| 188 // type. | 188 // type. |
| 189 parseStyleSheet(sheet->sheetText(true)); | 189 parseStyleSheet(sheet->sheetText(true)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 205 | 205 |
| 206 clearResource(); | 206 clearResource(); |
| 207 m_loading = false; | 207 m_loading = false; |
| 208 | 208 |
| 209 if (m_isCSS) | 209 if (m_isCSS) |
| 210 toCSSStyleSheet(m_sheet.get())->contents()->checkLoaded(); | 210 toCSSStyleSheet(m_sheet.get())->contents()->checkLoaded(); |
| 211 else if (m_isXSL) | 211 else if (m_isXSL) |
| 212 toXSLStyleSheet(m_sheet.get())->checkLoaded(); | 212 toXSLStyleSheet(m_sheet.get())->checkLoaded(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void ProcessingInstruction::setCSSStyleSheet(PassRefPtr<CSSStyleSheet> sheet) | 215 void ProcessingInstruction::setCSSStyleSheet(PassRefPtrWillBeRawPtr<CSSStyleShee
t> sheet) |
| 216 { | 216 { |
| 217 ASSERT(!resource()); | 217 ASSERT(!resource()); |
| 218 ASSERT(!m_loading); | 218 ASSERT(!m_loading); |
| 219 m_sheet = sheet; | 219 m_sheet = sheet; |
| 220 sheet->setTitle(m_title); | 220 sheet->setTitle(m_title); |
| 221 sheet->setDisabled(m_alternate); | 221 sheet->setDisabled(m_alternate); |
| 222 } | 222 } |
| 223 | 223 |
| 224 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node* insertionPoint) | 224 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node* insertionPoint) |
| 225 { | 225 { |
| 226 CharacterData::insertedInto(insertionPoint); | 226 CharacterData::insertedInto(insertionPoint); |
| 227 if (!insertionPoint->inDocument()) | 227 if (!insertionPoint->inDocument()) |
| 228 return InsertionDone; | 228 return InsertionDone; |
| 229 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser
); | 229 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser
); |
| 230 checkStyleSheet(); | 230 checkStyleSheet(); |
| 231 return InsertionDone; | 231 return InsertionDone; |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) | 234 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) |
| 235 { | 235 { |
| 236 CharacterData::removedFrom(insertionPoint); | 236 CharacterData::removedFrom(insertionPoint); |
| 237 if (!insertionPoint->inDocument()) | 237 if (!insertionPoint->inDocument()) |
| 238 return; | 238 return; |
| 239 | 239 |
| 240 document().styleEngine()->removeStyleSheetCandidateNode(this); | 240 document().styleEngine()->removeStyleSheetCandidateNode(this); |
| 241 | 241 |
| 242 RefPtr<StyleSheet> removedSheet = m_sheet; | 242 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; |
| 243 | 243 |
| 244 if (m_sheet) { | 244 if (m_sheet) { |
| 245 ASSERT(m_sheet->ownerNode() == this); | 245 ASSERT(m_sheet->ownerNode() == this); |
| 246 m_sheet->clearOwnerNode(); | 246 m_sheet->clearOwnerNode(); |
| 247 m_sheet = nullptr; | 247 m_sheet = nullptr; |
| 248 } | 248 } |
| 249 | 249 |
| 250 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | 250 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. |
| 251 if (document().isActive()) | 251 if (document().isActive()) |
| 252 document().removedStyleSheet(removedSheet.get()); | 252 document().removedStyleSheet(removedSheet.get()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace | 255 } // namespace |
| OLD | NEW |