OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2009, 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 FontFaceCreationParams(CString filename, | 72 FontFaceCreationParams(CString filename, |
73 int fontconfigInterfaceId, | 73 int fontconfigInterfaceId, |
74 int ttcIndex = 0) | 74 int ttcIndex = 0) |
75 : m_creationType(CreateFontByFciIdAndTtcIndex), | 75 : m_creationType(CreateFontByFciIdAndTtcIndex), |
76 m_filename(filename), | 76 m_filename(filename), |
77 m_fontconfigInterfaceId(fontconfigInterfaceId), | 77 m_fontconfigInterfaceId(fontconfigInterfaceId), |
78 m_ttcIndex(ttcIndex) {} | 78 m_ttcIndex(ttcIndex) {} |
79 | 79 |
80 FontFaceCreationType creationType() const { return m_creationType; } | 80 FontFaceCreationType creationType() const { return m_creationType; } |
81 AtomicString family() const { | 81 AtomicString family() const { |
82 ASSERT(m_creationType == CreateFontByFamily); | 82 DCHECK_EQ(m_creationType, CreateFontByFamily); |
83 return m_family; | 83 return m_family; |
84 } | 84 } |
85 CString filename() const { | 85 CString filename() const { |
86 ASSERT(m_creationType == CreateFontByFciIdAndTtcIndex); | 86 DCHECK_EQ(m_creationType, CreateFontByFciIdAndTtcIndex); |
87 return m_filename; | 87 return m_filename; |
88 } | 88 } |
89 int fontconfigInterfaceId() const { | 89 int fontconfigInterfaceId() const { |
90 ASSERT(m_creationType == CreateFontByFciIdAndTtcIndex); | 90 DCHECK_EQ(m_creationType, CreateFontByFciIdAndTtcIndex); |
91 return m_fontconfigInterfaceId; | 91 return m_fontconfigInterfaceId; |
92 } | 92 } |
93 int ttcIndex() const { | 93 int ttcIndex() const { |
94 ASSERT(m_creationType == CreateFontByFciIdAndTtcIndex); | 94 DCHECK_EQ(m_creationType, CreateFontByFciIdAndTtcIndex); |
95 return m_ttcIndex; | 95 return m_ttcIndex; |
96 } | 96 } |
97 | 97 |
98 unsigned hash() const { | 98 unsigned hash() const { |
99 if (m_creationType == CreateFontByFciIdAndTtcIndex) { | 99 if (m_creationType == CreateFontByFciIdAndTtcIndex) { |
100 StringHasher hasher; | 100 StringHasher hasher; |
101 // Hashing the filename and ints in this way is sensitive to character | 101 // Hashing the filename and ints in this way is sensitive to character |
102 // encoding and endianness. However, since the hash is not transferred | 102 // encoding and endianness. However, since the hash is not transferred |
103 // over a network or permanently stored and only used for the runtime of | 103 // over a network or permanently stored and only used for the runtime of |
104 // Chromium, this is not a concern. | 104 // Chromium, this is not a concern. |
(...skipping 21 matching lines...) Expand all Loading... |
126 FontFaceCreationType m_creationType; | 126 FontFaceCreationType m_creationType; |
127 AtomicString m_family; | 127 AtomicString m_family; |
128 CString m_filename; | 128 CString m_filename; |
129 int m_fontconfigInterfaceId; | 129 int m_fontconfigInterfaceId; |
130 int m_ttcIndex; | 130 int m_ttcIndex; |
131 }; | 131 }; |
132 | 132 |
133 } // namespace blink | 133 } // namespace blink |
134 | 134 |
135 #endif // FontFaceCreationParams_h | 135 #endif // FontFaceCreationParams_h |
OLD | NEW |