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 | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class CSSFontFace; | 48 class CSSFontFace; |
49 class CSSValueList; | 49 class CSSValueList; |
50 class DOMArrayBuffer; | 50 class DOMArrayBuffer; |
51 class DOMArrayBufferView; | 51 class DOMArrayBufferView; |
52 class Dictionary; | 52 class Dictionary; |
53 class Document; | 53 class Document; |
54 class ExceptionState; | 54 class ExceptionState; |
55 class FontFaceDescriptors; | 55 class FontFaceDescriptors; |
| 56 class StringOrArrayBufferOrArrayBufferView; |
56 class StylePropertySet; | 57 class StylePropertySet; |
57 class StyleRuleFontFace; | 58 class StyleRuleFontFace; |
58 | 59 |
59 class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub
lic ScriptWrappable, public ActiveDOMObject { | 60 class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub
lic ScriptWrappable, public ActiveDOMObject { |
60 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
61 public: | 62 public: |
62 enum LoadStatus { Unloaded, Loading, Loaded, Error }; | 63 enum LoadStatus { Unloaded, Loading, Loaded, Error }; |
63 | 64 |
64 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&)
; | 65 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, StringOrArrayBufferOrArrayBufferView&, const FontFaceDescripto
rs&); |
65 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); | |
66 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, const String& source, const FontFaceDescriptors&); | |
67 static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFon
tFace*); | 66 static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFon
tFace*); |
68 | 67 |
69 ~FontFace(); | 68 ~FontFace(); |
70 | 69 |
71 const AtomicString& family() const { return m_family; } | 70 const AtomicString& family() const { return m_family; } |
72 String style() const; | 71 String style() const; |
73 String weight() const; | 72 String weight() const; |
74 String stretch() const; | 73 String stretch() const; |
75 String unicodeRange() const; | 74 String unicodeRange() const; |
76 String variant() const; | 75 String variant() const; |
(...skipping 30 matching lines...) Expand all Loading... |
107 virtual void notifyLoaded(FontFace*) = 0; | 106 virtual void notifyLoaded(FontFace*) = 0; |
108 virtual void notifyError(FontFace*) = 0; | 107 virtual void notifyError(FontFace*) = 0; |
109 virtual void trace(Visitor*) { } | 108 virtual void trace(Visitor*) { } |
110 }; | 109 }; |
111 void loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback>, ExecutionCon
text*); | 110 void loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback>, ExecutionCon
text*); |
112 | 111 |
113 // ActiveDOMObject | 112 // ActiveDOMObject |
114 virtual bool hasPendingActivity() const override; | 113 virtual bool hasPendingActivity() const override; |
115 | 114 |
116 private: | 115 private: |
| 116 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&)
; |
| 117 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); |
| 118 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, const String& source, const FontFaceDescriptors&); |
| 119 |
117 explicit FontFace(ExecutionContext*); | 120 explicit FontFace(ExecutionContext*); |
118 FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescri
ptors&); | 121 FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescri
ptors&); |
119 | 122 |
120 void initCSSFontFace(Document*, PassRefPtrWillBeRawPtr<CSSValue> src); | 123 void initCSSFontFace(Document*, PassRefPtrWillBeRawPtr<CSSValue> src); |
121 void initCSSFontFace(const unsigned char* data, unsigned size); | 124 void initCSSFontFace(const unsigned char* data, unsigned size); |
122 void setPropertyFromString(const Document*, const String&, CSSPropertyID, Ex
ceptionState* = 0); | 125 void setPropertyFromString(const Document*, const String&, CSSPropertyID, Ex
ceptionState* = 0); |
123 bool setPropertyFromStyle(const StylePropertySet&, CSSPropertyID); | 126 bool setPropertyFromStyle(const StylePropertySet&, CSSPropertyID); |
124 bool setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue>, CSSPropertyID); | 127 bool setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue>, CSSPropertyID); |
125 bool setFamilyValue(CSSValueList*); | 128 bool setFamilyValue(CSSValueList*); |
126 void loadInternal(ExecutionContext*); | 129 void loadInternal(ExecutionContext*); |
(...skipping 15 matching lines...) Expand all Loading... |
142 PersistentWillBeMember<LoadedProperty> m_loadedProperty; | 145 PersistentWillBeMember<LoadedProperty> m_loadedProperty; |
143 OwnPtrWillBeMember<CSSFontFace> m_cssFontFace; | 146 OwnPtrWillBeMember<CSSFontFace> m_cssFontFace; |
144 WillBeHeapVector<RefPtrWillBeMember<LoadFontCallback> > m_callbacks; | 147 WillBeHeapVector<RefPtrWillBeMember<LoadFontCallback> > m_callbacks; |
145 }; | 148 }; |
146 | 149 |
147 typedef WillBeHeapVector<RefPtrWillBeMember<FontFace> > FontFaceArray; | 150 typedef WillBeHeapVector<RefPtrWillBeMember<FontFace> > FontFaceArray; |
148 | 151 |
149 } // namespace blink | 152 } // namespace blink |
150 | 153 |
151 #endif // FontFace_h | 154 #endif // FontFace_h |
OLD | NEW |