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

Side by Side Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 104813005: Explicitly set text direction for TextRuns (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
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 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 while (cb != rootBlock) { 2652 while (cb != rootBlock) {
2653 logicalRight += cb->logicalLeft(); 2653 logicalRight += cb->logicalLeft();
2654 cb = cb->containingBlock(); 2654 cb = cb->containingBlock();
2655 } 2655 }
2656 return logicalRight; 2656 return logicalRight;
2657 } 2657 }
2658 2658
2659 template <typename CharacterType> 2659 template <typename CharacterType>
2660 static inline TextRun constructTextRunInternal(RenderObject* context, const Font & font, const CharacterType* characters, int length, RenderStyle* style, TextRun ::ExpansionBehavior expansion) 2660 static inline TextRun constructTextRunInternal(RenderObject* context, const Font & font, const CharacterType* characters, int length, RenderStyle* style, TextRun ::ExpansionBehavior expansion)
2661 { 2661 {
2662 return constructTextRunInternal(context, font, characters, length, style, LT R, expansion);
2663 }
2664
2665 template <typename CharacterType>
2666 static inline TextRun constructTextRunInternal(RenderObject* context, const Font & font, const CharacterType* characters, int length, RenderStyle* style, TextDir ection direction, TextRun::ExpansionBehavior expansion)
2667 {
2662 ASSERT(style); 2668 ASSERT(style);
2663 2669
2664 TextDirection textDirection = LTR; 2670 TextDirection textDirection = direction;
2665 bool directionalOverride = style->rtlOrdering() == VisualOrder; 2671 bool directionalOverride = style->rtlOrdering() == VisualOrder;
2666 2672
2667 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO verride); 2673 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO verride);
2668 if (textRunNeedsRenderingContext(font)) 2674 if (textRunNeedsRenderingContext(font))
2669 run.setRenderingContext(SVGTextRunRenderingContext::create(context)); 2675 run.setRenderingContext(SVGTextRunRenderingContext::create(context));
2670 2676
2671 return run; 2677 return run;
2672 } 2678 }
2673 2679
2674 template <typename CharacterType> 2680 template <typename CharacterType>
(...skipping 27 matching lines...) Expand all
2702 return constructTextRunInternal(context, font, characters, length, style, ex pansion); 2708 return constructTextRunInternal(context, font, characters, length, style, ex pansion);
2703 } 2709 }
2704 2710
2705 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expans ion) 2711 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expans ion)
2706 { 2712 {
2707 if (text->is8Bit()) 2713 if (text->is8Bit())
2708 return constructTextRunInternal(context, font, text->characters8(), text ->textLength(), style, expansion); 2714 return constructTextRunInternal(context, font, text->characters8(), text ->textLength(), style, expansion);
2709 return constructTextRunInternal(context, font, text->characters16(), text->t extLength(), style, expansion); 2715 return constructTextRunInternal(context, font, text->characters16(), text->t extLength(), style, expansion);
2710 } 2716 }
2711 2717
2712 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion) 2718 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
2713 { 2719 {
2714 ASSERT(offset + length <= text->textLength()); 2720 ASSERT(offset + length <= text->textLength());
2715 if (text->is8Bit()) 2721 if (text->is8Bit())
2716 return constructTextRunInternal(context, font, text->characters8() + off set, length, style, expansion); 2722 return constructTextRunInternal(context, font, text->characters8() + off set, length, style, direction, expansion);
2717 return constructTextRunInternal(context, font, text->characters16() + offset , length, style, expansion); 2723 return constructTextRunInternal(context, font, text->characters16() + offset , length, style, direction, expansion);
2718 } 2724 }
2719 2725
2720 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansio n, TextRunFlags flags) 2726 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansio n, TextRunFlags flags)
2721 { 2727 {
2722 unsigned length = string.length(); 2728 unsigned length = string.length();
2723 if (!length) 2729 if (!length)
2724 return constructTextRunInternal(context, font, static_cast<const LChar*> (0), length, style, expansion, flags); 2730 return constructTextRunInternal(context, font, static_cast<const LChar*> (0), length, style, expansion, flags);
2725 if (string.is8Bit()) 2731 if (string.is8Bit())
2726 return constructTextRunInternal(context, font, string.characters8(), len gth, style, expansion, flags); 2732 return constructTextRunInternal(context, font, string.characters8(), len gth, style, expansion, flags);
2727 return constructTextRunInternal(context, font, string.characters16(), length , style, expansion, flags); 2733 return constructTextRunInternal(context, font, string.characters16(), length , style, expansion, flags);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2790 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2785 { 2791 {
2786 if (m_rareData) 2792 if (m_rareData)
2787 return *m_rareData; 2793 return *m_rareData;
2788 2794
2789 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2795 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2790 return *m_rareData; 2796 return *m_rareData;
2791 } 2797 }
2792 2798
2793 } // namespace WebCore 2799 } // namespace WebCore
OLDNEW
« 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