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