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 21 matching lines...) Expand all Loading... |
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 FontResource; | 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 PassRefPtr<CSSFontFaceSrcValue> create(const String& resource, Conten
tSecurityPolicyDisposition shouldCheckContentSecurityPolicy) |
43 { | 43 { |
44 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, false, shoul
dCheckContentSecurityPolicy)); | 44 return adoptRef(new CSSFontFaceSrcValue(resource, false, shouldCheckCont
entSecurityPolicy)); |
45 } | 45 } |
46 static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> createLocal(const String&
resource, ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) | 46 static PassRefPtr<CSSFontFaceSrcValue> createLocal(const String& resource, C
ontentSecurityPolicyDisposition shouldCheckContentSecurityPolicy) |
47 { | 47 { |
48 return adoptRefWillBeNoop(new CSSFontFaceSrcValue(resource, true, should
CheckContentSecurityPolicy)); | 48 return adoptRef(new CSSFontFaceSrcValue(resource, true, shouldCheckConte
ntSecurityPolicy)); |
49 } | 49 } |
50 | 50 |
51 const String& resource() const { return m_resource; } | 51 const String& resource() const { return m_resource; } |
52 const String& format() const { return m_format; } | 52 const String& format() const { return m_format; } |
53 bool isLocal() const { return m_isLocal; } | 53 bool isLocal() const { return m_isLocal; } |
54 | 54 |
55 void setFormat(const String& format) { m_format = format; } | 55 void setFormat(const String& format) { m_format = format; } |
56 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } | 56 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } |
57 | 57 |
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)
; } | |
69 | |
70 private: | 68 private: |
71 CSSFontFaceSrcValue(const String& resource, bool local, ContentSecurityPolic
yDisposition shouldCheckContentSecurityPolicy) | 69 CSSFontFaceSrcValue(const String& resource, bool local, ContentSecurityPolic
yDisposition shouldCheckContentSecurityPolicy) |
72 : CSSValue(FontFaceSrcClass) | 70 : CSSValue(FontFaceSrcClass) |
73 , m_resource(resource) | 71 , m_resource(resource) |
74 , m_isLocal(local) | 72 , m_isLocal(local) |
75 , m_shouldCheckContentSecurityPolicy(shouldCheckContentSecurityPolicy) | 73 , m_shouldCheckContentSecurityPolicy(shouldCheckContentSecurityPolicy) |
76 { | 74 { |
77 } | 75 } |
78 | 76 |
79 void restoreCachedResourceIfNeeded(Document*); | 77 void restoreCachedResourceIfNeeded(Document*); |
80 | 78 |
81 String m_resource; | 79 String m_resource; |
82 String m_format; | 80 String m_format; |
83 Referrer m_referrer; | 81 Referrer m_referrer; |
84 bool m_isLocal; | 82 bool m_isLocal; |
85 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; | 83 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; |
86 | 84 |
87 ResourcePtr<FontResource> m_fetched; | 85 ResourcePtr<FontResource> m_fetched; |
88 }; | 86 }; |
89 | 87 |
90 DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue()); | 88 DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue()); |
91 | 89 |
92 } | 90 } |
93 | 91 |
94 #endif | 92 #endif |
OLD | NEW |