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

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

Issue 2018253002: Change TextRun's length() and charactersLength() to return an unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove one static_cast added in r396668 Created 4 years, 6 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 | « third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp ('k') | 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 UChar operator[](unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_ len); return is8Bit() ? m_data.characters8[i] :m_data.characters16[i]; } 172 UChar operator[](unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_ len); return is8Bit() ? m_data.characters8[i] :m_data.characters16[i]; }
173 const LChar* data8(unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); ASSERT(is8Bit()); return &m_data.characters8[i]; } 173 const LChar* data8(unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); ASSERT(is8Bit()); return &m_data.characters8[i]; }
174 const UChar* data16(unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); ASSERT(!is8Bit()); return &m_data.characters16[i]; } 174 const UChar* data16(unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); ASSERT(!is8Bit()); return &m_data.characters16[i]; }
175 175
176 const LChar* characters8() const { ASSERT(is8Bit()); return m_data.character s8; } 176 const LChar* characters8() const { ASSERT(is8Bit()); return m_data.character s8; }
177 const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.charact ers16; } 177 const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.charact ers16; }
178 178
179 bool is8Bit() const { return m_is8Bit; } 179 bool is8Bit() const { return m_is8Bit; }
180 int length() const { return m_len; } 180 unsigned length() const { return m_len; }
181 int charactersLength() const { return m_charactersLength; } 181 unsigned charactersLength() const { return m_charactersLength; }
182 182
183 bool normalizeSpace() const { return m_normalizeSpace; } 183 bool normalizeSpace() const { return m_normalizeSpace; }
184 void setNormalizeSpace(bool normalizeSpace) { m_normalizeSpace = normalizeSp ace; } 184 void setNormalizeSpace(bool normalizeSpace) { m_normalizeSpace = normalizeSp ace; }
185 185
186 void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;} 186 void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;}
187 void setText(const UChar* c, unsigned len) { m_data.characters16 = c; m_len = len; m_is8Bit = false;} 187 void setText(const UChar* c, unsigned len) { m_data.characters16 = c; m_len = len; m_is8Bit = false;}
188 void setText(const String&); 188 void setText(const String&);
189 void setCharactersLength(unsigned charactersLength) { m_charactersLength = c haractersLength; } 189 void setCharactersLength(unsigned charactersLength) { m_charactersLength = c haractersLength; }
190 190
191 void setExpansionBehavior(ExpansionBehavior behavior) { m_expansionBehavior = behavior; } 191 void setExpansionBehavior(ExpansionBehavior behavior) { m_expansionBehavior = behavior; }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 public: 252 public:
253 explicit TextRunPaintInfo(const TextRun& r) 253 explicit TextRunPaintInfo(const TextRun& r)
254 : run(r) 254 : run(r)
255 , from(0) 255 , from(0)
256 , to(r.length()) 256 , to(r.length())
257 , cachedTextBlob(nullptr) 257 , cachedTextBlob(nullptr)
258 { 258 {
259 } 259 }
260 260
261 const TextRun& run; 261 const TextRun& run;
262 int from; 262 unsigned from;
263 int to; 263 unsigned to;
264 FloatRect bounds; 264 FloatRect bounds;
265 RefPtr<const SkTextBlob>* cachedTextBlob; 265 RefPtr<const SkTextBlob>* cachedTextBlob;
266 }; 266 };
267 267
268 } // namespace blink 268 } // namespace blink
269 #endif 269 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698