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

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

Issue 2555923002: Changed TextDirection to an enum class and renamed its members (Closed)
Patch Set: Rebase after reopen Created 4 years 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 enum TextCodePath { Auto = 0, ForceSimple = 1, ForceComplex = 2 }; 62 enum TextCodePath { Auto = 0, ForceSimple = 1, ForceComplex = 2 };
63 63
64 typedef unsigned ExpansionBehavior; 64 typedef unsigned ExpansionBehavior;
65 65
66 TextRun(const LChar* c, 66 TextRun(const LChar* c,
67 unsigned len, 67 unsigned len,
68 float xpos = 0, 68 float xpos = 0,
69 float expansion = 0, 69 float expansion = 0,
70 ExpansionBehavior expansionBehavior = AllowTrailingExpansion | 70 ExpansionBehavior expansionBehavior = AllowTrailingExpansion |
71 ForbidLeadingExpansion, 71 ForbidLeadingExpansion,
72 TextDirection direction = LTR, 72 TextDirection direction = TextDirection::Ltr,
73 bool directionalOverride = false) 73 bool directionalOverride = false)
74 : m_charactersLength(len), 74 : m_charactersLength(len),
75 m_len(len), 75 m_len(len),
76 m_xpos(xpos), 76 m_xpos(xpos),
77 m_horizontalGlyphStretch(1), 77 m_horizontalGlyphStretch(1),
78 m_expansion(expansion), 78 m_expansion(expansion),
79 m_expansionBehavior(expansionBehavior), 79 m_expansionBehavior(expansionBehavior),
80 m_is8Bit(true), 80 m_is8Bit(true),
81 m_allowTabs(false), 81 m_allowTabs(false),
82 m_direction(direction), 82 m_direction(static_cast<unsigned>(direction)),
83 m_directionalOverride(directionalOverride), 83 m_directionalOverride(directionalOverride),
84 m_disableSpacing(false), 84 m_disableSpacing(false),
85 m_textJustify(TextJustifyAuto), 85 m_textJustify(TextJustifyAuto),
86 m_normalizeSpace(false), 86 m_normalizeSpace(false),
87 m_tabSize(0) { 87 m_tabSize(0) {
88 m_data.characters8 = c; 88 m_data.characters8 = c;
89 } 89 }
90 90
91 TextRun(const UChar* c, 91 TextRun(const UChar* c,
92 unsigned len, 92 unsigned len,
93 float xpos = 0, 93 float xpos = 0,
94 float expansion = 0, 94 float expansion = 0,
95 ExpansionBehavior expansionBehavior = AllowTrailingExpansion | 95 ExpansionBehavior expansionBehavior = AllowTrailingExpansion |
96 ForbidLeadingExpansion, 96 ForbidLeadingExpansion,
97 TextDirection direction = LTR, 97 TextDirection direction = TextDirection::Ltr,
98 bool directionalOverride = false) 98 bool directionalOverride = false)
99 : m_charactersLength(len), 99 : m_charactersLength(len),
100 m_len(len), 100 m_len(len),
101 m_xpos(xpos), 101 m_xpos(xpos),
102 m_horizontalGlyphStretch(1), 102 m_horizontalGlyphStretch(1),
103 m_expansion(expansion), 103 m_expansion(expansion),
104 m_expansionBehavior(expansionBehavior), 104 m_expansionBehavior(expansionBehavior),
105 m_is8Bit(false), 105 m_is8Bit(false),
106 m_allowTabs(false), 106 m_allowTabs(false),
107 m_direction(direction), 107 m_direction(static_cast<unsigned>(direction)),
108 m_directionalOverride(directionalOverride), 108 m_directionalOverride(directionalOverride),
109 m_disableSpacing(false), 109 m_disableSpacing(false),
110 m_textJustify(TextJustifyAuto), 110 m_textJustify(TextJustifyAuto),
111 m_normalizeSpace(false), 111 m_normalizeSpace(false),
112 m_tabSize(0) { 112 m_tabSize(0) {
113 m_data.characters16 = c; 113 m_data.characters16 = c;
114 } 114 }
115 115
116 TextRun(const StringView& string, 116 TextRun(const StringView& string,
117 float xpos = 0, 117 float xpos = 0,
118 float expansion = 0, 118 float expansion = 0,
119 ExpansionBehavior expansionBehavior = AllowTrailingExpansion | 119 ExpansionBehavior expansionBehavior = AllowTrailingExpansion |
120 ForbidLeadingExpansion, 120 ForbidLeadingExpansion,
121 TextDirection direction = LTR, 121 TextDirection direction = TextDirection::Ltr,
122 bool directionalOverride = false) 122 bool directionalOverride = false)
123 : m_charactersLength(string.length()), 123 : m_charactersLength(string.length()),
124 m_len(string.length()), 124 m_len(string.length()),
125 m_xpos(xpos), 125 m_xpos(xpos),
126 m_horizontalGlyphStretch(1), 126 m_horizontalGlyphStretch(1),
127 m_expansion(expansion), 127 m_expansion(expansion),
128 m_expansionBehavior(expansionBehavior), 128 m_expansionBehavior(expansionBehavior),
129 m_allowTabs(false), 129 m_allowTabs(false),
130 m_direction(direction), 130 m_direction(static_cast<unsigned>(direction)),
131 m_directionalOverride(directionalOverride), 131 m_directionalOverride(directionalOverride),
132 m_disableSpacing(false), 132 m_disableSpacing(false),
133 m_textJustify(TextJustifyAuto), 133 m_textJustify(TextJustifyAuto),
134 m_normalizeSpace(false), 134 m_normalizeSpace(false),
135 m_tabSize(0) { 135 m_tabSize(0) {
136 if (!m_charactersLength) { 136 if (!m_charactersLength) {
137 m_is8Bit = true; 137 m_is8Bit = true;
138 m_data.characters8 = 0; 138 m_data.characters8 = 0;
139 } else if (string.is8Bit()) { 139 } else if (string.is8Bit()) {
140 m_data.characters8 = string.characters8(); 140 m_data.characters8 = string.characters8();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void setExpansion(float expansion) { m_expansion = expansion; } 233 void setExpansion(float expansion) { m_expansion = expansion; }
234 bool allowsLeadingExpansion() const { 234 bool allowsLeadingExpansion() const {
235 return m_expansionBehavior & AllowLeadingExpansion; 235 return m_expansionBehavior & AllowLeadingExpansion;
236 } 236 }
237 bool allowsTrailingExpansion() const { 237 bool allowsTrailingExpansion() const {
238 return m_expansionBehavior & AllowTrailingExpansion; 238 return m_expansionBehavior & AllowTrailingExpansion;
239 } 239 }
240 TextDirection direction() const { 240 TextDirection direction() const {
241 return static_cast<TextDirection>(m_direction); 241 return static_cast<TextDirection>(m_direction);
242 } 242 }
243 bool rtl() const { return m_direction == RTL; } 243 bool rtl() const { return direction() == TextDirection::Rtl; }
244 bool ltr() const { return m_direction == LTR; } 244 bool ltr() const { return direction() == TextDirection::Ltr; }
245 bool directionalOverride() const { return m_directionalOverride; } 245 bool directionalOverride() const { return m_directionalOverride; }
246 bool spacingDisabled() const { return m_disableSpacing; } 246 bool spacingDisabled() const { return m_disableSpacing; }
247 247
248 void disableSpacing() { m_disableSpacing = true; } 248 void disableSpacing() { m_disableSpacing = true; }
249 void setDirection(TextDirection direction) { m_direction = direction; } 249 void setDirection(TextDirection direction) {
250 m_direction = static_cast<unsigned>(direction);
251 }
250 void setDirectionalOverride(bool override) { 252 void setDirectionalOverride(bool override) {
251 m_directionalOverride = override; 253 m_directionalOverride = override;
252 } 254 }
253 255
254 void setTextJustify(TextJustify textJustify) { 256 void setTextJustify(TextJustify textJustify) {
255 m_textJustify = static_cast<unsigned>(textJustify); 257 m_textJustify = static_cast<unsigned>(textJustify);
256 } 258 }
257 TextJustify getTextJustify() const { 259 TextJustify getTextJustify() const {
258 return static_cast<TextJustify>(m_textJustify); 260 return static_cast<TextJustify>(m_textJustify);
259 } 261 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 309
308 const TextRun& run; 310 const TextRun& run;
309 unsigned from; 311 unsigned from;
310 unsigned to; 312 unsigned to;
311 FloatRect bounds; 313 FloatRect bounds;
312 sk_sp<SkTextBlob>* cachedTextBlob; 314 sk_sp<SkTextBlob>* cachedTextBlob;
313 }; 315 };
314 316
315 } // namespace blink 317 } // namespace blink
316 #endif 318 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/TextDirection.h ('k') | third_party/WebKit/Source/web/ExternalPopupMenu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698