| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 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 18 matching lines...) Expand all Loading... |
| 29 #include "platform/fonts/FontData.h" | 29 #include "platform/fonts/FontData.h" |
| 30 #include "platform/fonts/SimpleFontData.h" | 30 #include "platform/fonts/SimpleFontData.h" |
| 31 #include "platform/fonts/UnicodeRangeSet.h" | 31 #include "platform/fonts/UnicodeRangeSet.h" |
| 32 #include "wtf/Allocator.h" | 32 #include "wtf/Allocator.h" |
| 33 #include "wtf/text/CharacterNames.h" | 33 #include "wtf/text/CharacterNames.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class SimpleFontData; | 37 class SimpleFontData; |
| 38 | 38 |
| 39 class FontDataForRangeSet final { | 39 class PLATFORM_EXPORT FontDataForRangeSet : public RefCounted<FontDataForRangeSe
t> { |
| 40 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 40 public: |
| 41 | |
| 42 explicit FontDataForRangeSet(PassRefPtr<SimpleFontData> fontData = nullptr,
PassRefPtr<UnicodeRangeSet> rangeSet = nullptr) | 41 explicit FontDataForRangeSet(PassRefPtr<SimpleFontData> fontData = nullptr,
PassRefPtr<UnicodeRangeSet> rangeSet = nullptr) |
| 43 : m_fontData(fontData) | 42 : m_fontData(fontData) |
| 44 , m_rangeSet(rangeSet) | 43 , m_rangeSet(rangeSet) |
| 45 { | 44 { |
| 46 } | 45 } |
| 47 | 46 |
| 48 // Shorthand for GlyphPageTreeNode tests. | 47 // Shorthand for GlyphPageTreeNode tests. |
| 49 explicit FontDataForRangeSet(PassRefPtr<SimpleFontData> fontData, UChar32 fr
om, UChar32 to) | 48 explicit FontDataForRangeSet(PassRefPtr<SimpleFontData> fontData, UChar32 fr
om, UChar32 to) |
| 50 : m_fontData(fontData) | 49 : m_fontData(fontData) |
| 51 { | 50 { |
| 52 UnicodeRange range(from, to); | 51 UnicodeRange range(from, to); |
| 53 Vector<UnicodeRange> rangeVector; | 52 Vector<UnicodeRange> rangeVector; |
| 54 rangeVector.append(range); | 53 rangeVector.append(range); |
| 55 m_rangeSet = adoptRef(new UnicodeRangeSet(rangeVector)); | 54 m_rangeSet = adoptRef(new UnicodeRangeSet(rangeVector)); |
| 56 } | 55 } |
| 57 | 56 |
| 57 FontDataForRangeSet(const FontDataForRangeSet& other); |
| 58 |
| 59 virtual ~FontDataForRangeSet() { }; |
| 58 | 60 |
| 59 bool contains(UChar32 testChar) const { return m_rangeSet->contains(testChar
); } | 61 bool contains(UChar32 testChar) const { return m_rangeSet->contains(testChar
); } |
| 60 bool isEntireRange() const { return m_rangeSet->isEntireRange(); } | 62 bool isEntireRange() const { return m_rangeSet->isEntireRange(); } |
| 61 UnicodeRangeSet* ranges() const { return m_rangeSet.get(); } | 63 UnicodeRangeSet* ranges() const { return m_rangeSet.get(); } |
| 62 bool hasFontData() const { return m_fontData.get(); } | 64 bool hasFontData() const { return m_fontData.get(); } |
| 63 const SimpleFontData* fontData() const { return m_fontData.get(); } | 65 const SimpleFontData* fontData() const { return m_fontData.get(); } |
| 64 | 66 |
| 65 private: | 67 protected: |
| 66 RefPtr<SimpleFontData> m_fontData; | 68 RefPtr<SimpleFontData> m_fontData; |
| 67 RefPtr<UnicodeRangeSet> m_rangeSet; | 69 RefPtr<UnicodeRangeSet> m_rangeSet; |
| 68 }; | 70 }; |
| 69 | 71 |
| 72 class PLATFORM_EXPORT FontDataForRangeSetFromCache : public FontDataForRangeSet
{ |
| 73 public: |
| 74 explicit FontDataForRangeSetFromCache(PassRefPtr<SimpleFontData> fontData, |
| 75 PassRefPtr<UnicodeRangeSet> rangeSet = nullptr) |
| 76 : FontDataForRangeSet(fontData, rangeSet) |
| 77 { |
| 78 } |
| 79 virtual ~FontDataForRangeSetFromCache(); |
| 80 }; |
| 81 |
| 70 } // namespace blink | 82 } // namespace blink |
| 71 | 83 |
| 72 #endif | 84 #endif |
| OLD | NEW |