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

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: Remove bad assert. 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 14 matching lines...) Expand all
25 #define TextRun_h 25 #define TextRun_h
26 26
27 #include "platform/PlatformExport.h" 27 #include "platform/PlatformExport.h"
28 #include "platform/fonts/Glyph.h" 28 #include "platform/fonts/Glyph.h"
29 #include "platform/geometry/FloatRect.h" 29 #include "platform/geometry/FloatRect.h"
30 #include "platform/heap/Heap.h" 30 #include "platform/heap/Heap.h"
31 #include "platform/text/TabSize.h" 31 #include "platform/text/TabSize.h"
32 #include "platform/text/TextDirection.h" 32 #include "platform/text/TextDirection.h"
33 #include "platform/text/TextPath.h" 33 #include "platform/text/TextPath.h"
34 #include "wtf/Allocator.h" 34 #include "wtf/Allocator.h"
35 #include "wtf/text/StringView.h"
35 #include "wtf/text/WTFString.h" 36 #include "wtf/text/WTFString.h"
36 37
37 class SkTextBlob; 38 class SkTextBlob;
38 39
39 namespace blink { 40 namespace blink {
40 41
41 enum TextJustify { 42 enum TextJustify {
42 TextJustifyAuto = 0x0, 43 TextJustifyAuto = 0x0,
43 TextJustifyNone = 0x1, 44 TextJustifyNone = 0x1,
44 TextJustifyInterWord = 0x2, 45 TextJustifyInterWord = 0x2,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 , m_direction(direction) 95 , m_direction(direction)
95 , m_directionalOverride(directionalOverride) 96 , m_directionalOverride(directionalOverride)
96 , m_disableSpacing(false) 97 , m_disableSpacing(false)
97 , m_textJustify(TextJustifyAuto) 98 , m_textJustify(TextJustifyAuto)
98 , m_normalizeSpace(false) 99 , m_normalizeSpace(false)
99 , m_tabSize(0) 100 , m_tabSize(0)
100 { 101 {
101 m_data.characters16 = c; 102 m_data.characters16 = c;
102 } 103 }
103 104
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) 105 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()) 106 : m_charactersLength(string.length())
133 , m_len(string.length()) 107 , m_len(string.length())
134 , m_xpos(xpos) 108 , m_xpos(xpos)
135 , m_horizontalGlyphStretch(1) 109 , m_horizontalGlyphStretch(1)
136 , m_expansion(expansion) 110 , m_expansion(expansion)
137 , m_expansionBehavior(expansionBehavior) 111 , m_expansionBehavior(expansionBehavior)
138 , m_allowTabs(false) 112 , m_allowTabs(false)
139 , m_direction(direction) 113 , m_direction(direction)
140 , m_directionalOverride(directionalOverride) 114 , m_directionalOverride(directionalOverride)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 234
261 const TextRun& run; 235 const TextRun& run;
262 unsigned from; 236 unsigned from;
263 unsigned to; 237 unsigned to;
264 FloatRect bounds; 238 FloatRect bounds;
265 RefPtr<const SkTextBlob>* cachedTextBlob; 239 RefPtr<const SkTextBlob>* cachedTextBlob;
266 }; 240 };
267 241
268 } // namespace blink 242 } // namespace blink
269 #endif 243 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698