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

Side by Side Diff: third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp

Issue 2381193004: Use sheetText() instead of decodedText() in the CSS preload scanner (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 StyleSheetResource::trace(visitor); 80 StyleSheetResource::trace(visitor);
81 } 81 }
82 82
83 void CSSStyleSheetResource::didAddClient(ResourceClient* c) { 83 void CSSStyleSheetResource::didAddClient(ResourceClient* c) {
84 DCHECK(StyleSheetResourceClient::isExpectedType(c)); 84 DCHECK(StyleSheetResourceClient::isExpectedType(c));
85 // Resource::didAddClient() must be before setCSSStyleSheet(), because 85 // Resource::didAddClient() must be before setCSSStyleSheet(), because
86 // setCSSStyleSheet() may cause scripts to be executed, which could destroy 86 // setCSSStyleSheet() may cause scripts to be executed, which could destroy
87 // 'c' if it is an instance of HTMLLinkElement. see the comment of 87 // 'c' if it is an instance of HTMLLinkElement. see the comment of
88 // HTMLLinkElement::setCSSStyleSheet. 88 // HTMLLinkElement::setCSSStyleSheet.
89 Resource::didAddClient(c); 89 Resource::didAddClient(c);
90 if (m_didNotifyFirstData) 90
91 if (hasClient(c) && m_didNotifyFirstData)
91 static_cast<StyleSheetResourceClient*>(c)->didAppendFirstData(this); 92 static_cast<StyleSheetResourceClient*>(c)->didAppendFirstData(this);
92 93
93 // |c| might be removed in didAppendFirstData, so ensure it is still a client. 94 // |c| might be removed in didAppendFirstData, so ensure it is still a client.
94 if (hasClient(c) && !isLoading()) 95 if (hasClient(c) && !isLoading())
95 static_cast<StyleSheetResourceClient*>(c)->setCSSStyleSheet( 96 static_cast<StyleSheetResourceClient*>(c)->setCSSStyleSheet(
96 resourceRequest().url(), response().url(), encoding(), this); 97 resourceRequest().url(), response().url(), encoding(), this);
97 } 98 }
98 99
99 const String CSSStyleSheetResource::sheetText( 100 const String CSSStyleSheetResource::sheetText(
100 MIMETypeCheck mimeTypeCheck) const { 101 MIMETypeCheck mimeTypeCheck) const {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // This stylesheet resource did conflict with another resource and was not 193 // This stylesheet resource did conflict with another resource and was not
193 // added to the cache. 194 // added to the cache.
194 setParsedStyleSheetCache(nullptr); 195 setParsedStyleSheetCache(nullptr);
195 return; 196 return;
196 } 197 }
197 setParsedStyleSheetCache(sheet); 198 setParsedStyleSheetCache(sheet);
198 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 199 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
199 } 200 }
200 201
201 } // namespace blink 202 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698