OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |