Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 * DAMAGE. | 23 * DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef FontFaceSet_h | 26 #ifndef FontFaceSet_h |
| 27 #define FontFaceSet_h | 27 #define FontFaceSet_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptPromise.h" | 29 #include "bindings/core/v8/ScriptPromise.h" |
| 30 #include "core/css/FontFace.h" | 30 #include "core/css/FontFace.h" |
| 31 #include "core/css/FontFaceSetForEachCallback.h" | 31 #include "core/css/FontFaceSetForEachCallback.h" |
| 32 #include "core/dom/ActiveDOMObject.h" | 32 #include "core/dom/ActiveDOMObject.h" |
| 33 #include "core/dom/Iterator.h" | |
| 33 #include "core/events/EventListener.h" | 34 #include "core/events/EventListener.h" |
| 34 #include "core/events/EventTarget.h" | 35 #include "core/events/EventTarget.h" |
| 35 #include "platform/AsyncMethodRunner.h" | 36 #include "platform/AsyncMethodRunner.h" |
| 36 #include "platform/RefCountedSupplement.h" | 37 #include "platform/RefCountedSupplement.h" |
| 37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 | 41 |
| 41 // Mac OS X 10.6 SDK defines check() macro that interfares with our check() meth od | 42 // Mac OS X 10.6 SDK defines check() macro that interfares with our check() meth od |
| 42 #ifdef check | 43 #ifdef check |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 bool check(const String& font, const String& text, ExceptionState&); | 78 bool check(const String& font, const String& text, ExceptionState&); |
| 78 ScriptPromise load(ScriptState*, const String& font, const String& text); | 79 ScriptPromise load(ScriptState*, const String& font, const String& text); |
| 79 ScriptPromise ready(ScriptState*); | 80 ScriptPromise ready(ScriptState*); |
| 80 | 81 |
| 81 void add(FontFace*, ExceptionState&); | 82 void add(FontFace*, ExceptionState&); |
| 82 void clear(); | 83 void clear(); |
| 83 bool remove(FontFace*, ExceptionState&); | 84 bool remove(FontFace*, ExceptionState&); |
| 84 void forEach(PassOwnPtrWillBeRawPtr<FontFaceSetForEachCallback>, const Scrip tValue& thisArg) const; | 85 void forEach(PassOwnPtrWillBeRawPtr<FontFaceSetForEachCallback>, const Scrip tValue& thisArg) const; |
| 85 void forEach(PassOwnPtrWillBeRawPtr<FontFaceSetForEachCallback>) const; | 86 void forEach(PassOwnPtrWillBeRawPtr<FontFaceSetForEachCallback>) const; |
| 86 bool has(FontFace*, ExceptionState&) const; | 87 bool has(FontFace*, ExceptionState&) const; |
| 88 Iterator* keys(); | |
| 89 Iterator* values(); | |
| 90 Iterator* entries(); | |
| 91 Iterator* iterator(ScriptState*, ExceptionState&) { return values(); } | |
| 87 | 92 |
| 88 unsigned long size() const; | 93 unsigned long size() const; |
| 89 AtomicString status() const; | 94 AtomicString status() const; |
| 90 | 95 |
| 96 FontFace* fontFaceAt(size_t index) const; | |
| 97 | |
| 91 virtual ExecutionContext* executionContext() const OVERRIDE; | 98 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 92 virtual const AtomicString& interfaceName() const OVERRIDE; | 99 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 93 | 100 |
| 94 Document* document() const; | 101 Document* document() const; |
| 95 | 102 |
| 96 void didLayout(); | 103 void didLayout(); |
| 97 void beginFontLoading(FontFace*); | 104 void beginFontLoading(FontFace*); |
| 98 void fontLoaded(FontFace*); | 105 void fontLoaded(FontFace*); |
| 99 void loadError(FontFace*); | 106 void loadError(FontFace*); |
| 100 | 107 |
| 101 // ActiveDOMObject | 108 // ActiveDOMObject |
| 102 virtual void suspend() OVERRIDE; | 109 virtual void suspend() OVERRIDE; |
| 103 virtual void resume() OVERRIDE; | 110 virtual void resume() OVERRIDE; |
| 104 virtual void stop() OVERRIDE; | 111 virtual void stop() OVERRIDE; |
| 105 | 112 |
| 106 static PassRefPtrWillBeRawPtr<FontFaceSet> from(Document&); | 113 static PassRefPtrWillBeRawPtr<FontFaceSet> from(Document&); |
| 107 static void didLayout(Document&); | 114 static void didLayout(Document&); |
| 108 | 115 |
| 109 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*); | 116 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*); |
| 110 | 117 |
| 111 #if ENABLE(OILPAN) | 118 #if ENABLE(OILPAN) |
| 112 virtual void trace(Visitor*) OVERRIDE; | 119 virtual void trace(Visitor*) OVERRIDE; |
| 113 #endif | 120 #endif |
| 114 | 121 |
| 115 private: | 122 private: |
| 123 class FontFaceSetIterator FINAL : public Iterator { | |
| 124 public: | |
| 125 enum Kind { Keys, Values, Entries }; | |
| 126 | |
| 127 FontFaceSetIterator(PassRefPtrWillBeRawPtr<FontFaceSet> fontFaceSet, Kin d kind) | |
| 128 : m_fontFaceSet(fontFaceSet) | |
| 129 , m_kind(kind) | |
| 130 , m_index(0) { } | |
| 131 ~FontFaceSetIterator() { } | |
|
yhirano
2014/09/11 08:04:45
+virtual
Kunihiko Sakamoto
2014/09/11 10:47:36
Done.
| |
| 132 virtual ScriptValue next(ScriptState*, ExceptionState&) OVERRIDE; | |
| 133 virtual ScriptValue next(ScriptState* scriptState, ScriptValue, Exceptio nState& exceptionState) OVERRIDE | |
| 134 { | |
| 135 return next(scriptState, exceptionState); | |
| 136 } | |
| 137 | |
| 138 virtual void trace(Visitor* visitor) OVERRIDE | |
| 139 { | |
| 140 visitor->trace(m_fontFaceSet); | |
| 141 Iterator::trace(visitor); | |
| 142 } | |
| 143 | |
| 144 private: | |
| 145 RefPtrWillBeMember<FontFaceSet> m_fontFaceSet; | |
| 146 Kind m_kind; | |
| 147 size_t m_index; | |
| 148 }; | |
| 149 | |
| 116 static PassRefPtrWillBeRawPtr<FontFaceSet> create(Document& document) | 150 static PassRefPtrWillBeRawPtr<FontFaceSet> create(Document& document) |
| 117 { | 151 { |
| 118 return adoptRefWillBeNoop(new FontFaceSet(document)); | 152 return adoptRefWillBeNoop(new FontFaceSet(document)); |
| 119 } | 153 } |
| 120 | 154 |
| 121 class FontLoadHistogram { | 155 class FontLoadHistogram { |
| 122 public: | 156 public: |
| 123 enum Status { NoWebFonts, HadBlankText, DidNotHaveBlankText, Reported }; | 157 enum Status { NoWebFonts, HadBlankText, DidNotHaveBlankText, Reported }; |
| 124 FontLoadHistogram() : m_status(NoWebFonts), m_count(0), m_recorded(false ) { } | 158 FontLoadHistogram() : m_status(NoWebFonts), m_count(0), m_recorded(false ) { } |
| 125 void incrementCount() { m_count++; } | 159 void incrementCount() { m_count++; } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 156 WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> > m_nonCSSConnectedFaces; | 190 WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> > m_nonCSSConnectedFaces; |
| 157 | 191 |
| 158 AsyncMethodRunner<FontFaceSet> m_asyncRunner; | 192 AsyncMethodRunner<FontFaceSet> m_asyncRunner; |
| 159 | 193 |
| 160 FontLoadHistogram m_histogram; | 194 FontLoadHistogram m_histogram; |
| 161 }; | 195 }; |
| 162 | 196 |
| 163 } // namespace blink | 197 } // namespace blink |
| 164 | 198 |
| 165 #endif // FontFaceSet_h | 199 #endif // FontFaceSet_h |
| OLD | NEW |