OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef FontFace_h | 31 #ifndef FontFace_h |
32 #define FontFace_h | 32 #define FontFace_h |
33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
34 #include "bindings/core/v8/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
35 #include "bindings/core/v8/ScriptPromiseProperty.h" | 36 #include "bindings/core/v8/ScriptPromiseProperty.h" |
36 #include "bindings/core/v8/ScriptWrappable.h" | 37 #include "bindings/core/v8/ScriptWrappable.h" |
37 #include "core/CSSPropertyNames.h" | 38 #include "core/CSSPropertyNames.h" |
38 #include "core/css/CSSValue.h" | 39 #include "core/css/CSSValue.h" |
39 #include "core/dom/ActiveDOMObject.h" | 40 #include "core/dom/ActiveDOMObject.h" |
40 #include "core/dom/DOMException.h" | 41 #include "core/dom/DOMException.h" |
41 #include "platform/fonts/FontTraits.h" | 42 #include "platform/fonts/FontTraits.h" |
42 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
43 #include "wtf/RefCounted.h" | 44 #include "wtf/RefCounted.h" |
44 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 | 48 |
48 class CSSFontFace; | 49 class CSSFontFace; |
49 class CSSValue; | 50 class CSSValue; |
50 class DOMArrayBuffer; | 51 class DOMArrayBuffer; |
51 class DOMArrayBufferView; | 52 class DOMArrayBufferView; |
52 class Document; | 53 class Document; |
53 class ExceptionState; | 54 class ExceptionState; |
54 class FontFaceDescriptors; | 55 class FontFaceDescriptors; |
55 class StringOrArrayBufferOrArrayBufferView; | 56 class StringOrArrayBufferOrArrayBufferView; |
56 class StylePropertySet; | 57 class StylePropertySet; |
57 class StyleRuleFontFace; | 58 class StyleRuleFontFace; |
58 | 59 |
59 class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub
lic ScriptWrappable, public ActiveDOMObject { | 60 class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub
lic ScriptWrappable, public ActiveScriptWrappable, public ActiveDOMObject { |
60 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FontFace); | 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FontFace); |
62 public: | 63 public: |
63 enum LoadStatusType { Unloaded, Loading, Loaded, Error }; | 64 enum LoadStatusType { Unloaded, Loading, Loaded, Error }; |
64 | 65 |
65 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, StringOrArrayBufferOrArrayBufferView&, const FontFaceDescripto
rs&); | 66 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, StringOrArrayBufferOrArrayBufferView&, const FontFaceDescripto
rs&); |
66 static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFon
tFace*); | 67 static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFon
tFace*); |
67 | 68 |
68 ~FontFace(); | 69 ~FontFace(); |
69 | 70 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 103 |
103 class LoadFontCallback : public RefCountedWillBeGarbageCollectedFinalized<Lo
adFontCallback> { | 104 class LoadFontCallback : public RefCountedWillBeGarbageCollectedFinalized<Lo
adFontCallback> { |
104 public: | 105 public: |
105 virtual ~LoadFontCallback() { } | 106 virtual ~LoadFontCallback() { } |
106 virtual void notifyLoaded(FontFace*) = 0; | 107 virtual void notifyLoaded(FontFace*) = 0; |
107 virtual void notifyError(FontFace*) = 0; | 108 virtual void notifyError(FontFace*) = 0; |
108 DEFINE_INLINE_VIRTUAL_TRACE() { } | 109 DEFINE_INLINE_VIRTUAL_TRACE() { } |
109 }; | 110 }; |
110 void loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback>, ExecutionCon
text*); | 111 void loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback>, ExecutionCon
text*); |
111 | 112 |
112 // ActiveDOMObject | 113 // ActiveScriptWrappable. |
113 bool hasPendingActivity() const override; | 114 bool hasPendingActivity() const final; |
114 | 115 |
115 private: | 116 private: |
116 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&)
; | 117 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&)
; |
117 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); | 118 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); |
118 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, const String& source, const FontFaceDescriptors&); | 119 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, const String& source, const FontFaceDescriptors&); |
119 | 120 |
120 explicit FontFace(ExecutionContext*); | 121 explicit FontFace(ExecutionContext*); |
121 FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescri
ptors&); | 122 FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescri
ptors&); |
122 | 123 |
123 void initCSSFontFace(Document*, PassRefPtrWillBeRawPtr<CSSValue> src); | 124 void initCSSFontFace(Document*, PassRefPtrWillBeRawPtr<CSSValue> src); |
(...skipping 22 matching lines...) Expand all Loading... |
146 PersistentWillBeMember<LoadedProperty> m_loadedProperty; | 147 PersistentWillBeMember<LoadedProperty> m_loadedProperty; |
147 OwnPtrWillBeMember<CSSFontFace> m_cssFontFace; | 148 OwnPtrWillBeMember<CSSFontFace> m_cssFontFace; |
148 WillBeHeapVector<RefPtrWillBeMember<LoadFontCallback>> m_callbacks; | 149 WillBeHeapVector<RefPtrWillBeMember<LoadFontCallback>> m_callbacks; |
149 }; | 150 }; |
150 | 151 |
151 using FontFaceArray = WillBeHeapVector<RefPtrWillBeMember<FontFace>>; | 152 using FontFaceArray = WillBeHeapVector<RefPtrWillBeMember<FontFace>>; |
152 | 153 |
153 } // namespace blink | 154 } // namespace blink |
154 | 155 |
155 #endif // FontFace_h | 156 #endif // FontFace_h |
OLD | NEW |