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

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

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