| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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/ResourcePtr.h" |
| 31 #include "platform/weborigin/Referrer.h" | 31 #include "platform/weborigin/Referrer.h" |
| 32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
| 33 #include "wtf/text/WTFString.h" | 33 #include "wtf/text/WTFString.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class CSSDeserializeStream; |
| 38 class CSSSerializeStream; |
| 39 class Document; |
| 37 class FontResource; | 40 class FontResource; |
| 38 class Document; | |
| 39 | 41 |
| 40 class CSSFontFaceSrcValue : public CSSValue { | 42 class CSSFontFaceSrcValue : public CSSValue { |
| 41 public: | 43 public: |
| 42 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> create(const String& reso
urce, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) | 44 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> create(const String& reso
urce, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) |
| 43 { | 45 { |
| 44 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, false, shoul
dCheckContentSecurityPolicy)); | 46 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, false, shoul
dCheckContentSecurityPolicy)); |
| 45 } | 47 } |
| 46 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> createLocal(const String&
resource, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) | 48 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> createLocal(const String&
resource, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) |
| 47 { | 49 { |
| 48 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, true, should
CheckContentSecurityPolicy)); | 50 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, true, should
CheckContentSecurityPolicy)); |
| 49 } | 51 } |
| 52 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> deserializeAfterDispatch(
CSSDeserializeStream*); |
| 50 | 53 |
| 51 const String& resource() const { return m_resource; } | 54 const String& resource() const { return m_resource; } |
| 52 const String& format() const { return m_format; } | 55 const String& format() const { return m_format; } |
| 53 bool isLocal() const { return m_isLocal; } | 56 bool isLocal() const { return m_isLocal; } |
| 54 | 57 |
| 55 void setFormat(const String& format) { m_format = format; } | 58 void setFormat(const String& format) { m_format = format; } |
| 56 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } | 59 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } |
| 57 | 60 |
| 58 bool isSupportedFormat() const; | 61 bool isSupportedFormat() const; |
| 59 | 62 |
| 60 String customCSSText() const; | 63 String customCSSText() const; |
| 61 | 64 |
| 62 bool hasFailedOrCanceledSubresources() const; | 65 bool hasFailedOrCanceledSubresources() const; |
| 63 | 66 |
| 64 FontResource* fetch(Document*); | 67 FontResource* fetch(Document*); |
| 65 | 68 |
| 66 bool equals(const CSSFontFaceSrcValue&) const; | 69 bool equals(const CSSFontFaceSrcValue&) const; |
| 67 | 70 |
| 71 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 72 |
| 68 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor)
; } | 73 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor)
; } |
| 69 | 74 |
| 70 private: | 75 private: |
| 71 CSSFontFaceSrcValue(const String& resource, bool local, ContentSecurityPolic
yDisposition shouldCheckContentSecurityPolicy) | 76 CSSFontFaceSrcValue(const String& resource, bool local, ContentSecurityPolic
yDisposition shouldCheckContentSecurityPolicy) |
| 72 : CSSValue(FontFaceSrcClass) | 77 : CSSValue(FontFaceSrcClass) |
| 73 , m_resource(resource) | 78 , m_resource(resource) |
| 74 , m_isLocal(local) | 79 , m_isLocal(local) |
| 75 , m_shouldCheckContentSecurityPolicy(shouldCheckContentSecurityPolicy) | 80 , m_shouldCheckContentSecurityPolicy(shouldCheckContentSecurityPolicy) |
| 76 { | 81 { |
| 77 } | 82 } |
| 78 | 83 |
| 79 void restoreCachedResourceIfNeeded(Document*); | 84 void restoreCachedResourceIfNeeded(Document*); |
| 80 | 85 |
| 81 String m_resource; | 86 String m_resource; |
| 82 String m_format; | 87 String m_format; |
| 83 Referrer m_referrer; | 88 Referrer m_referrer; |
| 84 bool m_isLocal; | 89 bool m_isLocal; |
| 85 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; | 90 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; |
| 86 | 91 |
| 87 ResourcePtr<FontResource> m_fetched; | 92 ResourcePtr<FontResource> m_fetched; |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue()); | 95 DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue()); |
| 91 | 96 |
| 92 } | 97 } |
| 93 | 98 |
| 94 #endif | 99 #endif |
| OLD | NEW |