| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 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 24 matching lines...) Expand all Loading... |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class FontDescription; | 40 class FontDescription; |
| 41 class RemoteFontFaceSource; | 41 class RemoteFontFaceSource; |
| 42 class SimpleFontData; | 42 class SimpleFontData; |
| 43 | 43 |
| 44 class CORE_EXPORT CSSFontFace final : public NoBaseWillBeGarbageCollectedFinaliz
ed<CSSFontFace> { | 44 class CORE_EXPORT CSSFontFace final : public NoBaseWillBeGarbageCollectedFinaliz
ed<CSSFontFace> { |
| 45 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSFontFace); |
| 45 WTF_MAKE_NONCOPYABLE(CSSFontFace); | 46 WTF_MAKE_NONCOPYABLE(CSSFontFace); |
| 46 public: | 47 public: |
| 47 struct UnicodeRange; | 48 struct UnicodeRange; |
| 48 class UnicodeRangeSet; | 49 class UnicodeRangeSet; |
| 49 | 50 |
| 50 CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges) | 51 CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges) |
| 51 : m_ranges(ranges) | 52 : m_ranges(ranges) |
| 52 , m_segmentedFontFace(nullptr) | 53 , m_segmentedFontFace(nullptr) |
| 53 , m_fontFace(fontFace) | 54 , m_fontFace(fontFace) |
| 54 { | 55 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 void addSource(PassOwnPtrWillBeRawPtr<CSSFontFaceSource>); | 68 void addSource(PassOwnPtrWillBeRawPtr<CSSFontFaceSource>); |
| 68 | 69 |
| 69 void didBeginLoad(); | 70 void didBeginLoad(); |
| 70 void fontLoaded(RemoteFontFaceSource*); | 71 void fontLoaded(RemoteFontFaceSource*); |
| 71 void fontLoadWaitLimitExceeded(RemoteFontFaceSource*); | 72 void fontLoadWaitLimitExceeded(RemoteFontFaceSource*); |
| 72 | 73 |
| 73 PassRefPtr<SimpleFontData> getFontData(const FontDescription&); | 74 PassRefPtr<SimpleFontData> getFontData(const FontDescription&); |
| 74 | 75 |
| 75 struct UnicodeRange { | 76 struct UnicodeRange { |
| 77 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 76 UnicodeRange(UChar32 from, UChar32 to) | 78 UnicodeRange(UChar32 from, UChar32 to) |
| 77 : m_from(from) | 79 : m_from(from) |
| 78 , m_to(to) | 80 , m_to(to) |
| 79 { | 81 { |
| 80 } | 82 } |
| 81 | 83 |
| 82 UChar32 from() const { return m_from; } | 84 UChar32 from() const { return m_from; } |
| 83 UChar32 to() const { return m_to; } | 85 UChar32 to() const { return m_to; } |
| 84 bool contains(UChar32 c) const { return m_from <= c && c <= m_to; } | 86 bool contains(UChar32 c) const { return m_from <= c && c <= m_to; } |
| 85 bool operator<(const UnicodeRange& other) const { return m_from < other.
m_from; } | 87 bool operator<(const UnicodeRange& other) const { return m_from < other.
m_from; } |
| 86 bool operator<(UChar32 c) const { return m_to < c; } | 88 bool operator<(UChar32 c) const { return m_to < c; } |
| 87 | 89 |
| 88 private: | 90 private: |
| 89 UChar32 m_from; | 91 UChar32 m_from; |
| 90 UChar32 m_to; | 92 UChar32 m_to; |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 class CORE_EXPORT UnicodeRangeSet { | 95 class CORE_EXPORT UnicodeRangeSet { |
| 96 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 94 public: | 97 public: |
| 95 explicit UnicodeRangeSet(const Vector<UnicodeRange>&); | 98 explicit UnicodeRangeSet(const Vector<UnicodeRange>&); |
| 96 bool contains(UChar32) const; | 99 bool contains(UChar32) const; |
| 97 bool intersectsWith(const String&) const; | 100 bool intersectsWith(const String&) const; |
| 98 bool isEntireRange() const { return m_ranges.isEmpty(); } | 101 bool isEntireRange() const { return m_ranges.isEmpty(); } |
| 99 size_t size() const { return m_ranges.size(); } | 102 size_t size() const { return m_ranges.size(); } |
| 100 const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; } | 103 const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; } |
| 101 private: | 104 private: |
| 102 Vector<UnicodeRange> m_ranges; // If empty, represents the whole code sp
ace. | 105 Vector<UnicodeRange> m_ranges; // If empty, represents the whole code sp
ace. |
| 103 }; | 106 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 | 119 |
| 117 UnicodeRangeSet m_ranges; | 120 UnicodeRangeSet m_ranges; |
| 118 RawPtrWillBeMember<CSSSegmentedFontFace> m_segmentedFontFace; | 121 RawPtrWillBeMember<CSSSegmentedFontFace> m_segmentedFontFace; |
| 119 WillBeHeapDeque<OwnPtrWillBeMember<CSSFontFaceSource>> m_sources; | 122 WillBeHeapDeque<OwnPtrWillBeMember<CSSFontFaceSource>> m_sources; |
| 120 RawPtrWillBeMember<FontFace> m_fontFace; | 123 RawPtrWillBeMember<FontFace> m_fontFace; |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 } | 126 } |
| 124 | 127 |
| 125 #endif | 128 #endif |
| OLD | NEW |