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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ~FontFaceSet() override; | 66 ~FontFaceSet() override; |
67 | 67 |
68 DEFINE_ATTRIBUTE_EVENT_LISTENER(loading); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(loading); |
69 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); |
70 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); |
71 | 71 |
72 bool check(const String& font, const String& text, ExceptionState&); | 72 bool check(const String& font, const String& text, ExceptionState&); |
73 ScriptPromise load(ScriptState*, const String& font, const String& text); | 73 ScriptPromise load(ScriptState*, const String& font, const String& text); |
74 ScriptPromise ready(ScriptState*); | 74 ScriptPromise ready(ScriptState*); |
75 | 75 |
76 RawPtr<FontFaceSet> addForBinding(ScriptState*, FontFace*, ExceptionState&); | 76 FontFaceSet* addForBinding(ScriptState*, FontFace*, ExceptionState&); |
77 void clearForBinding(ScriptState*, ExceptionState&); | 77 void clearForBinding(ScriptState*, ExceptionState&); |
78 bool deleteForBinding(ScriptState*, FontFace*, ExceptionState&); | 78 bool deleteForBinding(ScriptState*, FontFace*, ExceptionState&); |
79 bool hasForBinding(ScriptState*, FontFace*, ExceptionState&) const; | 79 bool hasForBinding(ScriptState*, FontFace*, ExceptionState&) const; |
80 | 80 |
81 size_t size() const; | 81 size_t size() const; |
82 AtomicString status() const; | 82 AtomicString status() const; |
83 | 83 |
84 ExecutionContext* getExecutionContext() const override; | 84 ExecutionContext* getExecutionContext() const override; |
85 const AtomicString& interfaceName() const override; | 85 const AtomicString& interfaceName() const override; |
86 | 86 |
87 Document* document() const; | 87 Document* document() const; |
88 | 88 |
89 void didLayout(); | 89 void didLayout(); |
90 void beginFontLoading(FontFace*); | 90 void beginFontLoading(FontFace*); |
91 void fontLoaded(FontFace*); | 91 void fontLoaded(FontFace*); |
92 void loadError(FontFace*); | 92 void loadError(FontFace*); |
93 | 93 |
94 // ActiveDOMObject | 94 // ActiveDOMObject |
95 void suspend() override; | 95 void suspend() override; |
96 void resume() override; | 96 void resume() override; |
97 void stop() override; | 97 void stop() override; |
98 | 98 |
99 static RawPtr<FontFaceSet> from(Document&); | 99 static FontFaceSet* from(Document&); |
100 static void didLayout(Document&); | 100 static void didLayout(Document&); |
101 | 101 |
102 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*); | 102 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*); |
103 | 103 |
104 DECLARE_VIRTUAL_TRACE(); | 104 DECLARE_VIRTUAL_TRACE(); |
105 | 105 |
106 private: | 106 private: |
107 static RawPtr<FontFaceSet> create(Document& document) | 107 static FontFaceSet* create(Document& document) |
108 { | 108 { |
109 return new FontFaceSet(document); | 109 return new FontFaceSet(document); |
110 } | 110 } |
111 | 111 |
112 FontFaceSetIterable::IterationSource* startIteration(ScriptState*, Exception
State&) override; | 112 FontFaceSetIterable::IterationSource* startIteration(ScriptState*, Exception
State&) override; |
113 | 113 |
114 class IterationSource final : public FontFaceSetIterable::IterationSource { | 114 class IterationSource final : public FontFaceSetIterable::IterationSource { |
115 public: | 115 public: |
116 explicit IterationSource(const HeapVector<Member<FontFace>>& fontFaces) | 116 explicit IterationSource(const HeapVector<Member<FontFace>>& fontFaces) |
117 : m_index(0) | 117 : m_index(0) |
(...skipping 22 matching lines...) Expand all Loading... |
140 | 140 |
141 private: | 141 private: |
142 Status m_status; | 142 Status m_status; |
143 int m_count; | 143 int m_count; |
144 bool m_recorded; | 144 bool m_recorded; |
145 }; | 145 }; |
146 | 146 |
147 FontFaceSet(Document&); | 147 FontFaceSet(Document&); |
148 | 148 |
149 bool inActiveDocumentContext() const; | 149 bool inActiveDocumentContext() const; |
150 void addToLoadingFonts(RawPtr<FontFace>); | 150 void addToLoadingFonts(FontFace*); |
151 void removeFromLoadingFonts(RawPtr<FontFace>); | 151 void removeFromLoadingFonts(FontFace*); |
152 void fireLoadingEvent(); | 152 void fireLoadingEvent(); |
153 void fireDoneEventIfPossible(); | 153 void fireDoneEventIfPossible(); |
154 bool resolveFontStyle(const String&, Font&); | 154 bool resolveFontStyle(const String&, Font&); |
155 void handlePendingEventsAndPromisesSoon(); | 155 void handlePendingEventsAndPromisesSoon(); |
156 void handlePendingEventsAndPromises(); | 156 void handlePendingEventsAndPromises(); |
157 const HeapListHashSet<Member<FontFace>>& cssConnectedFontFaceList() const; | 157 const HeapListHashSet<Member<FontFace>>& cssConnectedFontFaceList() const; |
158 bool isCSSConnectedFontFace(FontFace*) const; | 158 bool isCSSConnectedFontFace(FontFace*) const; |
159 bool shouldSignalReady() const; | 159 bool shouldSignalReady() const; |
160 | 160 |
161 using ReadyProperty = ScriptPromiseProperty<Member<FontFaceSet>, Member<Font
FaceSet>, Member<DOMException>>; | 161 using ReadyProperty = ScriptPromiseProperty<Member<FontFaceSet>, Member<Font
FaceSet>, Member<DOMException>>; |
162 | 162 |
163 HeapHashSet<Member<FontFace>> m_loadingFonts; | 163 HeapHashSet<Member<FontFace>> m_loadingFonts; |
164 bool m_shouldFireLoadingEvent; | 164 bool m_shouldFireLoadingEvent; |
165 bool m_isLoading; | 165 bool m_isLoading; |
166 Member<ReadyProperty> m_ready; | 166 Member<ReadyProperty> m_ready; |
167 FontFaceArray m_loadedFonts; | 167 FontFaceArray m_loadedFonts; |
168 FontFaceArray m_failedFonts; | 168 FontFaceArray m_failedFonts; |
169 HeapListHashSet<Member<FontFace>> m_nonCSSConnectedFaces; | 169 HeapListHashSet<Member<FontFace>> m_nonCSSConnectedFaces; |
170 | 170 |
171 Member<AsyncMethodRunner<FontFaceSet>> m_asyncRunner; | 171 Member<AsyncMethodRunner<FontFaceSet>> m_asyncRunner; |
172 | 172 |
173 FontLoadHistogram m_histogram; | 173 FontLoadHistogram m_histogram; |
174 }; | 174 }; |
175 | 175 |
176 } // namespace blink | 176 } // namespace blink |
177 | 177 |
178 #endif // FontFaceSet_h | 178 #endif // FontFaceSet_h |
OLD | NEW |