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

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

Issue 541823003: Move caret to correct position when dir=auto (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 break; 687 break;
688 case JUSTIFY: 688 case JUSTIFY:
689 case TASTART: 689 case TASTART:
690 rightAligned = !cbStyle->isLeftToRightDirection(); 690 rightAligned = !cbStyle->isLeftToRightDirection();
691 break; 691 break;
692 case TAEND: 692 case TAEND:
693 rightAligned = cbStyle->isLeftToRightDirection(); 693 rightAligned = cbStyle->isLeftToRightDirection();
694 break; 694 break;
695 } 695 }
696 696
697 if (rightAligned) { 697 if (node() && node()->selfOrAncestorHasDirAutoAttribute()) {
698 left = std::max(left, leftEdge); 698 if (rightAligned && inlineBox->bidiLevel()%2) {
699 left = std::min(left, rootRight - caretWidth); 699 left = std::max(left, leftEdge);
700 left = std::min(left, rootRight - caretWidth);
701 } else {
702 left = std::min(left, rightEdge - caretWidthRightOfOffset);
703 left = std::max(left, rootLeft);
704 }
700 } else { 705 } else {
701 left = std::min(left, rightEdge - caretWidthRightOfOffset); 706 if (rightAligned) {
702 left = std::max(left, rootLeft); 707 left = std::max(left, leftEdge);
eae 2014/09/08 18:58:50 The code in this block is identical to that in the
Habib Virji 2014/09/09 10:44:02 Done.
708 left = std::min(left, rootRight - caretWidth);
709 } else {
710 left = std::min(left, rightEdge - caretWidthRightOfOffset);
711 left = std::max(left, rootLeft);
712 }
703 } 713 }
704 714
705 return style()->isHorizontalWritingMode() ? IntRect(left, top, caretWidth, h eight) : IntRect(top, left, height, caretWidth); 715 return style()->isHorizontalWritingMode() ? IntRect(left, top, caretWidth, h eight) : IntRect(top, left, height, caretWidth);
706 } 716 }
707 717
708 ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len , float xPos, TextDirection textDirection, HashSet<const SimpleFontData*>* fallb ackFonts, GlyphOverflow* glyphOverflow) const 718 ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len , float xPos, TextDirection textDirection, HashSet<const SimpleFontData*>* fallb ackFonts, GlyphOverflow* glyphOverflow) const
709 { 719 {
710 if (style()->hasTextCombine() && isCombineText()) { 720 if (style()->hasTextCombine() && isCombineText()) {
711 const RenderCombineText* combineText = toRenderCombineText(this); 721 const RenderCombineText* combineText = toRenderCombineText(this);
712 if (combineText->isCombined()) 722 if (combineText->isCombined())
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 } 1882 }
1873 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1883 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1874 } 1884 }
1875 1885
1876 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() 1886 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox()
1877 { 1887 {
1878 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); 1888 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox);
1879 } 1889 }
1880 1890
1881 } // namespace blink 1891 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698