| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class StringOrArrayBufferOrArrayBufferView; | 56 class StringOrArrayBufferOrArrayBufferView; |
| 57 class StylePropertySet; | 57 class StylePropertySet; |
| 58 class StyleRuleFontFace; | 58 class StyleRuleFontFace; |
| 59 | 59 |
| 60 class FontFace : public GarbageCollectedFinalized<FontFace>, public ScriptWrappa
ble, public ActiveScriptWrappable, public ActiveDOMObject { | 60 class FontFace : public GarbageCollectedFinalized<FontFace>, public ScriptWrappa
ble, public ActiveScriptWrappable, public ActiveDOMObject { |
| 61 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
| 62 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 RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, StringOrArrayBufferOrArrayBufferView&, const FontFaceDescriptors&); | 66 static FontFace* create(ExecutionContext*, const AtomicString& family, Strin
gOrArrayBufferOrArrayBufferView&, const FontFaceDescriptors&); |
| 67 static RawPtr<FontFace> create(Document*, const StyleRuleFontFace*); | 67 static 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 23 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 bool hadBlankText() const; | 102 bool hadBlankText() const; |
| 103 | 103 |
| 104 class LoadFontCallback : public GarbageCollectedFinalized<LoadFontCallback>
{ | 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(RawPtr<LoadFontCallback>, ExecutionContext*); | 111 void loadWithCallback(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 RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&); | 117 static FontFace* create(ExecutionContext*, const AtomicString& family, PassR
efPtr<DOMArrayBuffer> source, const FontFaceDescriptors&); |
| 118 static RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); | 118 static FontFace* create(ExecutionContext*, const AtomicString& family, PassR
efPtr<DOMArrayBufferView>, const FontFaceDescriptors&); |
| 119 static RawPtr<FontFace> create(ExecutionContext*, const AtomicString& family
, const String& source, const FontFaceDescriptors&); | 119 static 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*, RawPtr<CSSValue> src); | 124 void initCSSFontFace(Document*, 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(RawPtr<CSSValue>, CSSPropertyID); | 128 bool setPropertyValue(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<Member<FontFace>, Member<FontFa
ce>, 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 Member<CSSValue> m_style; | 137 Member<CSSValue> m_style; |
| 138 Member<CSSValue> m_weight; | 138 Member<CSSValue> m_weight; |
| 139 Member<CSSValue> m_stretch; | 139 Member<CSSValue> m_stretch; |
| 140 Member<CSSValue> m_unicodeRange; | 140 Member<CSSValue> m_unicodeRange; |
| 141 Member<CSSValue> m_variant; | 141 Member<CSSValue> m_variant; |
| 142 Member<CSSValue> m_featureSettings; | 142 Member<CSSValue> m_featureSettings; |
| 143 Member<CSSValue> m_display; | 143 Member<CSSValue> m_display; |
| 144 LoadStatusType m_status; | 144 LoadStatusType m_status; |
| 145 Member<DOMException> m_error; | 145 Member<DOMException> m_error; |
| 146 | 146 |
| 147 Member<LoadedProperty> m_loadedProperty; | 147 Member<LoadedProperty> m_loadedProperty; |
| 148 Member<CSSFontFace> m_cssFontFace; | 148 Member<CSSFontFace> m_cssFontFace; |
| 149 HeapVector<Member<LoadFontCallback>> m_callbacks; | 149 HeapVector<Member<LoadFontCallback>> m_callbacks; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 using FontFaceArray = HeapVector<Member<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 |