Chromium Code Reviews| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 // This code defaults to allowing the stylesheet for non-HTTP protocols so | 179 // This code defaults to allowing the stylesheet for non-HTTP protocols so |
| 180 // folks can use standards mode for local HTML documents. | 180 // folks can use standards mode for local HTML documents. |
| 181 if (mimeTypeCheck == MIMETypeCheck::Lax) | 181 if (mimeTypeCheck == MIMETypeCheck::Lax) |
| 182 return true; | 182 return true; |
| 183 AtomicString contentType = httpContentType(); | 183 AtomicString contentType = httpContentType(); |
| 184 return contentType.isEmpty() || equalIgnoringCase(contentType, "text/css") || | 184 return contentType.isEmpty() || equalIgnoringCase(contentType, "text/css") || |
| 185 equalIgnoringCase(contentType, "application/x-unknown-content-type"); | 185 equalIgnoringCase(contentType, "application/x-unknown-content-type"); |
| 186 } | 186 } |
| 187 | 187 |
| 188 StyleSheetContents* CSSStyleSheetResource::restoreParsedStyleSheet( | 188 StyleSheetContents* CSSStyleSheetResource::restoreParsedStyleSheet( |
| 189 const CSSParserContext& context) { | 189 const CSSParserContext* context) { |
| 190 if (!m_parsedStyleSheetCache) | 190 if (!m_parsedStyleSheetCache) |
| 191 return nullptr; | 191 return nullptr; |
| 192 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) { | 192 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) { |
| 193 setParsedStyleSheetCache(nullptr); | 193 setParsedStyleSheetCache(nullptr); |
| 194 return nullptr; | 194 return nullptr; |
| 195 } | 195 } |
| 196 | 196 |
| 197 DCHECK(m_parsedStyleSheetCache->isCacheableForResource()); | 197 DCHECK(m_parsedStyleSheetCache->isCacheableForResource()); |
| 198 DCHECK(m_parsedStyleSheetCache->isReferencedFromResource()); | 198 DCHECK(m_parsedStyleSheetCache->isReferencedFromResource()); |
| 199 | 199 |
| 200 // Contexts must be identical so we know we would get the same exact result if | 200 // Contexts must be identical so we know we would get the same exact result if |
| 201 // we parsed again. | 201 // we parsed again. |
| 202 if (m_parsedStyleSheetCache->parserContext() != context) | 202 if (*(m_parsedStyleSheetCache->parserContext()) != *context) |
|
rune
2017/01/11 12:59:26
I don't think you need parentheses here. *a->b() i
Bret
2017/01/11 23:05:15
Done.
| |
| 203 return nullptr; | 203 return nullptr; |
| 204 | 204 |
| 205 return m_parsedStyleSheetCache; | 205 return m_parsedStyleSheetCache; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet) { | 208 void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet) { |
| 209 DCHECK(sheet); | 209 DCHECK(sheet); |
| 210 DCHECK(sheet->isCacheableForResource()); | 210 DCHECK(sheet->isCacheableForResource()); |
| 211 | 211 |
| 212 if (!memoryCache()->contains(this)) { | 212 if (!memoryCache()->contains(this)) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 225 } | 225 } |
| 226 | 226 |
| 227 void CSSStyleSheetResource::updateDecodedSize() { | 227 void CSSStyleSheetResource::updateDecodedSize() { |
| 228 size_t decodedSize = m_decodedSheetText.charactersSizeInBytes(); | 228 size_t decodedSize = m_decodedSheetText.charactersSizeInBytes(); |
| 229 if (m_parsedStyleSheetCache) | 229 if (m_parsedStyleSheetCache) |
| 230 decodedSize += m_parsedStyleSheetCache->estimatedSizeInBytes(); | 230 decodedSize += m_parsedStyleSheetCache->estimatedSizeInBytes(); |
| 231 setDecodedSize(decodedSize); | 231 setDecodedSize(decodedSize); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace blink | 234 } // namespace blink |
| OLD | NEW |