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

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

Issue 1409433003: CSS Font Loading: make FontFaceSet Setlike (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert forEach behavior (that makes it easy!) Created 5 years, 2 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
Index: third_party/WebKit/Source/core/css/FontFaceSet.h
diff --git a/third_party/WebKit/Source/core/css/FontFaceSet.h b/third_party/WebKit/Source/core/css/FontFaceSet.h
index fda6c9171e0ae44cbd4ed82cdf12b379849013f5..5c2e7594724abe060bffb20141b1134d9f8c018e 100644
--- a/third_party/WebKit/Source/core/css/FontFaceSet.h
+++ b/third_party/WebKit/Source/core/css/FontFaceSet.h
@@ -26,6 +26,7 @@
#ifndef FontFaceSet_h
#define FontFaceSet_h
+#include "bindings/core/v8/Iterable.h"
#include "bindings/core/v8/ScriptPromise.h"
#include "core/css/FontFace.h"
#include "core/css/FontFaceSetForEachCallback.h"
@@ -57,12 +58,14 @@ class FontFaceCache;
class FontResource;
class ExecutionContext;
+using FontFaceSetIterable = PairIterable<RefPtrWillBeMember<FontFace>, RefPtrWillBeMember<FontFace>>;
+
#if ENABLE(OILPAN)
-class FontFaceSet final : public EventTargetWithInlineData, public HeapSupplement<Document>, public ActiveDOMObject {
+class FontFaceSet final : public EventTargetWithInlineData, public HeapSupplement<Document>, public ActiveDOMObject, public FontFaceSetIterable {
USING_GARBAGE_COLLECTED_MIXIN(FontFaceSet);
using SupplementType = HeapSupplement<Document>;
#else
-class FontFaceSet final : public EventTargetWithInlineData, public RefCountedSupplement<Document, FontFaceSet>, public ActiveDOMObject {
+class FontFaceSet final : public EventTargetWithInlineData, public RefCountedSupplement<Document, FontFaceSet>, public ActiveDOMObject, public FontFaceSetIterable {
REFCOUNTED_EVENT_TARGET(FontFaceSet);
using SupplementType = RefCountedSupplement<Document, FontFaceSet>;
#endif
@@ -81,11 +84,9 @@ public:
void add(FontFace*, ExceptionState&);
void clear();
bool remove(FontFace*, ExceptionState&);
- void forEach(FontFaceSetForEachCallback*, const ScriptValue& thisArg) const;
- void forEach(FontFaceSetForEachCallback*) const;
- bool has(FontFace*, ExceptionState&) const;
+ bool hasForBinding(ScriptState*, const PassRefPtrWillBeRawPtr<FontFace>&, ExceptionState&) const;
Takashi Toyoshima 2015/10/16 10:07:03 The second argument seems to be FontFace* here.
- unsigned long size() const;
+ size_t size() const;
AtomicString status() const;
ExecutionContext* executionContext() const override;
@@ -116,6 +117,19 @@ private:
return adoptRefWillBeNoop(new FontFaceSet(document));
}
+ FontFaceSetIterable::IterationSource* startIteration(ScriptState*, ExceptionState&) override;
+
+ class IterationSource final : public FontFaceSetIterable::IterationSource {
+ public:
+ IterationSource(const WillBeHeapVector<RefPtrWillBeMember<FontFace>> fontFaces)
Kunihiko Sakamoto 2015/10/16 09:50:07 nit: explicit, and maybe a reference parameter?
Takashi Toyoshima 2015/10/16 10:07:03 Done.
+ : m_index(0)
+ , m_fontFaces(fontFaces) { }
+ bool next(ScriptState*, RefPtrWillBeMember<FontFace>&, RefPtrWillBeMember<FontFace>&, ExceptionState&) override;
+ private:
+ size_t m_index;
+ WillBeHeapVector<RefPtrWillBeMember<FontFace>> m_fontFaces;
+ };
+
class FontLoadHistogram {
DISALLOW_ALLOCATION();
public:
@@ -134,7 +148,6 @@ private:
FontFaceSet(Document&);
bool inActiveDocumentContext() const;
- void forEachInternal(FontFaceSetForEachCallback*, const ScriptValue* thisArg) const;
void addToLoadingFonts(PassRefPtrWillBeRawPtr<FontFace>);
void removeFromLoadingFonts(PassRefPtrWillBeRawPtr<FontFace>);
void fireLoadingEvent();

Powered by Google App Engine
This is Rietveld 408576698