TextRun textRunWithDirectionality(const String& value, bool& hasStrongDirectionality) { TextRun run(value); TextDirection direction = directionForRun(run, hasStrongDirectionality); if (hasStrongDirectionality) run.setDirection(direction); return run; }
TextRun constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion) { ASSERT(offset + length <= text->textLength()); TextRun run = text->is8Bit() ? constructTextRunInternal(context, font, text->characters8() + offset, length, style, LTR, expansion) : constructTextRunInternal(context, font, text->characters16() + offset, length, style, LTR, expansion); bool hasStrongDirectionality; run.setDirection(directionForRun(run, hasStrongDirectionality)); return run; }
TextRun constructTextRun(const Font& font, const LineLayoutText text, unsigned offset, unsigned length, const ComputedStyle& style) { ASSERT(offset + length <= text.textLength()); if (text.hasEmptyText()) return constructTextRunInternal(font, static_cast<const LChar*>(nullptr), 0, style, LTR); if (text.is8Bit()) return constructTextRunInternal(font, text.characters8() + offset, length, style, LTR); TextRun run = constructTextRunInternal(font, text.characters16() + offset, length, style, LTR); run.setDirection(directionForRun(run)); return run; }
TextDirection determineDirectionality(const String& value, bool& hasStrongDirectionality) { TextRun run(value); return directionForRun(run, hasStrongDirectionality); }