Chromium Code Reviews| Index: Source/core/css/FontFaceSet.h |
| diff --git a/Source/core/css/FontFaceSet.h b/Source/core/css/FontFaceSet.h |
| index 50a84e6ffbdc7a6585752380c5105bae0140fa9b..dca918a93a2d06cbd46ba58fb79bace28918e02d 100644 |
| --- a/Source/core/css/FontFaceSet.h |
| +++ b/Source/core/css/FontFaceSet.h |
| @@ -26,6 +26,7 @@ |
| #ifndef FontFaceSet_h |
| #define FontFaceSet_h |
| +#include "bindings/v8/ScriptPromise.h" |
| #include "core/css/FontFace.h" |
| #include "core/dom/ActiveDOMObject.h" |
| #include "core/dom/EventListener.h" |
| @@ -37,14 +38,22 @@ |
| #include "wtf/RefCounted.h" |
| #include "wtf/Vector.h" |
| +// Mac OS X 10.6 SDK defines check() macro that interfares with our check() method |
| +#ifdef check |
| +#undef check |
| +#endif |
| + |
| namespace WebCore { |
| -class FontResource; |
| class CSSFontFaceSource; |
| class Dictionary; |
| class Document; |
| class Event; |
| +class ExceptionState; |
| class Font; |
| +class FontResource; |
| +class FontsReadyPromiseResolver; |
| +class LoadFontPromiseResolver; |
| class ScriptExecutionContext; |
| class FontFaceSet : public RefCounted<FontFaceSet>, public ActiveDOMObject, public EventTarget { |
| @@ -59,11 +68,12 @@ public: |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); |
| - bool checkFont(const String&, const String&); |
| - void loadFont(const Dictionary&); |
| - void notifyWhenFontsReady(PassRefPtr<VoidCallback>); |
| + Vector<RefPtr<FontFace> > match(const String& font, const String& text, ExceptionState&); |
| + bool check(const String& font, const String& text, ExceptionState&); |
| + ScriptPromise load(const String& font, const String& text, ExceptionState&); |
| + ScriptPromise ready(); |
| - bool loading() const { return m_loadingCount > 0 || m_shouldFireDoneEvent; } |
| + String status() const { return (m_loadingCount > 0 || m_shouldFireDoneEvent) ? "loading" : "loaded"; } |
| virtual ScriptExecutionContext* scriptExecutionContext() const; |
| virtual const AtomicString& interfaceName() const; |
| @@ -77,7 +87,7 @@ public: |
| void beginFontLoading(FontFace*); |
| void fontLoaded(FontFace*); |
| void loadError(FontFace*); |
| - void scheduleCallback(PassRefPtr<VoidCallback>); |
| + void scheduleResolve(LoadFontPromiseResolver*); |
| private: |
| class FontLoadHistogram { |
| @@ -101,7 +111,7 @@ private: |
| void scheduleEvent(PassRefPtr<Event>); |
| void queueDoneEvent(FontFace*); |
| void firePendingEvents(); |
| - void firePendingCallbacks(); |
| + void resolvePendingLoadPromises(); |
| void fireDoneEventIfPossible(); |
| bool resolveFontStyle(const String&, Font&); |
| void timerFired(Timer<FontFaceSet>*); |
| @@ -109,8 +119,8 @@ private: |
| EventTargetData m_eventTargetData; |
| unsigned m_loadingCount; |
| Vector<RefPtr<Event> > m_pendingEvents; |
| - Vector<RefPtr<VoidCallback> > m_pendingCallbacks; |
| - Vector<RefPtr<VoidCallback> > m_fontsReadyCallbacks; |
| + Vector<RefPtr<LoadFontPromiseResolver> > m_pendingLoadPromises; |
|
yhirano
2013/09/18 11:49:45
I don't think m_pendingLoadPromises is a right nam
Kunihiko Sakamoto
2013/09/19 01:14:26
Renamed to m_pendingLoadResolvers.
|
| + Vector<OwnPtr<FontsReadyPromiseResolver> > m_readyPromises; |
|
yhirano
2013/09/18 11:49:45
ditto
Kunihiko Sakamoto
2013/09/19 01:14:26
Changed to m_readyResolvers.
|
| FontFaceArray m_loadedFonts; |
| FontFaceArray m_failedFonts; |
| bool m_shouldFireDoneEvent; |