| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 DCHECK(m_isCSS); | 200 DCHECK(m_isCSS); |
| 201 CSSParserContext parserContext(document(), 0, baseURL, charset); | 201 CSSParserContext parserContext(document(), 0, baseURL, charset); |
| 202 | 202 |
| 203 StyleSheetContents* newSheet = StyleSheetContents::create(href, parserContex
t); | 203 StyleSheetContents* newSheet = StyleSheetContents::create(href, parserContex
t); |
| 204 | 204 |
| 205 CSSStyleSheet* cssSheet = CSSStyleSheet::create(newSheet, this); | 205 CSSStyleSheet* cssSheet = CSSStyleSheet::create(newSheet, this); |
| 206 cssSheet->setDisabled(m_alternate); | 206 cssSheet->setDisabled(m_alternate); |
| 207 cssSheet->setTitle(m_title); | 207 cssSheet->setTitle(m_title); |
| 208 if (!m_alternate && !m_title.isEmpty()) |
| 209 document().styleEngine().setPreferredStylesheetSetNameIfNotSet(m_title); |
| 208 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); | 210 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); |
| 209 | 211 |
| 210 m_sheet = cssSheet; | 212 m_sheet = cssSheet; |
| 211 | 213 |
| 212 // We don't need the cross-origin security check here because we are | 214 // We don't need the cross-origin security check here because we are |
| 213 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME | 215 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME |
| 214 // type. | 216 // type. |
| 215 parseStyleSheet(sheet->sheetText()); | 217 parseStyleSheet(sheet->sheetText()); |
| 216 } | 218 } |
| 217 | 219 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) | 265 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) |
| 264 { | 266 { |
| 265 CharacterData::removedFrom(insertionPoint); | 267 CharacterData::removedFrom(insertionPoint); |
| 266 if (!insertionPoint->inShadowIncludingDocument()) | 268 if (!insertionPoint->inShadowIncludingDocument()) |
| 267 return; | 269 return; |
| 268 | 270 |
| 269 // No need to remove XSLStyleSheet from StyleEngine. | 271 // No need to remove XSLStyleSheet from StyleEngine. |
| 270 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) | 272 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) |
| 271 document().styleEngine().removeStyleSheetCandidateNode(this); | 273 document().styleEngine().removeStyleSheetCandidateNode(this); |
| 272 | 274 |
| 273 StyleSheet* removedSheet = m_sheet; | |
| 274 if (m_sheet) { | 275 if (m_sheet) { |
| 275 DCHECK_EQ(m_sheet->ownerNode(), this); | 276 DCHECK_EQ(m_sheet->ownerNode(), this); |
| 276 clearSheet(); | 277 clearSheet(); |
| 278 document().styleEngine().setNeedsActiveStyleUpdate(treeScope()); |
| 277 } | 279 } |
| 278 | 280 |
| 279 // No need to remove pending sheets. | 281 // No need to remove pending sheets. |
| 280 clearResource(); | 282 clearResource(); |
| 281 | |
| 282 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | |
| 283 if (document().isActive()) | |
| 284 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet, FullSty
leUpdate); | |
| 285 } | 283 } |
| 286 | 284 |
| 287 void ProcessingInstruction::clearSheet() | 285 void ProcessingInstruction::clearSheet() |
| 288 { | 286 { |
| 289 DCHECK(m_sheet); | 287 DCHECK(m_sheet); |
| 290 if (m_sheet->isLoading()) | 288 if (m_sheet->isLoading()) |
| 291 document().styleEngine().removePendingSheet(this, m_styleEngineContext); | 289 document().styleEngine().removePendingSheet(this, m_styleEngineContext); |
| 292 m_sheet.release()->clearOwnerNode(); | 290 m_sheet.release()->clearOwnerNode(); |
| 293 } | 291 } |
| 294 | 292 |
| 295 DEFINE_TRACE(ProcessingInstruction) | 293 DEFINE_TRACE(ProcessingInstruction) |
| 296 { | 294 { |
| 297 visitor->trace(m_sheet); | 295 visitor->trace(m_sheet); |
| 298 visitor->trace(m_listenerForXSLT); | 296 visitor->trace(m_listenerForXSLT); |
| 299 CharacterData::trace(visitor); | 297 CharacterData::trace(visitor); |
| 300 ResourceOwner<StyleSheetResource>::trace(visitor); | 298 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 301 } | 299 } |
| 302 | 300 |
| 303 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |