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

Side by Side Diff: third_party/WebKit/Source/platform/text/TextRun.h

Issue 2691443002: Have codePointAt DCHECKS apply to 8bit strings too (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const LChar* characters8() const { 176 const LChar* characters8() const {
177 ASSERT(is8Bit()); 177 ASSERT(is8Bit());
178 return m_data.characters8; 178 return m_data.characters8;
179 } 179 }
180 const UChar* characters16() const { 180 const UChar* characters16() const {
181 ASSERT(!is8Bit()); 181 ASSERT(!is8Bit());
182 return m_data.characters16; 182 return m_data.characters16;
183 } 183 }
184 184
185 UChar32 codepointAt(unsigned i) const { 185 UChar32 codepointAt(unsigned i) const {
186 SECURITY_DCHECK(i < m_len);
186 if (is8Bit()) 187 if (is8Bit())
187 return (*this)[i]; 188 return (*this)[i];
188 UChar32 codepoint; 189 UChar32 codepoint;
189 SECURITY_DCHECK(i < m_len);
190 U16_GET(characters16(), 0, i, m_len, codepoint); 190 U16_GET(characters16(), 0, i, m_len, codepoint);
191 return codepoint; 191 return codepoint;
192 } 192 }
193 193
194 UChar32 codepointAtAndNext(unsigned& i) const { 194 UChar32 codepointAtAndNext(unsigned& i) const {
195 SECURITY_DCHECK(i < m_len);
195 if (is8Bit()) 196 if (is8Bit())
196 return (*this)[i++]; 197 return (*this)[i++];
197 UChar32 codepoint; 198 UChar32 codepoint;
198 SECURITY_DCHECK(i < m_len);
199 U16_NEXT(characters16(), i, m_len, codepoint); 199 U16_NEXT(characters16(), i, m_len, codepoint);
200 return codepoint; 200 return codepoint;
201 } 201 }
202 202
203 bool is8Bit() const { return m_is8Bit; } 203 bool is8Bit() const { return m_is8Bit; }
204 unsigned length() const { return m_len; } 204 unsigned length() const { return m_len; }
205 unsigned charactersLength() const { return m_charactersLength; } 205 unsigned charactersLength() const { return m_charactersLength; }
206 206
207 bool normalizeSpace() const { return m_normalizeSpace; } 207 bool normalizeSpace() const { return m_normalizeSpace; }
208 void setNormalizeSpace(bool normalizeSpace) { 208 void setNormalizeSpace(bool normalizeSpace) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 const TextRun& run; 319 const TextRun& run;
320 unsigned from; 320 unsigned from;
321 unsigned to; 321 unsigned to;
322 FloatRect bounds; 322 FloatRect bounds;
323 sk_sp<SkTextBlob>* cachedTextBlob; 323 sk_sp<SkTextBlob>* cachedTextBlob;
324 }; 324 };
325 325
326 } // namespace blink 326 } // namespace blink
327 #endif 327 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698