OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2006, 2007, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2007, 2011 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } else if (string.is8Bit()) { | 137 } else if (string.is8Bit()) { |
138 m_data.characters8 = string.characters8(); | 138 m_data.characters8 = string.characters8(); |
139 m_is8Bit = true; | 139 m_is8Bit = true; |
140 } else { | 140 } else { |
141 m_data.characters16 = string.characters16(); | 141 m_data.characters16 = string.characters16(); |
142 m_is8Bit = false; | 142 m_is8Bit = false; |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 TextRun subRun(unsigned startOffset, unsigned length) const { | 146 TextRun subRun(unsigned startOffset, unsigned length) const { |
147 ASSERT(startOffset < m_len); | 147 DCHECK_LT(startOffset, m_len); |
148 | 148 |
149 TextRun result = *this; | 149 TextRun result = *this; |
150 | 150 |
151 if (is8Bit()) { | 151 if (is8Bit()) { |
152 result.setText(data8(startOffset), length); | 152 result.setText(data8(startOffset), length); |
153 return result; | 153 return result; |
154 } | 154 } |
155 result.setText(data16(startOffset), length); | 155 result.setText(data16(startOffset), length); |
156 return result; | 156 return result; |
157 } | 157 } |
158 | 158 |
159 UChar operator[](unsigned i) const { | 159 UChar operator[](unsigned i) const { |
160 SECURITY_DCHECK(i < m_len); | 160 SECURITY_DCHECK(i < m_len); |
161 return is8Bit() ? m_data.characters8[i] : m_data.characters16[i]; | 161 return is8Bit() ? m_data.characters8[i] : m_data.characters16[i]; |
162 } | 162 } |
163 const LChar* data8(unsigned i) const { | 163 const LChar* data8(unsigned i) const { |
164 SECURITY_DCHECK(i < m_len); | 164 SECURITY_DCHECK(i < m_len); |
165 ASSERT(is8Bit()); | 165 DCHECK(is8Bit()); |
166 return &m_data.characters8[i]; | 166 return &m_data.characters8[i]; |
167 } | 167 } |
168 const UChar* data16(unsigned i) const { | 168 const UChar* data16(unsigned i) const { |
169 SECURITY_DCHECK(i < m_len); | 169 SECURITY_DCHECK(i < m_len); |
170 ASSERT(!is8Bit()); | 170 DCHECK(!is8Bit()); |
171 return &m_data.characters16[i]; | 171 return &m_data.characters16[i]; |
172 } | 172 } |
173 | 173 |
174 const LChar* characters8() const { | 174 const LChar* characters8() const { |
175 ASSERT(is8Bit()); | 175 DCHECK(is8Bit()); |
176 return m_data.characters8; | 176 return m_data.characters8; |
177 } | 177 } |
178 const UChar* characters16() const { | 178 const UChar* characters16() const { |
179 ASSERT(!is8Bit()); | 179 DCHECK(!is8Bit()); |
180 return m_data.characters16; | 180 return m_data.characters16; |
181 } | 181 } |
182 | 182 |
183 UChar32 codepointAt(unsigned i) const { | 183 UChar32 codepointAt(unsigned i) const { |
184 SECURITY_DCHECK(i < m_len); | 184 SECURITY_DCHECK(i < m_len); |
185 if (is8Bit()) | 185 if (is8Bit()) |
186 return (*this)[i]; | 186 return (*this)[i]; |
187 UChar32 codepoint; | 187 UChar32 codepoint; |
188 U16_GET(characters16(), 0, i, m_len, codepoint); | 188 U16_GET(characters16(), 0, i, m_len, codepoint); |
189 return codepoint; | 189 return codepoint; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 : run(r), from(0), to(r.length()) {} | 315 : run(r), from(0), to(r.length()) {} |
316 | 316 |
317 const TextRun& run; | 317 const TextRun& run; |
318 unsigned from; | 318 unsigned from; |
319 unsigned to; | 319 unsigned to; |
320 FloatRect bounds; | 320 FloatRect bounds; |
321 }; | 321 }; |
322 | 322 |
323 } // namespace blink | 323 } // namespace blink |
324 #endif | 324 #endif |
OLD | NEW |