| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef CSSFontFaceSrcValue_h | 26 #ifndef CSSFontFaceSrcValue_h |
| 27 #define CSSFontFaceSrcValue_h | 27 #define CSSFontFaceSrcValue_h |
| 28 | 28 |
| 29 #include "core/css/CSSValue.h" | 29 #include "core/css/CSSValue.h" |
| 30 #include "core/fetch/ResourcePtr.h" | 30 #include "core/fetch/FontResource.h" |
| 31 #include "core/fetch/ResourceOwner.h" |
| 31 #include "platform/weborigin/Referrer.h" | 32 #include "platform/weborigin/Referrer.h" |
| 32 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
| 33 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 class FontResource; | |
| 38 class Document; | 38 class Document; |
| 39 | 39 |
| 40 class CSSFontFaceSrcValue : public CSSValue { | 40 class CSSFontFaceSrcValue : public CSSValue { |
| 41 public: | 41 public: |
| 42 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> create(const String& reso
urce, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) | 42 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> create(const String& reso
urce, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) |
| 43 { | 43 { |
| 44 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, false, shoul
dCheckContentSecurityPolicy)); | 44 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, false, shoul
dCheckContentSecurityPolicy)); |
| 45 } | 45 } |
| 46 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> createLocal(const String&
resource, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) | 46 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> createLocal(const String&
resource, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) |
| 47 { | 47 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 bool isSupportedFormat() const; | 58 bool isSupportedFormat() const; |
| 59 | 59 |
| 60 String customCSSText() const; | 60 String customCSSText() const; |
| 61 | 61 |
| 62 bool hasFailedOrCanceledSubresources() const; | 62 bool hasFailedOrCanceledSubresources() const; |
| 63 | 63 |
| 64 FontResource* fetch(Document*); | 64 FontResource* fetch(Document*); |
| 65 | 65 |
| 66 bool equals(const CSSFontFaceSrcValue&) const; | 66 bool equals(const CSSFontFaceSrcValue&) const; |
| 67 | 67 |
| 68 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor)
; } | 68 DEFINE_INLINE_TRACE_AFTER_DISPATCH() |
| 69 { |
| 70 visitor->trace(m_fetched); |
| 71 CSSValue::traceAfterDispatch(visitor); |
| 72 } |
| 69 | 73 |
| 70 private: | 74 private: |
| 71 CSSFontFaceSrcValue(const String& resource, bool local, ContentSecurityPolic
yDisposition shouldCheckContentSecurityPolicy) | 75 CSSFontFaceSrcValue(const String& resource, bool local, ContentSecurityPolic
yDisposition shouldCheckContentSecurityPolicy) |
| 72 : CSSValue(FontFaceSrcClass) | 76 : CSSValue(FontFaceSrcClass) |
| 73 , m_resource(resource) | 77 , m_resource(resource) |
| 74 , m_isLocal(local) | 78 , m_isLocal(local) |
| 75 , m_shouldCheckContentSecurityPolicy(shouldCheckContentSecurityPolicy) | 79 , m_shouldCheckContentSecurityPolicy(shouldCheckContentSecurityPolicy) |
| 76 { | 80 { |
| 77 } | 81 } |
| 78 | 82 |
| 79 void restoreCachedResourceIfNeeded(Document*); | 83 void restoreCachedResourceIfNeeded(Document*); |
| 80 | 84 |
| 81 String m_resource; | 85 String m_resource; |
| 82 String m_format; | 86 String m_format; |
| 83 Referrer m_referrer; | 87 Referrer m_referrer; |
| 84 bool m_isLocal; | 88 bool m_isLocal; |
| 85 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; | 89 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; |
| 86 | 90 |
| 87 ResourcePtr<FontResource> m_fetched; | 91 |
| 92 class FontResourceHelper : public NoBaseWillBeGarbageCollectedFinalized<Font
ResourceHelper>, public ResourceOwner<FontResource> { |
| 93 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FontResourceHelper); |
| 94 public: |
| 95 static PassOwnPtrWillBeRawPtr<FontResourceHelper> create(PassRefPtrWillB
eRawPtr<FontResource> resource) |
| 96 { |
| 97 return adoptPtrWillBeNoop(new FontResourceHelper(resource)); |
| 98 } |
| 99 |
| 100 DEFINE_INLINE_VIRTUAL_TRACE() { ResourceOwner<FontResource>::trace(visit
or); } |
| 101 |
| 102 private: |
| 103 FontResourceHelper(PassRefPtrWillBeRawPtr<FontResource> resource) |
| 104 { |
| 105 setResource(resource); |
| 106 } |
| 107 |
| 108 String debugName() const override { return "CSSFontFaceSrcValue::FontRes
ourceHelper"; } |
| 109 }; |
| 110 OwnPtrWillBeMember<FontResourceHelper> m_fetched; |
| 88 }; | 111 }; |
| 89 | 112 |
| 90 DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue()); | 113 DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue()); |
| 91 | 114 |
| 92 } // namespace blink | 115 } // namespace blink |
| 93 | 116 |
| 94 #endif | 117 #endif |
| OLD | NEW |