| 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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 | 6 |
| 7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
| 8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
| 9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
| 10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #ifndef CSSStyleSheetResource_h | 26 #ifndef CSSStyleSheetResource_h |
| 27 #define CSSStyleSheetResource_h | 27 #define CSSStyleSheetResource_h |
| 28 | 28 |
| 29 #include "core/fetch/ResourcePtr.h" | 29 #include "core/fetch/ResourcePtr.h" |
| 30 #include "core/fetch/StyleSheetResource.h" | 30 #include "core/fetch/StyleSheetResource.h" |
| 31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class CSSParserContext; | 35 class CSSParserContext; |
| 36 class FetchRequest; |
| 36 class ResourceClient; | 37 class ResourceClient; |
| 38 class ResourceFetcher; |
| 37 class StyleSheetContents; | 39 class StyleSheetContents; |
| 38 | 40 |
| 39 class CSSStyleSheetResource final : public StyleSheetResource { | 41 class CSSStyleSheetResource final : public StyleSheetResource { |
| 40 public: | 42 public: |
| 41 CSSStyleSheetResource(const ResourceRequest&, const String& charset); | 43 static ResourcePtr<CSSStyleSheetResource> fetch(FetchRequest&, ResourceFetch
er*); |
| 44 |
| 42 virtual ~CSSStyleSheetResource(); | 45 virtual ~CSSStyleSheetResource(); |
| 43 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
| 44 | 47 |
| 45 const String sheetText(bool* hasValidMIMEType = 0) const; | 48 const String sheetText(bool* hasValidMIMEType = 0) const; |
| 46 | 49 |
| 47 const AtomicString mimeType() const; | 50 const AtomicString mimeType() const; |
| 48 | 51 |
| 49 virtual void didAddClient(ResourceClient*) override; | 52 virtual void didAddClient(ResourceClient*) override; |
| 50 | 53 |
| 51 PassRefPtrWillBeRawPtr<StyleSheetContents> restoreParsedStyleSheet(const CSS
ParserContext&); | 54 PassRefPtrWillBeRawPtr<StyleSheetContents> restoreParsedStyleSheet(const CSS
ParserContext&); |
| 52 void saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>); | 55 void saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>); |
| 53 | 56 |
| 54 protected: | 57 protected: |
| 55 virtual bool isSafeToUnlock() const override; | 58 virtual bool isSafeToUnlock() const override; |
| 56 virtual void destroyDecodedDataIfPossible() override; | 59 virtual void destroyDecodedDataIfPossible() override; |
| 57 | 60 |
| 58 private: | 61 private: |
| 62 class CSSStyleSheetResourceFactory : public ResourceFactory { |
| 63 public: |
| 64 CSSStyleSheetResourceFactory() |
| 65 : ResourceFactory(Resource::CSSStyleSheet) { } |
| 66 |
| 67 Resource* create(const ResourceRequest& request, const String& charset)
const override |
| 68 { |
| 69 return new CSSStyleSheetResource(request, charset); |
| 70 } |
| 71 }; |
| 72 CSSStyleSheetResource(const ResourceRequest&, const String& charset); |
| 73 |
| 59 bool canUseSheet(bool* hasValidMIMEType) const; | 74 bool canUseSheet(bool* hasValidMIMEType) const; |
| 60 virtual void dispose() override; | 75 virtual void dispose() override; |
| 61 virtual void checkNotify() override; | 76 virtual void checkNotify() override; |
| 62 | 77 |
| 63 String m_decodedSheetText; | 78 String m_decodedSheetText; |
| 64 | 79 |
| 65 RefPtrWillBeMember<StyleSheetContents> m_parsedStyleSheetCache; | 80 RefPtrWillBeMember<StyleSheetContents> m_parsedStyleSheetCache; |
| 66 }; | 81 }; |
| 67 | 82 |
| 68 DEFINE_RESOURCE_TYPE_CASTS(CSSStyleSheet); | 83 DEFINE_RESOURCE_TYPE_CASTS(CSSStyleSheet); |
| 69 | 84 |
| 70 } | 85 } |
| 71 | 86 |
| 72 #endif | 87 #endif |
| OLD | NEW |