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

Unified Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 397723006: Move RenderBlockFlow::constructTextRun out. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockFlow.cpp
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp
index e928a5e16d662934d475c88ff8f2ac73ebf817c1..957611fa4007e63a1e572ef57336950cc1b59363 100644
--- a/Source/core/rendering/RenderBlockFlow.cpp
+++ b/Source/core/rendering/RenderBlockFlow.cpp
@@ -2740,96 +2740,6 @@ LayoutUnit RenderBlockFlow::logicalRightSelectionOffset(RenderBlock* rootBlock,
return logicalRight;
}
-template <typename CharacterType>
-static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
-{
- ASSERT(style);
-
- TextDirection textDirection = direction;
- bool directionalOverride = style->rtlOrdering() == VisualOrder;
-
- TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
- if (textRunNeedsRenderingContext(font))
- run.setRenderingContext(SVGTextRunRenderingContext::create(context));
-
- return run;
-}
-
-template <typename CharacterType>
-static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
-{
- ASSERT(style);
-
- TextDirection textDirection = direction;
- bool directionalOverride = style->rtlOrdering() == VisualOrder;
- if (flags != DefaultTextRunFlags) {
- if (flags & RespectDirection)
- textDirection = style->direction();
- if (flags & RespectDirectionOverride)
- directionalOverride |= isOverride(style->unicodeBidi());
- }
-
- TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
- if (textRunNeedsRenderingContext(font))
- run.setRenderingContext(SVGTextRunRenderingContext::create(context));
-
- return run;
-}
-
-TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
-{
- return constructTextRunInternal(context, font, characters, length, style, direction, expansion);
-}
-
-TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
-{
- return constructTextRunInternal(context, font, characters, length, style, direction, expansion);
-}
-
-TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
-{
- if (text->is8Bit())
- return constructTextRunInternal(context, font, text->characters8(), text->textLength(), style, direction, expansion);
- return constructTextRunInternal(context, font, text->characters16(), text->textLength(), style, direction, expansion);
-}
-
-TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
-{
- ASSERT(offset + length <= text->textLength());
- if (text->is8Bit())
- return constructTextRunInternal(context, font, text->characters8() + offset, length, style, direction, expansion);
- return constructTextRunInternal(context, font, text->characters16() + offset, length, style, direction, expansion);
-}
-
-TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
-{
- unsigned length = string.length();
- if (!length)
- return constructTextRunInternal(context, font, static_cast<const LChar*>(0), length, style, direction, expansion, flags);
- if (string.is8Bit())
- return constructTextRunInternal(context, font, string.characters8(), length, style, direction, expansion, flags);
- return constructTextRunInternal(context, font, string.characters16(), length, style, direction, expansion, flags);
-}
-
-TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
-{
- bool hasStrongDirectionality;
- return constructTextRun(context, font, string, style,
- determineDirectionality(string, hasStrongDirectionality),
- expansion, flags);
-}
-
-TextRun RenderBlockFlow::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;
-}
-
RootInlineBox* RenderBlockFlow::createRootInlineBox()
{
return new RootInlineBox(*this);
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698