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

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

Issue 1913833002: Current work-in-progress crbug.com/567021 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More assert fixes Created 4 years, 6 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
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (!insertionPoint->inShadowIncludingDocument()) 298 if (!insertionPoint->inShadowIncludingDocument())
299 return; 299 return;
300 300
301 m_linkLoader->released(); 301 m_linkLoader->released();
302 302
303 if (m_isInShadowTree) { 303 if (m_isInShadowTree) {
304 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); 304 ASSERT(!linkStyle() || !linkStyle()->hasSheet());
305 return; 305 return;
306 } 306 }
307 document().styleEngine().removeStyleSheetCandidateNode(this); 307 document().styleEngine().removeStyleSheetCandidateNode(this);
308
309 StyleSheet* removedSheet = sheet();
310
311 if (m_link) 308 if (m_link)
312 m_link->ownerRemoved(); 309 m_link->ownerRemoved();
313
314 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet, FullStyleUp date);
315 } 310 }
316 311
317 void HTMLLinkElement::finishParsingChildren() 312 void HTMLLinkElement::finishParsingChildren()
318 { 313 {
319 m_createdByParser = false; 314 m_createdByParser = false;
320 HTMLElement::finishParsingChildren(); 315 HTMLElement::finishParsingChildren();
321 } 316 }
322 317
323 bool HTMLLinkElement::styleSheetIsLoading() const 318 bool HTMLLinkElement::styleSheetIsLoading() const
324 { 319 {
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 749 }
755 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ; 750 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ;
756 751
757 if (m_loading && !resource()) { 752 if (m_loading && !resource()) {
758 // The request may have been denied if (for example) the stylesheet is local and the document is remote, or if there was a Content Security Policy F ailure. 753 // The request may have been denied if (for example) the stylesheet is local and the document is remote, or if there was a Content Security Policy F ailure.
759 // setCSSStyleSheet() can be called synchronuosly in setResource() a nd thus resource() is null and |m_loading| is false in such cases even if the re quest succeeds. 754 // setCSSStyleSheet() can be called synchronuosly in setResource() a nd thus resource() is null and |m_loading| is false in such cases even if the re quest succeeds.
760 m_loading = false; 755 m_loading = false;
761 removePendingSheet(); 756 removePendingSheet();
762 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi ngSubresource); 757 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi ngSubresource);
763 } 758 }
759 String title = m_owner->title();
760 if (!title.isEmpty() && !m_owner->isAlternate() && m_disabledState != En abledViaScript)
761 document().styleEngine().setPreferredStylesheetSetNameIfNotSet(title );
764 } else if (m_sheet) { 762 } else if (m_sheet) {
765 // we no longer contain a stylesheet, e.g. perhaps rel or type was chang ed 763 // we no longer contain a stylesheet, e.g. perhaps rel or type was chang ed
766 StyleSheet* removedSheet = m_sheet.get();
767 clearSheet(); 764 clearSheet();
768 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet, FullSty leUpdate); 765 if (m_owner->inShadowIncludingDocument())
766 document().styleEngine().setNeedsActiveStyleUpdate(m_owner->treeScop e());
769 } 767 }
770 } 768 }
771 769
772 void LinkStyle::setSheetTitle(const String& title) 770 void LinkStyle::setSheetTitle(const String& title)
773 { 771 {
774 if (m_sheet) 772 if (m_sheet)
775 m_sheet->setTitle(title); 773 m_sheet->setTitle(title);
776 } 774 }
777 775
778 void LinkStyle::ownerRemoved() 776 void LinkStyle::ownerRemoved()
779 { 777 {
780 if (m_sheet) 778 if (m_sheet)
781 clearSheet(); 779 clearSheet();
782 780
783 if (styleSheetIsLoading()) 781 if (styleSheetIsLoading())
784 removePendingSheet(); 782 removePendingSheet();
785 } 783 }
786 784
787 DEFINE_TRACE(LinkStyle) 785 DEFINE_TRACE(LinkStyle)
788 { 786 {
789 visitor->trace(m_sheet); 787 visitor->trace(m_sheet);
790 LinkResource::trace(visitor); 788 LinkResource::trace(visitor);
791 ResourceOwner<StyleSheetResource>::trace(visitor); 789 ResourceOwner<StyleSheetResource>::trace(visitor);
792 } 790 }
793 791
794 } // namespace blink 792 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/html/HTMLStyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698