| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 class CSSValue; | 50 class CSSValue; |
| 51 class DOMArrayBuffer; | 51 class DOMArrayBuffer; |
| 52 class DOMArrayBufferView; | 52 class DOMArrayBufferView; |
| 53 class Document; | 53 class Document; |
| 54 class ExceptionState; | 54 class ExceptionState; |
| 55 class FontFaceDescriptors; | 55 class FontFaceDescriptors; |
| 56 class StringOrArrayBufferOrArrayBufferView; | 56 class StringOrArrayBufferOrArrayBufferView; |
| 57 class StylePropertySet; | 57 class StylePropertySet; |
| 58 class StyleRuleFontFace; | 58 class StyleRuleFontFace; |
| 59 | 59 |
| 60 class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub
lic ScriptWrappable, public ActiveScriptWrappable, public ActiveDOMObject { | 60 class FontFace : public GarbageCollectedFinalized<FontFace>, public ScriptWrappa
ble, public ActiveScriptWrappable, public ActiveDOMObject { |
| 61 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
| 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FontFace); | 62 USING_GARBAGE_COLLECTED_MIXIN(FontFace); |
| 63 public: | 63 public: |
| 64 enum LoadStatusType { Unloaded, Loading, Loaded, Error }; | 64 enum LoadStatusType { Unloaded, Loading, Loaded, Error }; |
| 65 | 65 |
| 66 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, StringOrArrayBufferOrArrayBufferView&, const FontFaceDescripto
rs&); | 66 static RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, StringOrArrayBufferOrArrayBufferView&, const FontFaceDescriptors&); |
| 67 static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFon
tFace*); | 67 static RawPtr<FontFace> create(Document*, const StyleRuleFontFace*); |
| 68 | 68 |
| 69 ~FontFace(); | 69 ~FontFace(); |
| 70 | 70 |
| 71 const AtomicString& family() const { return m_family; } | 71 const AtomicString& family() const { return m_family; } |
| 72 String style() const; | 72 String style() const; |
| 73 String weight() const; | 73 String weight() const; |
| 74 String stretch() const; | 74 String stretch() const; |
| 75 String unicodeRange() const; | 75 String unicodeRange() const; |
| 76 String variant() const; | 76 String variant() const; |
| 77 String featureSettings() const; | 77 String featureSettings() const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 94 void setLoadStatus(LoadStatusType); | 94 void setLoadStatus(LoadStatusType); |
| 95 void setError(DOMException* = nullptr); | 95 void setError(DOMException* = nullptr); |
| 96 DOMException* error() const { return m_error; } | 96 DOMException* error() const { return m_error; } |
| 97 FontTraits traits() const; | 97 FontTraits traits() const; |
| 98 CSSFontFace* cssFontFace() { return m_cssFontFace.get(); } | 98 CSSFontFace* cssFontFace() { return m_cssFontFace.get(); } |
| 99 | 99 |
| 100 DECLARE_VIRTUAL_TRACE(); | 100 DECLARE_VIRTUAL_TRACE(); |
| 101 | 101 |
| 102 bool hadBlankText() const; | 102 bool hadBlankText() const; |
| 103 | 103 |
| 104 class LoadFontCallback : public RefCountedWillBeGarbageCollectedFinalized<Lo
adFontCallback> { | 104 class LoadFontCallback : public GarbageCollectedFinalized<LoadFontCallback>
{ |
| 105 public: | 105 public: |
| 106 virtual ~LoadFontCallback() { } | 106 virtual ~LoadFontCallback() { } |
| 107 virtual void notifyLoaded(FontFace*) = 0; | 107 virtual void notifyLoaded(FontFace*) = 0; |
| 108 virtual void notifyError(FontFace*) = 0; | 108 virtual void notifyError(FontFace*) = 0; |
| 109 DEFINE_INLINE_VIRTUAL_TRACE() { } | 109 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 110 }; | 110 }; |
| 111 void loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback>, ExecutionCon
text*); | 111 void loadWithCallback(RawPtr<LoadFontCallback>, ExecutionContext*); |
| 112 | 112 |
| 113 // ActiveScriptWrappable. | 113 // ActiveScriptWrappable. |
| 114 bool hasPendingActivity() const final; | 114 bool hasPendingActivity() const final; |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&)
; | 117 static RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&); |
| 118 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); | 118 static RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); |
| 119 static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const Atom
icString& family, const String& source, const FontFaceDescriptors&); | 119 static RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, const String& source, const FontFaceDescriptors&); |
| 120 | 120 |
| 121 explicit FontFace(ExecutionContext*); | 121 explicit FontFace(ExecutionContext*); |
| 122 FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescri
ptors&); | 122 FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescri
ptors&); |
| 123 | 123 |
| 124 void initCSSFontFace(Document*, PassRefPtrWillBeRawPtr<CSSValue> src); | 124 void initCSSFontFace(Document*, RawPtr<CSSValue> src); |
| 125 void initCSSFontFace(const unsigned char* data, size_t); | 125 void initCSSFontFace(const unsigned char* data, size_t); |
| 126 void setPropertyFromString(const Document*, const String&, CSSPropertyID, Ex
ceptionState* = 0); | 126 void setPropertyFromString(const Document*, const String&, CSSPropertyID, Ex
ceptionState* = 0); |
| 127 bool setPropertyFromStyle(const StylePropertySet&, CSSPropertyID); | 127 bool setPropertyFromStyle(const StylePropertySet&, CSSPropertyID); |
| 128 bool setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue>, CSSPropertyID); | 128 bool setPropertyValue(RawPtr<CSSValue>, CSSPropertyID); |
| 129 bool setFamilyValue(const CSSValue&); | 129 bool setFamilyValue(const CSSValue&); |
| 130 void loadInternal(ExecutionContext*); | 130 void loadInternal(ExecutionContext*); |
| 131 ScriptPromise fontStatusPromise(ScriptState*); | 131 ScriptPromise fontStatusPromise(ScriptState*); |
| 132 | 132 |
| 133 using LoadedProperty = ScriptPromiseProperty<RawPtrWillBeMember<FontFace>, R
awPtrWillBeMember<FontFace>, Member<DOMException>>; | 133 using LoadedProperty = ScriptPromiseProperty<Member<FontFace>, Member<FontFa
ce>, Member<DOMException>>; |
| 134 | 134 |
| 135 AtomicString m_family; | 135 AtomicString m_family; |
| 136 String m_otsParseMessage; | 136 String m_otsParseMessage; |
| 137 RefPtrWillBeMember<CSSValue> m_style; | 137 Member<CSSValue> m_style; |
| 138 RefPtrWillBeMember<CSSValue> m_weight; | 138 Member<CSSValue> m_weight; |
| 139 RefPtrWillBeMember<CSSValue> m_stretch; | 139 Member<CSSValue> m_stretch; |
| 140 RefPtrWillBeMember<CSSValue> m_unicodeRange; | 140 Member<CSSValue> m_unicodeRange; |
| 141 RefPtrWillBeMember<CSSValue> m_variant; | 141 Member<CSSValue> m_variant; |
| 142 RefPtrWillBeMember<CSSValue> m_featureSettings; | 142 Member<CSSValue> m_featureSettings; |
| 143 RefPtrWillBeMember<CSSValue> m_display; | 143 Member<CSSValue> m_display; |
| 144 LoadStatusType m_status; | 144 LoadStatusType m_status; |
| 145 PersistentWillBeMember<DOMException> m_error; | 145 Member<DOMException> m_error; |
| 146 | 146 |
| 147 PersistentWillBeMember<LoadedProperty> m_loadedProperty; | 147 Member<LoadedProperty> m_loadedProperty; |
| 148 OwnPtrWillBeMember<CSSFontFace> m_cssFontFace; | 148 Member<CSSFontFace> m_cssFontFace; |
| 149 WillBeHeapVector<RefPtrWillBeMember<LoadFontCallback>> m_callbacks; | 149 HeapVector<Member<LoadFontCallback>> m_callbacks; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 using FontFaceArray = WillBeHeapVector<RefPtrWillBeMember<FontFace>>; | 152 using FontFaceArray = HeapVector<Member<FontFace>>; |
| 153 | 153 |
| 154 } // namespace blink | 154 } // namespace blink |
| 155 | 155 |
| 156 #endif // FontFace_h | 156 #endif // FontFace_h |
| OLD | NEW |