| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class CSSFontFace; | 41 class CSSFontFace; |
| 42 class CSSFontSelector; | 42 class CSSFontSelector; |
| 43 class FontData; | 43 class FontData; |
| 44 class FontDescription; | 44 class FontDescription; |
| 45 class FontFace; | 45 class FontFace; |
| 46 class SegmentedFontData; | 46 class SegmentedFontData; |
| 47 | 47 |
| 48 class CSSSegmentedFontFace final : public RefCountedWillBeGarbageCollectedFinali
zed<CSSSegmentedFontFace> { | 48 class CSSSegmentedFontFace final : public GarbageCollectedFinalized<CSSSegmented
FontFace> { |
| 49 public: | 49 public: |
| 50 static PassRefPtrWillBeRawPtr<CSSSegmentedFontFace> create(CSSFontSelector*
selector, FontTraits traits) | 50 static RawPtr<CSSSegmentedFontFace> create(CSSFontSelector* selector, FontTr
aits traits) |
| 51 { | 51 { |
| 52 return adoptRefWillBeNoop(new CSSSegmentedFontFace(selector, traits)); | 52 return (new CSSSegmentedFontFace(selector, traits)); |
| 53 } | 53 } |
| 54 ~CSSSegmentedFontFace(); | 54 ~CSSSegmentedFontFace(); |
| 55 | 55 |
| 56 CSSFontSelector* fontSelector() const { return m_fontSelector; } | 56 CSSFontSelector* fontSelector() const { return m_fontSelector; } |
| 57 FontTraits traits() const { return m_traits; } | 57 FontTraits traits() const { return m_traits; } |
| 58 | 58 |
| 59 // Called when status of a FontFace has changed (e.g. loaded or timed out) | 59 // Called when status of a FontFace has changed (e.g. loaded or timed out) |
| 60 // so cached FontData must be discarded. | 60 // so cached FontData must be discarded. |
| 61 void fontFaceInvalidated(); | 61 void fontFaceInvalidated(); |
| 62 | 62 |
| 63 void addFontFace(PassRefPtrWillBeRawPtr<FontFace>, bool cssConnected); | 63 void addFontFace(RawPtr<FontFace>, bool cssConnected); |
| 64 void removeFontFace(PassRefPtrWillBeRawPtr<FontFace>); | 64 void removeFontFace(RawPtr<FontFace>); |
| 65 bool isEmpty() const { return m_fontFaces.isEmpty(); } | 65 bool isEmpty() const { return m_fontFaces.isEmpty(); } |
| 66 | 66 |
| 67 PassRefPtr<FontData> getFontData(const FontDescription&); | 67 PassRefPtr<FontData> getFontData(const FontDescription&); |
| 68 | 68 |
| 69 bool checkFont(const String&) const; | 69 bool checkFont(const String&) const; |
| 70 void match(const String&, WillBeHeapVector<RefPtrWillBeMember<FontFace>>&) c
onst; | 70 void match(const String&, HeapVector<Member<FontFace>>&) const; |
| 71 void willUseFontData(const FontDescription&, UChar32); | 71 void willUseFontData(const FontDescription&, UChar32); |
| 72 void willUseRange(const FontDescription&, const FontDataRange&); | 72 void willUseRange(const FontDescription&, const FontDataRange&); |
| 73 | 73 |
| 74 DECLARE_TRACE(); | 74 DECLARE_TRACE(); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 CSSSegmentedFontFace(CSSFontSelector*, FontTraits); | 77 CSSSegmentedFontFace(CSSFontSelector*, FontTraits); |
| 78 | 78 |
| 79 void pruneTable(); | 79 void pruneTable(); |
| 80 bool isValid() const; | 80 bool isValid() const; |
| 81 | 81 |
| 82 using FontFaceList = WillBeHeapListHashSet<RefPtrWillBeMember<FontFace>>; | 82 using FontFaceList = HeapListHashSet<Member<FontFace>>; |
| 83 | 83 |
| 84 RawPtrWillBeMember<CSSFontSelector> m_fontSelector; | 84 Member<CSSFontSelector> m_fontSelector; |
| 85 FontTraits m_traits; | 85 FontTraits m_traits; |
| 86 HashMap<unsigned, RefPtr<SegmentedFontData>> m_fontDataTable; | 86 HashMap<unsigned, RefPtr<SegmentedFontData>> m_fontDataTable; |
| 87 // All non-CSS-connected FontFaces are stored after the CSS-connected ones. | 87 // All non-CSS-connected FontFaces are stored after the CSS-connected ones. |
| 88 FontFaceList m_fontFaces; | 88 FontFaceList m_fontFaces; |
| 89 FontFaceList::iterator m_firstNonCssConnectedFace; | 89 FontFaceList::iterator m_firstNonCssConnectedFace; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| 93 | 93 |
| 94 #endif // CSSSegmentedFontFace_h | 94 #endif // CSSSegmentedFontFace_h |
| OLD | NEW |