Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: Source/core/css/FontFaceSet.h

Issue 23717059: [Font Load Events] Implement FontFaceSet methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSSegmentedFontFace.cpp ('k') | Source/core/css/FontFaceSet.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/FontFaceSet.h
diff --git a/Source/core/css/FontFaceSet.h b/Source/core/css/FontFaceSet.h
index 50a84e6ffbdc7a6585752380c5105bae0140fa9b..fdc2b3abc556175d11b014ef8d37b2ebf6e93a3a 100644
--- a/Source/core/css/FontFaceSet.h
+++ b/Source/core/css/FontFaceSet.h
@@ -26,25 +26,33 @@
#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"
#include "core/dom/EventNames.h"
#include "core/dom/EventTarget.h"
-#include "core/html/VoidCallback.h"
#include "core/platform/Timer.h"
#include "wtf/PassRefPtr.h"
#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 +67,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; }
+ AtomicString status() const;
virtual ScriptExecutionContext* scriptExecutionContext() const;
virtual const AtomicString& interfaceName() const;
@@ -77,7 +86,7 @@ public:
void beginFontLoading(FontFace*);
void fontLoaded(FontFace*);
void loadError(FontFace*);
- void scheduleCallback(PassRefPtr<VoidCallback>);
+ void scheduleResolve(LoadFontPromiseResolver*);
private:
class FontLoadHistogram {
@@ -101,7 +110,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 +118,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_pendingLoadResolvers;
+ Vector<OwnPtr<FontsReadyPromiseResolver> > m_readyResolvers;
FontFaceArray m_loadedFonts;
FontFaceArray m_failedFonts;
bool m_shouldFireDoneEvent;
« no previous file with comments | « Source/core/css/CSSSegmentedFontFace.cpp ('k') | Source/core/css/FontFaceSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698