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 met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
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 10 matching lines...) Expand all Loading... |
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
23 * DAMAGE. | 23 * DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef FontFaceSet_h | 26 #ifndef FontFaceSet_h |
27 #define FontFaceSet_h | 27 #define FontFaceSet_h |
28 | 28 |
29 #include "bindings/v8/ScriptPromise.h" | 29 #include "bindings/v8/ScriptPromise.h" |
30 #include "core/css/FontFace.h" | 30 #include "core/css/FontFace.h" |
| 31 #include "core/css/FontFaceSetForEachCallback.h" |
31 #include "core/dom/ActiveDOMObject.h" | 32 #include "core/dom/ActiveDOMObject.h" |
32 #include "core/events/EventListener.h" | 33 #include "core/events/EventListener.h" |
33 #include "core/events/EventTarget.h" | 34 #include "core/events/EventTarget.h" |
34 #include "core/events/ThreadLocalEventNames.h" | 35 #include "core/events/ThreadLocalEventNames.h" |
35 #include "platform/AsyncMethodRunner.h" | 36 #include "platform/AsyncMethodRunner.h" |
36 #include "platform/RefCountedSupplement.h" | 37 #include "platform/RefCountedSupplement.h" |
37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
40 | 41 |
(...skipping 20 matching lines...) Expand all Loading... |
61 | 62 |
62 DEFINE_ATTRIBUTE_EVENT_LISTENER(loading); | 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(loading); |
63 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); | 64 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); |
64 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); | 65 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); |
65 | 66 |
66 Vector<RefPtr<FontFace> > match(const String& font, const String& text, Exce
ptionState&); | 67 Vector<RefPtr<FontFace> > match(const String& font, const String& text, Exce
ptionState&); |
67 bool check(const String& font, const String& text, ExceptionState&); | 68 bool check(const String& font, const String& text, ExceptionState&); |
68 ScriptPromise load(const String& font, const String& text, ExceptionState&); | 69 ScriptPromise load(const String& font, const String& text, ExceptionState&); |
69 ScriptPromise ready(); | 70 ScriptPromise ready(); |
70 | 71 |
| 72 void forEach(PassOwnPtr<FontFaceSetForEachCallback>, ScriptValue& thisArg) c
onst; |
| 73 void forEach(PassOwnPtr<FontFaceSetForEachCallback>) const; |
| 74 bool has(FontFace*, ExceptionState&) const; |
| 75 |
| 76 unsigned long size() const; |
71 AtomicString status() const; | 77 AtomicString status() const; |
72 | 78 |
73 virtual ExecutionContext* executionContext() const OVERRIDE; | 79 virtual ExecutionContext* executionContext() const OVERRIDE; |
74 virtual const AtomicString& interfaceName() const OVERRIDE; | 80 virtual const AtomicString& interfaceName() const OVERRIDE; |
75 | 81 |
76 Document* document() const; | 82 Document* document() const; |
77 | 83 |
78 void didLayout(); | 84 void didLayout(); |
79 void beginFontLoading(FontFace*); | 85 void beginFontLoading(FontFace*); |
80 void fontLoaded(FontFace*); | 86 void fontLoaded(FontFace*); |
(...skipping 23 matching lines...) Expand all Loading... |
104 | 110 |
105 private: | 111 private: |
106 int m_count; | 112 int m_count; |
107 bool m_recorded; | 113 bool m_recorded; |
108 }; | 114 }; |
109 | 115 |
110 FontFaceSet(Document*); | 116 FontFaceSet(Document*); |
111 | 117 |
112 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo
nts.isEmpty(); } | 118 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo
nts.isEmpty(); } |
113 | 119 |
| 120 void forEachInternal(PassOwnPtr<FontFaceSetForEachCallback>, ScriptValue* th
isArg) const; |
114 void queueDoneEvent(FontFace*); | 121 void queueDoneEvent(FontFace*); |
115 void fireLoadingEvent(); | 122 void fireLoadingEvent(); |
116 void fireDoneEventIfPossible(); | 123 void fireDoneEventIfPossible(); |
117 bool resolveFontStyle(const String&, Font&); | 124 bool resolveFontStyle(const String&, Font&); |
118 void handlePendingEventsAndPromisesSoon(); | 125 void handlePendingEventsAndPromisesSoon(); |
119 void handlePendingEventsAndPromises(); | 126 void handlePendingEventsAndPromises(); |
120 | 127 |
121 unsigned m_loadingCount; | 128 unsigned m_loadingCount; |
122 bool m_shouldFireLoadingEvent; | 129 bool m_shouldFireLoadingEvent; |
123 Vector<OwnPtr<FontsReadyPromiseResolver> > m_readyResolvers; | 130 Vector<OwnPtr<FontsReadyPromiseResolver> > m_readyResolvers; |
124 FontFaceArray m_loadedFonts; | 131 FontFaceArray m_loadedFonts; |
125 FontFaceArray m_failedFonts; | 132 FontFaceArray m_failedFonts; |
126 | 133 |
127 AsyncMethodRunner<FontFaceSet> m_asyncRunner; | 134 AsyncMethodRunner<FontFaceSet> m_asyncRunner; |
128 | 135 |
129 FontLoadHistogram m_histogram; | 136 FontLoadHistogram m_histogram; |
130 }; | 137 }; |
131 | 138 |
132 } // namespace WebCore | 139 } // namespace WebCore |
133 | 140 |
134 #endif // FontFaceSet_h | 141 #endif // FontFaceSet_h |
OLD | NEW |