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 data_.characters8 = string.Characters8(); | 138 data_.characters8 = string.Characters8(); |
139 is8_bit_ = true; | 139 is8_bit_ = true; |
140 } else { | 140 } else { |
141 data_.characters16 = string.Characters16(); | 141 data_.characters16 = string.Characters16(); |
142 is8_bit_ = false; | 142 is8_bit_ = false; |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 TextRun SubRun(unsigned start_offset, unsigned length) const { | 146 TextRun SubRun(unsigned start_offset, unsigned length) const { |
147 ASSERT(start_offset < len_); | 147 DCHECK_LT(start_offset, len_); |
148 | 148 |
149 TextRun result = *this; | 149 TextRun result = *this; |
150 | 150 |
151 if (Is8Bit()) { | 151 if (Is8Bit()) { |
152 result.SetText(Data8(start_offset), length); | 152 result.SetText(Data8(start_offset), length); |
153 return result; | 153 return result; |
154 } | 154 } |
155 result.SetText(Data16(start_offset), length); | 155 result.SetText(Data16(start_offset), 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 < len_); | 160 SECURITY_DCHECK(i < len_); |
161 return Is8Bit() ? data_.characters8[i] : data_.characters16[i]; | 161 return Is8Bit() ? data_.characters8[i] : data_.characters16[i]; |
162 } | 162 } |
163 const LChar* Data8(unsigned i) const { | 163 const LChar* Data8(unsigned i) const { |
164 SECURITY_DCHECK(i < len_); | 164 SECURITY_DCHECK(i < len_); |
165 ASSERT(Is8Bit()); | 165 DCHECK(Is8Bit()); |
166 return &data_.characters8[i]; | 166 return &data_.characters8[i]; |
167 } | 167 } |
168 const UChar* Data16(unsigned i) const { | 168 const UChar* Data16(unsigned i) const { |
169 SECURITY_DCHECK(i < len_); | 169 SECURITY_DCHECK(i < len_); |
170 ASSERT(!Is8Bit()); | 170 DCHECK(!Is8Bit()); |
171 return &data_.characters16[i]; | 171 return &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 data_.characters8; | 176 return data_.characters8; |
177 } | 177 } |
178 const UChar* Characters16() const { | 178 const UChar* Characters16() const { |
179 ASSERT(!Is8Bit()); | 179 DCHECK(!Is8Bit()); |
180 return data_.characters16; | 180 return data_.characters16; |
181 } | 181 } |
182 | 182 |
183 UChar32 CodepointAt(unsigned i) const { | 183 UChar32 CodepointAt(unsigned i) const { |
184 SECURITY_DCHECK(i < len_); | 184 SECURITY_DCHECK(i < 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, len_, codepoint); | 188 U16_GET(Characters16(), 0, i, 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 |