Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/UnicodeRangeSet.h

Issue 1806363002: Revert of Shape unicode-range: font faces in only one iteration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef UnicodeRangeSet_h 26 #ifndef UnicodeRangeSet_h
27 #define UnicodeRangeSet_h 27 #define UnicodeRangeSet_h
28 28
29 #include "platform/PlatformExport.h" 29 #include "platform/PlatformExport.h"
30 #include "platform/fonts/FontDataRange.h"
30 #include "wtf/Allocator.h" 31 #include "wtf/Allocator.h"
31 #include "wtf/RefCounted.h"
32 #include "wtf/Vector.h"
33 #include "wtf/text/CharacterNames.h"
34 #include "wtf/text/Unicode.h" 32 #include "wtf/text/Unicode.h"
35 #include "wtf/text/WTFString.h"
36 33
37 namespace blink { 34 namespace blink {
38 35
39 struct PLATFORM_EXPORT UnicodeRange final { 36 struct PLATFORM_EXPORT UnicodeRange {
40 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 37 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
41 UnicodeRange(UChar32 from, UChar32 to) 38 UnicodeRange(UChar32 from, UChar32 to)
42 : m_from(from) 39 : m_from(from)
43 , m_to(to) 40 , m_to(to)
44 { 41 {
45 } 42 }
46 43
47 UChar32 from() const { return m_from; } 44 UChar32 from() const { return m_from; }
48 UChar32 to() const { return m_to; } 45 UChar32 to() const { return m_to; }
49 bool contains(UChar32 c) const { return m_from <= c && c <= m_to; } 46 bool contains(UChar32 c) const { return m_from <= c && c <= m_to; }
50 bool operator<(const UnicodeRange& other) const 47 bool operator<(const UnicodeRange& other) const
51 { 48 {
52 return m_from < other.m_from; 49 return m_from < other.m_from;
53 } 50 }
54 bool operator<(UChar32 c) const { return m_to < c; } 51 bool operator<(UChar32 c) const { return m_to < c; }
55 bool operator==(const UnicodeRange& other) const 52 bool operator==(const FontDataRange& fontDataRange) const
56 { 53 {
57 return other.m_from == m_from && other.m_to == m_to; 54 return fontDataRange.from() == m_from
55 && fontDataRange.to() == m_to;
58 }; 56 };
59 57
60 private: 58 private:
61 UChar32 m_from; 59 UChar32 m_from;
62 UChar32 m_to; 60 UChar32 m_to;
63 }; 61 };
64 62
65 class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted<UnicodeRangeSet> { 63 class PLATFORM_EXPORT UnicodeRangeSet {
64 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
65
66 public: 66 public:
67 explicit UnicodeRangeSet(const Vector<UnicodeRange>&); 67 explicit UnicodeRangeSet(const Vector<UnicodeRange>&);
68 UnicodeRangeSet() { };
69 bool contains(UChar32) const; 68 bool contains(UChar32) const;
69 bool contains(const FontDataRange&) const;
70 bool intersectsWith(const String&) const; 70 bool intersectsWith(const String&) const;
71 bool isEntireRange() const { return m_ranges.isEmpty(); } 71 bool isEntireRange() const { return m_ranges.isEmpty(); }
72 size_t size() const { return m_ranges.size(); } 72 size_t size() const { return m_ranges.size(); }
73 const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; } 73 const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; }
74 bool operator==(const UnicodeRangeSet& other) const;
75
76 private: 74 private:
77 Vector<UnicodeRange> m_ranges; // If empty, represents the whole code space. 75 Vector<UnicodeRange> m_ranges; // If empty, represents the whole code space.
78 }; 76 };
79 77
80 } // namespace blink 78 } // namespace blink
81 79
82 #endif 80 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698