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

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

Issue 2007103003: Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo for length access. 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 , m_direction(direction) 94 , m_direction(direction)
95 , m_directionalOverride(directionalOverride) 95 , m_directionalOverride(directionalOverride)
96 , m_disableSpacing(false) 96 , m_disableSpacing(false)
97 , m_textJustify(TextJustifyAuto) 97 , m_textJustify(TextJustifyAuto)
98 , m_normalizeSpace(false) 98 , m_normalizeSpace(false)
99 , m_tabSize(0) 99 , m_tabSize(0)
100 { 100 {
101 m_data.characters16 = c; 101 m_data.characters16 = c;
102 } 102 }
103 103
104 TextRun(const String& string, float xpos = 0, float expansion = 0, Expansion Behavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, Te xtDirection direction = LTR, bool directionalOverride = false)
105 : m_charactersLength(string.length())
106 , m_len(string.length())
107 , m_xpos(xpos)
108 , m_horizontalGlyphStretch(1)
109 , m_expansion(expansion)
110 , m_expansionBehavior(expansionBehavior)
111 , m_allowTabs(false)
112 , m_direction(direction)
113 , m_directionalOverride(directionalOverride)
114 , m_disableSpacing(false)
115 , m_textJustify(TextJustifyAuto)
116 , m_normalizeSpace(false)
117 , m_tabSize(0)
118 {
119 if (!m_charactersLength) {
120 m_is8Bit = true;
121 m_data.characters8 = 0;
122 } else if (string.is8Bit()) {
123 m_data.characters8 = string.characters8();
124 m_is8Bit = true;
125 } else {
126 m_data.characters16 = string.characters16();
127 m_is8Bit = false;
128 }
129 }
130
131 TextRun(const StringView& string, float xpos = 0, float expansion = 0, Expan sionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion , TextDirection direction = LTR, bool directionalOverride = false) 104 TextRun(const StringView& string, float xpos = 0, float expansion = 0, Expan sionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion , TextDirection direction = LTR, bool directionalOverride = false)
132 : m_charactersLength(string.length()) 105 : m_charactersLength(string.length())
133 , m_len(string.length()) 106 , m_len(string.length())
134 , m_xpos(xpos) 107 , m_xpos(xpos)
135 , m_horizontalGlyphStretch(1) 108 , m_horizontalGlyphStretch(1)
136 , m_expansion(expansion) 109 , m_expansion(expansion)
137 , m_expansionBehavior(expansionBehavior) 110 , m_expansionBehavior(expansionBehavior)
138 , m_allowTabs(false) 111 , m_allowTabs(false)
139 , m_direction(direction) 112 , m_direction(direction)
140 , m_directionalOverride(directionalOverride) 113 , m_directionalOverride(directionalOverride)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 233
261 const TextRun& run; 234 const TextRun& run;
262 int from; 235 int from;
263 int to; 236 int to;
264 FloatRect bounds; 237 FloatRect bounds;
265 RefPtr<const SkTextBlob>* cachedTextBlob; 238 RefPtr<const SkTextBlob>* cachedTextBlob;
266 }; 239 };
267 240
268 } // namespace blink 241 } // namespace blink
269 #endif 242 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698