Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: Source/core/html/HTMLLinkElement.cpp

Issue 18854017: StyleSheet.ownerNode should be null when it gets orphaned. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698