| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return constructTextRunInternal(font, string.characters16(), length, style, | 122 return constructTextRunInternal(font, string.characters16(), length, style, |
| 123 direction, flags); | 123 direction, flags); |
| 124 } | 124 } |
| 125 | 125 |
| 126 TextRun constructTextRun(const Font& font, | 126 TextRun constructTextRun(const Font& font, |
| 127 const String& string, | 127 const String& string, |
| 128 const ComputedStyle& style, | 128 const ComputedStyle& style, |
| 129 TextRunFlags flags) { | 129 TextRunFlags flags) { |
| 130 return constructTextRun(font, string, style, | 130 return constructTextRun(font, string, style, |
| 131 string.isEmpty() || string.is8Bit() | 131 string.isEmpty() || string.is8Bit() |
| 132 ? LTR | 132 ? TextDirection::Ltr |
| 133 : determineDirectionality(string), | 133 : determineDirectionality(string), |
| 134 flags); | 134 flags); |
| 135 } | 135 } |
| 136 | 136 |
| 137 TextRun constructTextRun(const Font& font, | 137 TextRun constructTextRun(const Font& font, |
| 138 const LineLayoutText text, | 138 const LineLayoutText text, |
| 139 unsigned offset, | 139 unsigned offset, |
| 140 unsigned length, | 140 unsigned length, |
| 141 const ComputedStyle& style) { | 141 const ComputedStyle& style) { |
| 142 ASSERT(offset + length <= text.textLength()); | 142 ASSERT(offset + length <= text.textLength()); |
| 143 if (text.hasEmptyText()) | 143 if (text.hasEmptyText()) { |
| 144 return constructTextRunInternal(font, static_cast<const LChar*>(nullptr), 0, | 144 return constructTextRunInternal(font, static_cast<const LChar*>(nullptr), 0, |
| 145 style, LTR); | 145 style, TextDirection::Ltr); |
| 146 if (text.is8Bit()) | 146 } |
| 147 if (text.is8Bit()) { |
| 147 return constructTextRunInternal(font, text.characters8() + offset, length, | 148 return constructTextRunInternal(font, text.characters8() + offset, length, |
| 148 style, LTR); | 149 style, TextDirection::Ltr); |
| 150 } |
| 149 | 151 |
| 150 TextRun run = constructTextRunInternal(font, text.characters16() + offset, | 152 TextRun run = constructTextRunInternal(font, text.characters16() + offset, |
| 151 length, style, LTR); | 153 length, style, TextDirection::Ltr); |
| 152 run.setDirection(directionForRun(run)); | 154 run.setDirection(directionForRun(run)); |
| 153 return run; | 155 return run; |
| 154 } | 156 } |
| 155 | 157 |
| 156 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |