| 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 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 RefCounted<FontFace> { |
| 53 public: | 53 public: |
| 54 enum LoadStatus { Unloaded, Loading, Loaded, Error }; | 54 enum LoadStatus { Unloaded, Loading, Loaded, Error }; |
| 55 | 55 |
| 56 static PassRefPtr<FontFace> create(const String& family, const String& sourc
e, const Dictionary&, ExceptionState&); | 56 static PassRefPtr<FontFace> create(const AtomicString& family, const String&
source, const Dictionary&, ExceptionState&); |
| 57 static PassRefPtr<FontFace> create(const StyleRuleFontFace*); | 57 static PassRefPtr<FontFace> create(const StyleRuleFontFace*); |
| 58 | 58 |
| 59 ~FontFace(); | 59 ~FontFace(); |
| 60 | 60 |
| 61 String family() const { return m_family; } | 61 const AtomicString& family() const { return m_family; } |
| 62 String style() const; | 62 String style() const; |
| 63 String weight() const; | 63 String weight() const; |
| 64 String stretch() const; | 64 String stretch() const; |
| 65 String unicodeRange() const; | 65 String unicodeRange() const; |
| 66 String variant() const; | 66 String variant() const; |
| 67 String featureSettings() const; | 67 String featureSettings() const; |
| 68 | 68 |
| 69 // FIXME: Changing these attributes should affect font matching. | 69 // FIXME: Changing these attributes should affect font matching. |
| 70 void setFamily(const String& s, ExceptionState&) { m_family = s; } | 70 void setFamily(const AtomicString& s, ExceptionState&) { m_family = s; } |
| 71 void setStyle(const String&, ExceptionState&); | 71 void setStyle(const String&, ExceptionState&); |
| 72 void setWeight(const String&, ExceptionState&); | 72 void setWeight(const String&, ExceptionState&); |
| 73 void setStretch(const String&, ExceptionState&); | 73 void setStretch(const String&, ExceptionState&); |
| 74 void setUnicodeRange(const String&, ExceptionState&); | 74 void setUnicodeRange(const String&, ExceptionState&); |
| 75 void setVariant(const String&, ExceptionState&); | 75 void setVariant(const String&, ExceptionState&); |
| 76 void setFeatureSettings(const String&, ExceptionState&); | 76 void setFeatureSettings(const String&, ExceptionState&); |
| 77 | 77 |
| 78 String status() const; | 78 String status() const; |
| 79 | 79 |
| 80 void load(); | 80 void load(); |
| 81 ScriptPromise ready(ExecutionContext*); | 81 ScriptPromise ready(ExecutionContext*); |
| 82 | 82 |
| 83 LoadStatus loadStatus() const { return m_status; } | 83 LoadStatus loadStatus() const { return m_status; } |
| 84 void setLoadStatus(LoadStatus); | 84 void setLoadStatus(LoadStatus); |
| 85 unsigned traitsMask() const; | 85 unsigned traitsMask() const; |
| 86 PassRefPtr<CSSFontFace> createCSSFontFace(Document*); | 86 PassRefPtr<CSSFontFace> createCSSFontFace(Document*); |
| 87 void cssFontFaceDestroyed() { m_cssFontFace = 0; } | 87 void cssFontFaceDestroyed() { m_cssFontFace = 0; } |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 FontFace(PassRefPtr<CSSValue> source); | 90 FontFace(PassRefPtr<CSSValue> source); |
| 91 | 91 |
| 92 void setPropertyFromString(const String&, CSSPropertyID, ExceptionState&); | 92 void setPropertyFromString(const String&, CSSPropertyID, ExceptionState&); |
| 93 bool setPropertyFromStyle(const StylePropertySet*, CSSPropertyID); | 93 bool setPropertyFromStyle(const StylePropertySet*, CSSPropertyID); |
| 94 bool setPropertyValue(PassRefPtr<CSSValue>, CSSPropertyID); | 94 bool setPropertyValue(PassRefPtr<CSSValue>, CSSPropertyID); |
| 95 bool setFamilyValue(CSSValueList*); | 95 bool setFamilyValue(CSSValueList*); |
| 96 void resolveReadyPromises(); | 96 void resolveReadyPromises(); |
| 97 | 97 |
| 98 String m_family; | 98 AtomicString m_family; |
| 99 RefPtr<CSSValue> m_src; | 99 RefPtr<CSSValue> m_src; |
| 100 RefPtr<CSSValue> m_style; | 100 RefPtr<CSSValue> m_style; |
| 101 RefPtr<CSSValue> m_weight; | 101 RefPtr<CSSValue> m_weight; |
| 102 RefPtr<CSSValue> m_stretch; | 102 RefPtr<CSSValue> m_stretch; |
| 103 RefPtr<CSSValue> m_unicodeRange; | 103 RefPtr<CSSValue> m_unicodeRange; |
| 104 RefPtr<CSSValue> m_variant; | 104 RefPtr<CSSValue> m_variant; |
| 105 RefPtr<CSSValue> m_featureSettings; | 105 RefPtr<CSSValue> m_featureSettings; |
| 106 LoadStatus m_status; | 106 LoadStatus m_status; |
| 107 | 107 |
| 108 Vector<OwnPtr<FontFaceReadyPromiseResolver> > m_readyResolvers; | 108 Vector<OwnPtr<FontFaceReadyPromiseResolver> > m_readyResolvers; |
| 109 CSSFontFace* m_cssFontFace; | 109 CSSFontFace* m_cssFontFace; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 typedef Vector<RefPtr<FontFace> > FontFaceArray; | 112 typedef Vector<RefPtr<FontFace> > FontFaceArray; |
| 113 | 113 |
| 114 } // namespace WebCore | 114 } // namespace WebCore |
| 115 | 115 |
| 116 #endif // FontFace_h | 116 #endif // FontFace_h |
| OLD | NEW |