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

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: Use BidiResolver in RenderText 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 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 while (cb != rootBlock) { 2623 while (cb != rootBlock) {
2624 logicalRight += cb->logicalLeft(); 2624 logicalRight += cb->logicalLeft();
2625 cb = cb->containingBlock(); 2625 cb = cb->containingBlock();
2626 } 2626 }
2627 return logicalRight; 2627 return logicalRight;
2628 } 2628 }
2629 2629
2630 template <typename CharacterType> 2630 template <typename CharacterType>
2631 static inline TextRun constructTextRunInternal(RenderObject* context, const Font & font, const CharacterType* characters, int length, RenderStyle* style, TextRun ::ExpansionBehavior expansion) 2631 static inline TextRun constructTextRunInternal(RenderObject* context, const Font & font, const CharacterType* characters, int length, RenderStyle* style, TextRun ::ExpansionBehavior expansion)
2632 { 2632 {
2633 return constructTextRunInternal(context, font, characters, length, style, LT R, expansion);
2634 }
2635
2636 template <typename CharacterType>
2637 static inline TextRun constructTextRunInternal(RenderObject* context, const Font & font, const CharacterType* characters, int length, RenderStyle* style, TextDir ection direction, TextRun::ExpansionBehavior expansion)
2638 {
2633 ASSERT(style); 2639 ASSERT(style);
2634 2640
2635 TextDirection textDirection = LTR; 2641 TextDirection textDirection = direction;
2636 bool directionalOverride = style->rtlOrdering() == VisualOrder; 2642 bool directionalOverride = style->rtlOrdering() == VisualOrder;
2637 2643
2638 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO verride); 2644 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO verride);
2639 if (textRunNeedsRenderingContext(font)) 2645 if (textRunNeedsRenderingContext(font))
2640 run.setRenderingContext(SVGTextRunRenderingContext::create(context)); 2646 run.setRenderingContext(SVGTextRunRenderingContext::create(context));
2641 2647
2642 return run; 2648 return run;
2643 } 2649 }
2644 2650
2645 template <typename CharacterType> 2651 template <typename CharacterType>
(...skipping 27 matching lines...) Expand all
2673 return constructTextRunInternal(context, font, characters, length, style, ex pansion); 2679 return constructTextRunInternal(context, font, characters, length, style, ex pansion);
2674 } 2680 }
2675 2681
2676 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expans ion) 2682 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expans ion)
2677 { 2683 {
2678 if (text->is8Bit()) 2684 if (text->is8Bit())
2679 return constructTextRunInternal(context, font, text->characters8(), text ->textLength(), style, expansion); 2685 return constructTextRunInternal(context, font, text->characters8(), text ->textLength(), style, expansion);
2680 return constructTextRunInternal(context, font, text->characters16(), text->t extLength(), style, expansion); 2686 return constructTextRunInternal(context, font, text->characters16(), text->t extLength(), style, expansion);
2681 } 2687 }
2682 2688
2683 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion) 2689 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextDirection direction, TextRun::ExpansionBehavior expansion)
2684 { 2690 {
2685 ASSERT(offset + length <= text->textLength()); 2691 ASSERT(offset + length <= text->textLength());
2686 if (text->is8Bit()) 2692 if (text->is8Bit())
2687 return constructTextRunInternal(context, font, text->characters8() + off set, length, style, expansion); 2693 return constructTextRunInternal(context, font, text->characters8() + off set, length, style, direction, expansion);
2688 return constructTextRunInternal(context, font, text->characters16() + offset , length, style, expansion); 2694 return constructTextRunInternal(context, font, text->characters16() + offset , length, style, direction, expansion);
2689 } 2695 }
2690 2696
2691 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansio n, TextRunFlags flags) 2697 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon t, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansio n, TextRunFlags flags)
2692 { 2698 {
2693 unsigned length = string.length(); 2699 unsigned length = string.length();
2694 if (!length) 2700 if (!length)
2695 return constructTextRunInternal(context, font, static_cast<const LChar*> (0), length, style, expansion, flags); 2701 return constructTextRunInternal(context, font, static_cast<const LChar*> (0), length, style, expansion, flags);
2696 if (string.is8Bit()) 2702 if (string.is8Bit())
2697 return constructTextRunInternal(context, font, string.characters8(), len gth, style, expansion, flags); 2703 return constructTextRunInternal(context, font, string.characters8(), len gth, style, expansion, flags);
2698 return constructTextRunInternal(context, font, string.characters16(), length , style, expansion, flags); 2704 return constructTextRunInternal(context, font, string.characters16(), length , style, expansion, flags);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2761 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2756 { 2762 {
2757 if (m_rareData) 2763 if (m_rareData)
2758 return *m_rareData; 2764 return *m_rareData;
2759 2765
2760 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2766 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2761 return *m_rareData; 2767 return *m_rareData;
2762 } 2768 }
2763 2769
2764 } // namespace WebCore 2770 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698