| 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 10 matching lines...) Expand all Loading... |
| 21 Boston, MA 02110-1301, USA. | 21 Boston, MA 02110-1301, USA. |
| 22 | 22 |
| 23 This class provides all functionality needed for loading images, style sheet
s and html | 23 This class provides all functionality needed for loading images, style sheet
s and html |
| 24 pages from the web. It has a memory cache for these objects. | 24 pages from the web. It has a memory cache for these objects. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/fetch/CSSStyleSheetResource.h" | 28 #include "core/fetch/CSSStyleSheetResource.h" |
| 29 | 29 |
| 30 #include "core/css/StyleSheetContents.h" | 30 #include "core/css/StyleSheetContents.h" |
| 31 #include "core/fetch/FetchRequest.h" |
| 31 #include "core/fetch/ResourceClientWalker.h" | 32 #include "core/fetch/ResourceClientWalker.h" |
| 33 #include "core/fetch/ResourceFetcher.h" |
| 32 #include "core/fetch/StyleSheetResourceClient.h" | 34 #include "core/fetch/StyleSheetResourceClient.h" |
| 33 #include "platform/SharedBuffer.h" | 35 #include "platform/SharedBuffer.h" |
| 34 #include "platform/network/HTTPParsers.h" | 36 #include "platform/network/HTTPParsers.h" |
| 35 #include "wtf/CurrentTime.h" | 37 #include "wtf/CurrentTime.h" |
| 36 | 38 |
| 37 namespace blink { | 39 namespace blink { |
| 38 | 40 |
| 41 ResourcePtr<CSSStyleSheetResource> CSSStyleSheetResource::fetch(FetchRequest& re
quest, ResourceFetcher* fetcher) |
| 42 { |
| 43 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); |
| 44 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textStyle); |
| 45 return toCSSStyleSheetResource(fetcher->requestResource(request, CSSStyleShe
etResourceFactory())); |
| 46 } |
| 47 |
| 39 CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequ
est, const String& charset) | 48 CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequ
est, const String& charset) |
| 40 : StyleSheetResource(resourceRequest, CSSStyleSheet, "text/css", charset) | 49 : StyleSheetResource(resourceRequest, CSSStyleSheet, "text/css", charset) |
| 41 { | 50 { |
| 42 DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", At
omicString::ConstructFromLiteral)); | 51 DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", At
omicString::ConstructFromLiteral)); |
| 43 | 52 |
| 44 // Prefer text/css but accept any type (dell.com serves a stylesheet | 53 // Prefer text/css but accept any type (dell.com serves a stylesheet |
| 45 // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>). | 54 // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>). |
| 46 setAccept(acceptCSS); | 55 setAccept(acceptCSS); |
| 47 } | 56 } |
| 48 | 57 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 179 |
| 171 if (m_parsedStyleSheetCache) | 180 if (m_parsedStyleSheetCache) |
| 172 m_parsedStyleSheetCache->removedFromMemoryCache(); | 181 m_parsedStyleSheetCache->removedFromMemoryCache(); |
| 173 m_parsedStyleSheetCache = sheet; | 182 m_parsedStyleSheetCache = sheet; |
| 174 m_parsedStyleSheetCache->addedToMemoryCache(); | 183 m_parsedStyleSheetCache->addedToMemoryCache(); |
| 175 | 184 |
| 176 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); | 185 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); |
| 177 } | 186 } |
| 178 | 187 |
| 179 } | 188 } |
| OLD | NEW |