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

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

Issue 557763003: Add iterator support to FontFaceSet (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « LayoutTests/fast/css/fontfaceset-iterator-expected.txt ('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 6a334872573e8352e4eb8dcb5990a4c14c69fd03..c3cea021e7457d127ad90620a9812c387479e2a7 100644
--- a/Source/core/css/FontFaceSet.h
+++ b/Source/core/css/FontFaceSet.h
@@ -30,6 +30,7 @@
#include "core/css/FontFace.h"
#include "core/css/FontFaceSetForEachCallback.h"
#include "core/dom/ActiveDOMObject.h"
+#include "core/dom/Iterator.h"
#include "core/events/EventListener.h"
#include "core/events/EventTarget.h"
#include "platform/AsyncMethodRunner.h"
@@ -84,10 +85,16 @@ public:
void forEach(PassOwnPtrWillBeRawPtr<FontFaceSetForEachCallback>, const ScriptValue& thisArg) const;
void forEach(PassOwnPtrWillBeRawPtr<FontFaceSetForEachCallback>) const;
bool has(FontFace*, ExceptionState&) const;
+ Iterator* keys();
+ Iterator* values();
+ Iterator* entries();
+ Iterator* iterator(ScriptState*, ExceptionState&) { return values(); }
unsigned long size() const;
AtomicString status() const;
+ FontFace* fontFaceAt(size_t index) const;
+
virtual ExecutionContext* executionContext() const OVERRIDE;
virtual const AtomicString& interfaceName() const OVERRIDE;
@@ -113,6 +120,33 @@ public:
#endif
private:
+ class FontFaceSetIterator FINAL : public Iterator {
+ public:
+ enum Kind { Keys, Values, Entries };
+
+ FontFaceSetIterator(PassRefPtrWillBeRawPtr<FontFaceSet> fontFaceSet, Kind kind)
+ : m_fontFaceSet(fontFaceSet)
+ , m_kind(kind)
+ , m_index(0) { }
+ virtual ~FontFaceSetIterator() { }
+ virtual ScriptValue next(ScriptState*, ExceptionState&) OVERRIDE;
+ virtual ScriptValue next(ScriptState* scriptState, ScriptValue, ExceptionState& exceptionState) OVERRIDE
+ {
+ return next(scriptState, exceptionState);
+ }
+
+ virtual void trace(Visitor* visitor) OVERRIDE
+ {
+ visitor->trace(m_fontFaceSet);
+ Iterator::trace(visitor);
+ }
+
+ private:
+ RefPtrWillBeMember<FontFaceSet> m_fontFaceSet;
+ Kind m_kind;
+ size_t m_index;
+ };
+
static PassRefPtrWillBeRawPtr<FontFaceSet> create(Document& document)
{
return adoptRefWillBeNoop(new FontFaceSet(document));
« no previous file with comments | « LayoutTests/fast/css/fontfaceset-iterator-expected.txt ('k') | Source/core/css/FontFaceSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698