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, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) | 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) |
7 * Copyright (C) 2011 Google Inc. All rights reserved. | 7 * Copyright (C) 2011 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 399 } |
400 // Completing the sheet load may cause scripts to execute. | 400 // Completing the sheet load may cause scripts to execute. |
401 RefPtr<Node> protector(m_owner); | 401 RefPtr<Node> protector(m_owner); |
402 | 402 |
403 CSSParserContext parserContext(m_owner->document(), baseURL, charset); | 403 CSSParserContext parserContext(m_owner->document(), baseURL, charset); |
404 | 404 |
405 if (RefPtr<StyleSheetContents> restoredSheet = const_cast<CachedCSSStyleShee
t*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext)) { | 405 if (RefPtr<StyleSheetContents> restoredSheet = const_cast<CachedCSSStyleShee
t*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext)) { |
406 ASSERT(restoredSheet->isCacheable()); | 406 ASSERT(restoredSheet->isCacheable()); |
407 ASSERT(!restoredSheet->isLoading()); | 407 ASSERT(!restoredSheet->isLoading()); |
408 | 408 |
| 409 if (m_sheet) |
| 410 clearSheet(); |
409 m_sheet = CSSStyleSheet::create(restoredSheet, m_owner); | 411 m_sheet = CSSStyleSheet::create(restoredSheet, m_owner); |
410 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); | 412 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
411 m_sheet->setTitle(m_owner->title()); | 413 m_sheet->setTitle(m_owner->title()); |
412 | 414 |
413 m_loading = false; | 415 m_loading = false; |
414 sheetLoaded(); | 416 sheetLoaded(); |
415 notifyLoadedSheetAndAllCriticalSubresources(false); | 417 notifyLoadedSheetAndAllCriticalSubresources(false); |
416 return; | 418 return; |
417 } | 419 } |
418 | 420 |
419 RefPtr<StyleSheetContents> styleSheet = StyleSheetContents::create(href, par
serContext); | 421 RefPtr<StyleSheetContents> styleSheet = StyleSheetContents::create(href, par
serContext); |
420 | 422 |
| 423 if (m_sheet) |
| 424 clearSheet(); |
421 m_sheet = CSSStyleSheet::create(styleSheet, m_owner); | 425 m_sheet = CSSStyleSheet::create(styleSheet, m_owner); |
422 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); | 426 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
423 m_sheet->setTitle(m_owner->title()); | 427 m_sheet->setTitle(m_owner->title()); |
424 | 428 |
425 styleSheet->parseAuthorStyleSheet(cachedStyleSheet, m_owner->document()->sec
urityOrigin()); | 429 styleSheet->parseAuthorStyleSheet(cachedStyleSheet, m_owner->document()->sec
urityOrigin()); |
426 | 430 |
427 m_loading = false; | 431 m_loading = false; |
428 styleSheet->notifyLoadedSheet(cachedStyleSheet); | 432 styleSheet->notifyLoadedSheet(cachedStyleSheet); |
429 styleSheet->checkLoaded(); | 433 styleSheet->checkLoaded(); |
430 | 434 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 void LinkStyle::ownerRemoved() | 617 void LinkStyle::ownerRemoved() |
614 { | 618 { |
615 if (m_sheet) | 619 if (m_sheet) |
616 clearSheet(); | 620 clearSheet(); |
617 | 621 |
618 if (styleSheetIsLoading()) | 622 if (styleSheetIsLoading()) |
619 removePendingSheet(RemovePendingSheetNotifyLater); | 623 removePendingSheet(RemovePendingSheetNotifyLater); |
620 } | 624 } |
621 | 625 |
622 } // namespace WebCore | 626 } // namespace WebCore |
OLD | NEW |