| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 class CSSFontFace; | 43 class CSSFontFace; |
| 44 class CSSValueList; | 44 class CSSValueList; |
| 45 class Dictionary; | 45 class Dictionary; |
| 46 class Document; | 46 class Document; |
| 47 class ExceptionState; | 47 class ExceptionState; |
| 48 class FontFaceReadyPromiseResolver; | 48 class FontFaceReadyPromiseResolver; |
| 49 class StylePropertySet; | 49 class StylePropertySet; |
| 50 class StyleRuleFontFace; | 50 class StyleRuleFontFace; |
| 51 | 51 |
| 52 class FontFace : public RefCounted<FontFace> { | 52 class FontFace : public RefCountedWillBeRefCountedGarbageCollected<FontFace> { |
| 53 DECLARE_GC_INFO; |
| 53 public: | 54 public: |
| 54 enum LoadStatus { Unloaded, Loading, Loaded, Error }; | 55 enum LoadStatus { Unloaded, Loading, Loaded, Error }; |
| 55 | 56 |
| 56 static PassRefPtr<FontFace> create(ExecutionContext*, const AtomicString& fa
mily, const String& source, const Dictionary&, ExceptionState&); | 57 static PassRefPtr<FontFace> create(ExecutionContext*, const AtomicString& fa
mily, const String& source, const Dictionary&, ExceptionState&); |
| 57 static PassRefPtr<FontFace> create(Document*, const StyleRuleFontFace*); | 58 static PassRefPtr<FontFace> create(Document*, const StyleRuleFontFace*); |
| 58 | 59 |
| 59 ~FontFace(); | 60 ~FontFace(); |
| 60 | 61 |
| 61 const AtomicString& family() const { return m_family; } | 62 const AtomicString& family() const { return m_family; } |
| 62 String style() const; | 63 String style() const; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 78 String status() const; | 79 String status() const; |
| 79 | 80 |
| 80 void load(ExecutionContext*); | 81 void load(ExecutionContext*); |
| 81 ScriptPromise ready(ExecutionContext*); | 82 ScriptPromise ready(ExecutionContext*); |
| 82 | 83 |
| 83 LoadStatus loadStatus() const { return m_status; } | 84 LoadStatus loadStatus() const { return m_status; } |
| 84 void setLoadStatus(LoadStatus); | 85 void setLoadStatus(LoadStatus); |
| 85 unsigned traitsMask() const; | 86 unsigned traitsMask() const; |
| 86 CSSFontFace* cssFontFace() { return m_cssFontFace.get(); } | 87 CSSFontFace* cssFontFace() { return m_cssFontFace.get(); } |
| 87 | 88 |
| 89 void trace(Visitor*); |
| 90 |
| 88 private: | 91 private: |
| 89 FontFace(PassRefPtrWillBeRawPtr<CSSValue> source); | 92 FontFace(PassRefPtrWillBeRawPtr<CSSValue> source); |
| 90 | 93 |
| 91 void initCSSFontFace(Document*); | 94 void initCSSFontFace(Document*); |
| 92 void setPropertyFromString(const Document*, const String&, CSSPropertyID, Ex
ceptionState&); | 95 void setPropertyFromString(const Document*, const String&, CSSPropertyID, Ex
ceptionState&); |
| 93 bool setPropertyFromStyle(const StylePropertySet*, CSSPropertyID); | 96 bool setPropertyFromStyle(const StylePropertySet*, CSSPropertyID); |
| 94 bool setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue>, CSSPropertyID); | 97 bool setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue>, CSSPropertyID); |
| 95 bool setFamilyValue(CSSValueList*); | 98 bool setFamilyValue(CSSValueList*); |
| 96 void resolveReadyPromises(); | 99 void resolveReadyPromises(); |
| 97 | 100 |
| 98 AtomicString m_family; | 101 AtomicString m_family; |
| 99 RefPtr<CSSValue> m_src; | 102 RefPtrWillBeMember<CSSValue> m_src; |
| 100 RefPtr<CSSValue> m_style; | 103 RefPtrWillBeMember<CSSValue> m_style; |
| 101 RefPtr<CSSValue> m_weight; | 104 RefPtrWillBeMember<CSSValue> m_weight; |
| 102 RefPtr<CSSValue> m_stretch; | 105 RefPtrWillBeMember<CSSValue> m_stretch; |
| 103 RefPtr<CSSValue> m_unicodeRange; | 106 RefPtrWillBeMember<CSSValue> m_unicodeRange; |
| 104 RefPtr<CSSValue> m_variant; | 107 RefPtrWillBeMember<CSSValue> m_variant; |
| 105 RefPtr<CSSValue> m_featureSettings; | 108 RefPtrWillBeMember<CSSValue> m_featureSettings; |
| 106 LoadStatus m_status; | 109 LoadStatus m_status; |
| 107 | 110 |
| 108 Vector<OwnPtr<FontFaceReadyPromiseResolver> > m_readyResolvers; | 111 Vector<OwnPtr<FontFaceReadyPromiseResolver> > m_readyResolvers; |
| 109 OwnPtr<CSSFontFace> m_cssFontFace; | 112 OwnPtr<CSSFontFace> m_cssFontFace; |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 typedef Vector<RefPtr<FontFace> > FontFaceArray; | 115 typedef Vector<RefPtr<FontFace> > FontFaceArray; |
| 113 | 116 |
| 114 } // namespace WebCore | 117 } // namespace WebCore |
| 115 | 118 |
| 116 #endif // FontFace_h | 119 #endif // FontFace_h |
| OLD | NEW |