| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return new ProcessingInstruction(document, target, data); | 53 return new ProcessingInstruction(document, target, data); |
| 54 } | 54 } |
| 55 | 55 |
| 56 ProcessingInstruction::~ProcessingInstruction() | 56 ProcessingInstruction::~ProcessingInstruction() |
| 57 { | 57 { |
| 58 #if !ENABLE(OILPAN) | 58 #if !ENABLE(OILPAN) |
| 59 if (m_sheet) | 59 if (m_sheet) |
| 60 clearSheet(); | 60 clearSheet(); |
| 61 | 61 |
| 62 // FIXME: ProcessingInstruction should not be in document here. | 62 // FIXME: ProcessingInstruction should not be in document here. |
| 63 // However, if we add ASSERT(!inShadowIncludingDocument()), fast/xsl/xslt-en
tity.xml | 63 // However, if we add DCHECK(!inShadowIncludingDocument()), fast/xsl/xslt-en
tity.xml |
| 64 // crashes. We need to investigate ProcessingInstruction lifetime. | 64 // crashes. We need to investigate ProcessingInstruction lifetime. |
| 65 if (inShadowIncludingDocument() && m_isCSS) | 65 if (inShadowIncludingDocument() && m_isCSS) |
| 66 document().styleEngine().removeStyleSheetCandidateNode(this); | 66 document().styleEngine().removeStyleSheetCandidateNode(this); |
| 67 clearEventListenerForXSLT(); | 67 clearEventListenerForXSLT(); |
| 68 #endif | 68 #endif |
| 69 } | 69 } |
| 70 | 70 |
| 71 EventListener* ProcessingInstruction::eventListenerForXSLT() | 71 EventListener* ProcessingInstruction::eventListenerForXSLT() |
| 72 { | 72 { |
| 73 if (!m_listenerForXSLT) | 73 if (!m_listenerForXSLT) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (!DocumentXSLT::sheetLoaded(document(), this)) | 197 if (!DocumentXSLT::sheetLoaded(document(), this)) |
| 198 document().styleEngine().removePendingSheet(this); | 198 document().styleEngine().removePendingSheet(this); |
| 199 return true; | 199 return true; |
| 200 } | 200 } |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
eURL, const String& charset, const CSSStyleSheetResource* sheet) | 204 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
eURL, const String& charset, const CSSStyleSheetResource* sheet) |
| 205 { | 205 { |
| 206 if (!inShadowIncludingDocument()) { | 206 if (!inShadowIncludingDocument()) { |
| 207 ASSERT(!m_sheet); | 207 DCHECK(!m_sheet); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 ASSERT(m_isCSS); | 211 DCHECK(m_isCSS); |
| 212 CSSParserContext parserContext(document(), 0, baseURL, charset); | 212 CSSParserContext parserContext(document(), 0, baseURL, charset); |
| 213 | 213 |
| 214 RawPtr<StyleSheetContents> newSheet = StyleSheetContents::create(href, parse
rContext); | 214 RawPtr<StyleSheetContents> newSheet = StyleSheetContents::create(href, parse
rContext); |
| 215 | 215 |
| 216 RawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet, this); | 216 RawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet, this); |
| 217 cssSheet->setDisabled(m_alternate); | 217 cssSheet->setDisabled(m_alternate); |
| 218 cssSheet->setTitle(m_title); | 218 cssSheet->setTitle(m_title); |
| 219 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); | 219 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); |
| 220 | 220 |
| 221 m_sheet = cssSheet.release(); | 221 m_sheet = cssSheet.release(); |
| 222 | 222 |
| 223 // We don't need the cross-origin security check here because we are | 223 // We don't need the cross-origin security check here because we are |
| 224 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME | 224 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME |
| 225 // type. | 225 // type. |
| 226 parseStyleSheet(sheet->sheetText()); | 226 parseStyleSheet(sheet->sheetText()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& bas
eURL, const String& sheet) | 229 void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& bas
eURL, const String& sheet) |
| 230 { | 230 { |
| 231 if (!inShadowIncludingDocument()) { | 231 if (!inShadowIncludingDocument()) { |
| 232 ASSERT(!m_sheet); | 232 DCHECK(!m_sheet); |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 | 235 |
| 236 ASSERT(m_isXSL); | 236 DCHECK(m_isXSL); |
| 237 m_sheet = XSLStyleSheet::create(this, href, baseURL); | 237 m_sheet = XSLStyleSheet::create(this, href, baseURL); |
| 238 RawPtr<Document> protect(&document()); | 238 RawPtr<Document> protect(&document()); |
| 239 OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::c
reate(document()); | 239 OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::c
reate(document()); |
| 240 parseStyleSheet(sheet); | 240 parseStyleSheet(sheet); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void ProcessingInstruction::parseStyleSheet(const String& sheet) | 243 void ProcessingInstruction::parseStyleSheet(const String& sheet) |
| 244 { | 244 { |
| 245 if (m_isCSS) | 245 if (m_isCSS) |
| 246 toCSSStyleSheet(m_sheet.get())->contents()->parseString(sheet); | 246 toCSSStyleSheet(m_sheet.get())->contents()->parseString(sheet); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 277 CharacterData::removedFrom(insertionPoint); | 277 CharacterData::removedFrom(insertionPoint); |
| 278 if (!insertionPoint->inShadowIncludingDocument()) | 278 if (!insertionPoint->inShadowIncludingDocument()) |
| 279 return; | 279 return; |
| 280 | 280 |
| 281 // No need to remove XSLStyleSheet from StyleEngine. | 281 // No need to remove XSLStyleSheet from StyleEngine. |
| 282 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) | 282 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) |
| 283 document().styleEngine().removeStyleSheetCandidateNode(this); | 283 document().styleEngine().removeStyleSheetCandidateNode(this); |
| 284 | 284 |
| 285 RawPtr<StyleSheet> removedSheet = m_sheet; | 285 RawPtr<StyleSheet> removedSheet = m_sheet; |
| 286 if (m_sheet) { | 286 if (m_sheet) { |
| 287 ASSERT(m_sheet->ownerNode() == this); | 287 DCHECK_EQ(m_sheet->ownerNode(), this); |
| 288 clearSheet(); | 288 clearSheet(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // No need to remove pending sheets. | 291 // No need to remove pending sheets. |
| 292 clearResource(); | 292 clearResource(); |
| 293 | 293 |
| 294 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | 294 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. |
| 295 if (document().isActive()) | 295 if (document().isActive()) |
| 296 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet.get(), F
ullStyleUpdate); | 296 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet.get(), F
ullStyleUpdate); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void ProcessingInstruction::clearSheet() | 299 void ProcessingInstruction::clearSheet() |
| 300 { | 300 { |
| 301 ASSERT(m_sheet); | 301 DCHECK(m_sheet); |
| 302 if (m_sheet->isLoading()) | 302 if (m_sheet->isLoading()) |
| 303 document().styleEngine().removePendingSheet(this); | 303 document().styleEngine().removePendingSheet(this); |
| 304 m_sheet.release()->clearOwnerNode(); | 304 m_sheet.release()->clearOwnerNode(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 DEFINE_TRACE(ProcessingInstruction) | 307 DEFINE_TRACE(ProcessingInstruction) |
| 308 { | 308 { |
| 309 visitor->trace(m_sheet); | 309 visitor->trace(m_sheet); |
| 310 visitor->trace(m_listenerForXSLT); | 310 visitor->trace(m_listenerForXSLT); |
| 311 CharacterData::trace(visitor); | 311 CharacterData::trace(visitor); |
| 312 ResourceOwner<StyleSheetResource>::trace(visitor); | 312 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |