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

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

Issue 150403003: Consider text alignment and direction when computing the left offset for horizontal writing modes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@issue313593
Patch Set: Rebased patch against master Created 6 years, 10 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/rendering/RenderObject.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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 686
687 RenderBlock* cb = containingBlock(); 687 RenderBlock* cb = containingBlock();
688 RenderStyle* cbStyle = cb->style(); 688 RenderStyle* cbStyle = cb->style();
689 689
690 float leftEdge; 690 float leftEdge;
691 float rightEdge; 691 float rightEdge;
692 leftEdge = min<float>(0, rootLeft); 692 leftEdge = min<float>(0, rootLeft);
693 rightEdge = max<float>(cb->logicalWidth(), rootRight); 693 rightEdge = max<float>(cb->logicalWidth(), rootRight);
694 694
695 bool rightAligned = false; 695 bool rightAligned = false;
696 switch (cbStyle->textAlign()) { 696 switch (simplifiedTextAlign(cbStyle->textAlign())) {
697 case RIGHT: 697 case RIGHT:
698 case WEBKIT_RIGHT:
699 rightAligned = true; 698 rightAligned = true;
700 break; 699 break;
701 case LEFT: 700 case LEFT:
702 case WEBKIT_LEFT:
703 case CENTER: 701 case CENTER:
704 case WEBKIT_CENTER:
705 break; 702 break;
706 case JUSTIFY: 703 case JUSTIFY:
707 case TASTART:
708 rightAligned = !cbStyle->isLeftToRightDirection(); 704 rightAligned = !cbStyle->isLeftToRightDirection();
709 break; 705 break;
710 case TAEND: 706 default:
711 rightAligned = cbStyle->isLeftToRightDirection(); 707 ASSERT_NOT_REACHED();
712 break; 708 break;
713 } 709 }
714 710
715 if (rightAligned) { 711 if (rightAligned) {
716 left = max(left, leftEdge); 712 left = max(left, leftEdge);
717 left = min(left, rootRight - caretWidth); 713 left = min(left, rootRight - caretWidth);
718 } else { 714 } else {
719 left = min(left, rightEdge - caretWidthRightOfOffset); 715 left = min(left, rightEdge - caretWidthRightOfOffset);
720 left = max(left, rootLeft); 716 left = max(left, rootLeft);
721 } 717 }
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 } 1865 }
1870 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1866 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1871 } 1867 }
1872 1868
1873 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() 1869 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox()
1874 { 1870 {
1875 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); 1871 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox);
1876 } 1872 }
1877 1873
1878 } // namespace WebCore 1874 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698