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

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

Issue 2924263003: [LayoutNG] Initial letter-spacing and word-spacing support (Closed)
Patch Set: Cleanup Created 3 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
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 UChar32 CodepointAtAndNext(unsigned& i) const { 186 UChar32 CodepointAtAndNext(unsigned& i) const {
187 SECURITY_DCHECK(i < len_); 187 SECURITY_DCHECK(i < len_);
188 if (Is8Bit()) 188 if (Is8Bit())
189 return (*this)[i++]; 189 return (*this)[i++];
190 UChar32 codepoint; 190 UChar32 codepoint;
191 U16_NEXT(Characters16(), i, len_, codepoint); 191 U16_NEXT(Characters16(), i, len_, codepoint);
192 return codepoint; 192 return codepoint;
193 } 193 }
194 194
195 const void* Bytes() const { return data_.bytes_; }
196
195 bool Is8Bit() const { return is8_bit_; } 197 bool Is8Bit() const { return is8_bit_; }
196 unsigned length() const { return len_; } 198 unsigned length() const { return len_; }
197 unsigned CharactersLength() const { return characters_length_; } 199 unsigned CharactersLength() const { return characters_length_; }
198 200
199 bool NormalizeSpace() const { return normalize_space_; } 201 bool NormalizeSpace() const { return normalize_space_; }
200 void SetNormalizeSpace(bool normalize_space) { 202 void SetNormalizeSpace(bool normalize_space) {
201 normalize_space_ = normalize_space; 203 normalize_space_ = normalize_space;
202 } 204 }
203 205
204 void SetText(const LChar* c, unsigned len) { 206 void SetText(const LChar* c, unsigned len) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 265
264 // Up-converts to UTF-16 as needed and normalizes spaces and Unicode control 266 // Up-converts to UTF-16 as needed and normalizes spaces and Unicode control
265 // characters as per the CSS Text Module Level 3 specification. 267 // characters as per the CSS Text Module Level 3 specification.
266 // https://drafts.csswg.org/css-text-3/#white-space-processing 268 // https://drafts.csswg.org/css-text-3/#white-space-processing
267 std::unique_ptr<UChar[]> NormalizedUTF16(unsigned* result_length) const; 269 std::unique_ptr<UChar[]> NormalizedUTF16(unsigned* result_length) const;
268 270
269 private: 271 private:
270 union { 272 union {
271 const LChar* characters8; 273 const LChar* characters8;
272 const UChar* characters16; 274 const UChar* characters16;
275 const void* bytes_;
273 } data_; 276 } data_;
274 // Marks the end of the characters buffer. Default equals to m_len. 277 // Marks the end of the characters buffer. Default equals to m_len.
275 unsigned characters_length_; 278 unsigned characters_length_;
276 unsigned len_; 279 unsigned len_;
277 280
278 // m_xpos is the x position relative to the left start of the text line, not 281 // m_xpos is the x position relative to the left start of the text line, not
279 // relative to the left start of the containing block. In the case of right 282 // relative to the left start of the containing block. In the case of right
280 // alignment or center alignment, left start of the text line is not the same 283 // alignment or center alignment, left start of the text line is not the same
281 // as left start of the containing block. 284 // as left start of the containing block.
282 float xpos_; 285 float xpos_;
(...skipping 26 matching lines...) Expand all
309 : run(r), from(0), to(r.length()) {} 312 : run(r), from(0), to(r.length()) {}
310 313
311 const TextRun& run; 314 const TextRun& run;
312 unsigned from; 315 unsigned from;
313 unsigned to; 316 unsigned to;
314 FloatRect bounds; 317 FloatRect bounds;
315 }; 318 };
316 319
317 } // namespace blink 320 } // namespace blink
318 #endif 321 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698