OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return constructTextRunInternal(context, font, static_cast<const LChar*>
(nullptr), 0, style, direction); | 88 return constructTextRunInternal(context, font, static_cast<const LChar*>
(nullptr), 0, style, direction); |
89 if (text->is8Bit()) | 89 if (text->is8Bit()) |
90 return constructTextRunInternal(context, font, text->characters8() + off
set, length, style, direction); | 90 return constructTextRunInternal(context, font, text->characters8() + off
set, length, style, direction); |
91 return constructTextRunInternal(context, font, text->characters16() + offset
, length, style, direction); | 91 return constructTextRunInternal(context, font, text->characters16() + offset
, length, style, direction); |
92 } | 92 } |
93 | 93 |
94 TextRun constructTextRun(LayoutObject* context, const Font& font, const String&
string, const ComputedStyle& style, TextDirection direction, TextRunFlags flags) | 94 TextRun constructTextRun(LayoutObject* context, const Font& font, const String&
string, const ComputedStyle& style, TextDirection direction, TextRunFlags flags) |
95 { | 95 { |
96 unsigned length = string.length(); | 96 unsigned length = string.length(); |
97 if (!length) | 97 if (!length) |
98 return constructTextRunInternal(context, font, static_cast<const LChar*>
(0), length, style, direction, flags); | 98 return constructTextRunInternal(context, font, static_cast<const LChar*>
(nullptr), length, style, direction, flags); |
99 if (string.is8Bit()) | 99 if (string.is8Bit()) |
100 return constructTextRunInternal(context, font, string.characters8(), len
gth, style, direction, flags); | 100 return constructTextRunInternal(context, font, string.characters8(), len
gth, style, direction, flags); |
101 return constructTextRunInternal(context, font, string.characters16(), length
, style, direction, flags); | 101 return constructTextRunInternal(context, font, string.characters16(), length
, style, direction, flags); |
102 } | 102 } |
103 | 103 |
104 TextRun constructTextRun(LayoutObject* context, const Font& font, const String&
string, const ComputedStyle& style, TextRunFlags flags) | 104 TextRun constructTextRun(LayoutObject* context, const Font& font, const String&
string, const ComputedStyle& style, TextRunFlags flags) |
105 { | 105 { |
106 return constructTextRun(context, font, string, style, string.isEmpty() || st
ring.is8Bit() ? LTR : determineDirectionality(string), flags); | 106 return constructTextRun(context, font, string, style, string.isEmpty() || st
ring.is8Bit() ? LTR : determineDirectionality(string), flags); |
107 } | 107 } |
108 | 108 |
109 TextRun constructTextRun(LayoutObject* context, const Font& font, const LayoutTe
xt* text, unsigned offset, unsigned length, const ComputedStyle& style) | 109 TextRun constructTextRun(LayoutObject* context, const Font& font, const LayoutTe
xt* text, unsigned offset, unsigned length, const ComputedStyle& style) |
110 { | 110 { |
111 ASSERT(offset + length <= text->textLength()); | 111 ASSERT(offset + length <= text->textLength()); |
112 if (text->hasEmptyText()) | 112 if (text->hasEmptyText()) |
113 return constructTextRunInternal(context, font, static_cast<const LChar*>
(nullptr), 0, style, LTR); | 113 return constructTextRunInternal(context, font, static_cast<const LChar*>
(nullptr), 0, style, LTR); |
114 if (text->is8Bit()) | 114 if (text->is8Bit()) |
115 return constructTextRunInternal(context, font, text->characters8() + off
set, length, style, LTR); | 115 return constructTextRunInternal(context, font, text->characters8() + off
set, length, style, LTR); |
116 | 116 |
117 TextRun run = constructTextRunInternal(context, font, text->characters16() +
offset, length, style, LTR); | 117 TextRun run = constructTextRunInternal(context, font, text->characters16() +
offset, length, style, LTR); |
118 run.setDirection(directionForRun(run)); | 118 run.setDirection(directionForRun(run)); |
119 return run; | 119 return run; |
120 } | 120 } |
121 | 121 |
122 } // namespace blink | 122 } // namespace blink |
OLD | NEW |