OLD | NEW |
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 Loading... |
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 = TextDirection::Ltr, | 72 TextDirection direction = TextDirection::kLtr, |
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(static_cast<unsigned>(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 = TextDirection::Ltr, | 97 TextDirection direction = TextDirection::kLtr, |
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(static_cast<unsigned>(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 = TextDirection::Ltr, | 121 TextDirection direction = TextDirection::kLtr, |
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(static_cast<unsigned>(direction)), | 130 m_direction(static_cast<unsigned>(direction)), |
131 m_directionalOverride(directionalOverride), | 131 m_directionalOverride(directionalOverride), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void setExpansion(float expansion) { m_expansion = expansion; } | 242 void setExpansion(float expansion) { m_expansion = expansion; } |
243 bool allowsLeadingExpansion() const { | 243 bool allowsLeadingExpansion() const { |
244 return m_expansionBehavior & AllowLeadingExpansion; | 244 return m_expansionBehavior & AllowLeadingExpansion; |
245 } | 245 } |
246 bool allowsTrailingExpansion() const { | 246 bool allowsTrailingExpansion() const { |
247 return m_expansionBehavior & AllowTrailingExpansion; | 247 return m_expansionBehavior & AllowTrailingExpansion; |
248 } | 248 } |
249 TextDirection direction() const { | 249 TextDirection direction() const { |
250 return static_cast<TextDirection>(m_direction); | 250 return static_cast<TextDirection>(m_direction); |
251 } | 251 } |
252 bool rtl() const { return direction() == TextDirection::Rtl; } | 252 bool rtl() const { return direction() == TextDirection::kRtl; } |
253 bool ltr() const { return direction() == TextDirection::Ltr; } | 253 bool ltr() const { return direction() == TextDirection::kLtr; } |
254 bool directionalOverride() const { return m_directionalOverride; } | 254 bool directionalOverride() const { return m_directionalOverride; } |
255 bool spacingDisabled() const { return m_disableSpacing; } | 255 bool spacingDisabled() const { return m_disableSpacing; } |
256 | 256 |
257 void disableSpacing() { m_disableSpacing = true; } | 257 void disableSpacing() { m_disableSpacing = true; } |
258 void setDirection(TextDirection direction) { | 258 void setDirection(TextDirection direction) { |
259 m_direction = static_cast<unsigned>(direction); | 259 m_direction = static_cast<unsigned>(direction); |
260 } | 260 } |
261 void setDirectionalOverride(bool override) { | 261 void setDirectionalOverride(bool override) { |
262 m_directionalOverride = override; | 262 m_directionalOverride = override; |
263 } | 263 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |