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

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: 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
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 (cbStyle->textAlign()) { 695 switch (simplifiedTextAlign(cbStyle->textAlign())) {
696 case RIGHT: 696 case RIGHT:
697 case WEBKIT_RIGHT:
698 rightAligned = true; 697 rightAligned = true;
699 break; 698 break;
700 case LEFT: 699 case LEFT:
701 case WEBKIT_LEFT:
702 case CENTER: 700 case CENTER:
703 case WEBKIT_CENTER:
704 break; 701 break;
705 case JUSTIFY: 702 case JUSTIFY:
706 case TASTART:
707 rightAligned = !cbStyle->isLeftToRightDirection(); 703 rightAligned = !cbStyle->isLeftToRightDirection();
708 break; 704 break;
709 case TAEND: 705 default:
710 rightAligned = cbStyle->isLeftToRightDirection(); 706 ASSERT_NOT_REACHED();
711 break; 707 break;
712 } 708 }
713 709
714 if (rightAligned) { 710 if (rightAligned) {
715 left = max(left, leftEdge); 711 left = max(left, leftEdge);
716 left = min(left, rootRight - caretWidth); 712 left = min(left, rootRight - caretWidth);
717 } else { 713 } else {
718 left = min(left, rightEdge - caretWidthRightOfOffset); 714 left = min(left, rightEdge - caretWidthRightOfOffset);
719 left = max(left, rootLeft); 715 left = max(left, rootLeft);
720 } 716 }
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 } 1857 }
1862 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1858 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1863 } 1859 }
1864 1860
1865 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() 1861 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox()
1866 { 1862 {
1867 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); 1863 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox);
1868 } 1864 }
1869 1865
1870 } // namespace WebCore 1866 } // namespace WebCore
OLDNEW
« Source/core/rendering/RenderObject.cpp ('K') | « Source/core/rendering/RenderObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698