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

Side by Side Diff: sky/engine/core/css/FontFaceSet.h

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/FontFace.idl ('k') | sky/engine/core/css/FontFaceSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE 16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23 * DAMAGE. 23 * DAMAGE.
24 */ 24 */
25 25
26 #ifndef SKY_ENGINE_CORE_CSS_FONTFACESET_H_ 26 #ifndef SKY_ENGINE_CORE_CSS_FONTFACESET_H_
27 #define SKY_ENGINE_CORE_CSS_FONTFACESET_H_ 27 #define SKY_ENGINE_CORE_CSS_FONTFACESET_H_
28 28
29 #include "sky/engine/bindings/core/v8/ScriptPromise.h"
30 #include "sky/engine/core/css/FontFace.h" 29 #include "sky/engine/core/css/FontFace.h"
31 #include "sky/engine/core/css/FontFaceSetForEachCallback.h"
32 #include "sky/engine/core/dom/ActiveDOMObject.h" 30 #include "sky/engine/core/dom/ActiveDOMObject.h"
33 #include "sky/engine/core/events/EventListener.h" 31 #include "sky/engine/core/events/EventListener.h"
34 #include "sky/engine/core/events/EventTarget.h" 32 #include "sky/engine/core/events/EventTarget.h"
35 #include "sky/engine/platform/AsyncMethodRunner.h" 33 #include "sky/engine/platform/AsyncMethodRunner.h"
36 #include "sky/engine/platform/RefCountedSupplement.h" 34 #include "sky/engine/platform/RefCountedSupplement.h"
37 #include "sky/engine/wtf/PassRefPtr.h" 35 #include "sky/engine/wtf/PassRefPtr.h"
38 #include "sky/engine/wtf/RefCounted.h" 36 #include "sky/engine/wtf/RefCounted.h"
39 #include "sky/engine/wtf/Vector.h" 37 #include "sky/engine/wtf/Vector.h"
40 38
41 // Mac OS X 10.6 SDK defines check() macro that interfares with our check() meth od 39 // Mac OS X 10.6 SDK defines check() macro that interfares with our check() meth od
42 #ifdef check 40 #ifdef check
43 #undef check 41 #undef check
44 #endif 42 #endif
45 43
46 namespace blink { 44 namespace blink {
47 45
48 class CSSFontFace; 46 class CSSFontFace;
49 class CSSFontFaceSource; 47 class CSSFontFaceSource;
50 class CSSFontSelector; 48 class CSSFontSelector;
51 class Dictionary; 49 class Dictionary;
52 class Document; 50 class Document;
53 class ExceptionState; 51 class ExceptionState;
54 class Font; 52 class Font;
55 class FontFaceCache; 53 class FontFaceCache;
56 class FontResource; 54 class FontResource;
57 class FontsReadyPromiseResolver;
58 class ExecutionContext; 55 class ExecutionContext;
59 56
60 class FontFaceSet final : public RefCountedSupplement<Document, FontFaceSet>, pu blic ActiveDOMObject, public EventTargetWithInlineData { 57 class FontFaceSet final : public RefCountedSupplement<Document, FontFaceSet>, pu blic ActiveDOMObject, public EventTargetWithInlineData {
61 DEFINE_EVENT_TARGET_REFCOUNTING(RefCounted<FontFaceSet>); 58 DEFINE_EVENT_TARGET_REFCOUNTING(RefCounted<FontFaceSet>);
62 typedef RefCountedSupplement<Document, FontFaceSet> SupplementType; 59 typedef RefCountedSupplement<Document, FontFaceSet> SupplementType;
63 DEFINE_WRAPPERTYPEINFO(); 60 DEFINE_WRAPPERTYPEINFO();
64 public: 61 public:
65 virtual ~FontFaceSet(); 62 virtual ~FontFaceSet();
66 63
67 bool check(const String& font, const String& text, ExceptionState&); 64 bool check(const String& font, const String& text, ExceptionState&);
68 ScriptPromise load(ScriptState*, const String& font, const String& text);
69 ScriptPromise ready(ScriptState*);
70 65
71 void add(FontFace*, ExceptionState&); 66 void add(FontFace*, ExceptionState&);
72 void clear(); 67 void clear();
73 bool remove(FontFace*, ExceptionState&); 68 bool remove(FontFace*, ExceptionState&);
74 void forEach(PassOwnPtr<FontFaceSetForEachCallback>, const ScriptValue& this Arg) const;
75 void forEach(PassOwnPtr<FontFaceSetForEachCallback>) const;
76 bool has(FontFace*, ExceptionState&) const; 69 bool has(FontFace*, ExceptionState&) const;
77 70
78 unsigned long size() const; 71 unsigned long size() const;
79 AtomicString status() const; 72 AtomicString status() const;
80 73
81 virtual ExecutionContext* executionContext() const override; 74 virtual ExecutionContext* executionContext() const override;
82 virtual const AtomicString& interfaceName() const override; 75 virtual const AtomicString& interfaceName() const override;
83 76
84 Document* document() const; 77 Document* document() const;
85 78
(...skipping 30 matching lines...) Expand all
116 Status m_status; 109 Status m_status;
117 int m_count; 110 int m_count;
118 bool m_recorded; 111 bool m_recorded;
119 }; 112 };
120 113
121 FontFaceSet(Document&); 114 FontFaceSet(Document&);
122 115
123 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo nts.isEmpty(); } 116 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo nts.isEmpty(); }
124 117
125 bool inActiveDocumentContext() const; 118 bool inActiveDocumentContext() const;
126 void forEachInternal(PassOwnPtr<FontFaceSetForEachCallback>, const ScriptVal ue* thisArg) const;
127 void addToLoadingFonts(PassRefPtr<FontFace>); 119 void addToLoadingFonts(PassRefPtr<FontFace>);
128 void removeFromLoadingFonts(PassRefPtr<FontFace>); 120 void removeFromLoadingFonts(PassRefPtr<FontFace>);
129 void fireLoadingEvent(); 121 void fireLoadingEvent();
130 void fireDoneEventIfPossible(); 122 void fireDoneEventIfPossible();
131 bool resolveFontStyle(const String&, Font&); 123 bool resolveFontStyle(const String&, Font&);
132 void handlePendingEventsAndPromisesSoon(); 124 void handlePendingEventsAndPromisesSoon();
133 void handlePendingEventsAndPromises(); 125 void handlePendingEventsAndPromises();
134 const ListHashSet<RefPtr<FontFace> >& cssConnectedFontFaceList() const; 126 const ListHashSet<RefPtr<FontFace> >& cssConnectedFontFaceList() const;
135 bool isCSSConnectedFontFace(FontFace*) const; 127 bool isCSSConnectedFontFace(FontFace*) const;
136 128
137 HashSet<RefPtr<FontFace> > m_loadingFonts; 129 HashSet<RefPtr<FontFace> > m_loadingFonts;
138 bool m_shouldFireLoadingEvent; 130 bool m_shouldFireLoadingEvent;
139 Vector<OwnPtr<FontsReadyPromiseResolver> > m_readyResolvers;
140 FontFaceArray m_loadedFonts; 131 FontFaceArray m_loadedFonts;
141 FontFaceArray m_failedFonts; 132 FontFaceArray m_failedFonts;
142 ListHashSet<RefPtr<FontFace> > m_nonCSSConnectedFaces; 133 ListHashSet<RefPtr<FontFace> > m_nonCSSConnectedFaces;
143 134
144 AsyncMethodRunner<FontFaceSet> m_asyncRunner; 135 AsyncMethodRunner<FontFaceSet> m_asyncRunner;
145 136
146 FontLoadHistogram m_histogram; 137 FontLoadHistogram m_histogram;
147 }; 138 };
148 139
149 } // namespace blink 140 } // namespace blink
150 141
151 #endif // SKY_ENGINE_CORE_CSS_FONTFACESET_H_ 142 #endif // SKY_ENGINE_CORE_CSS_FONTFACESET_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/FontFace.idl ('k') | sky/engine/core/css/FontFaceSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698