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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.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/RenderBox.cpp ('k') | Source/core/rendering/RenderObject.h » ('j') | 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 // However, as soon as some content is entered, the line boxes will be 2631 // However, as soon as some content is entered, the line boxes will be
2632 // constructed and this kludge is not called any more. So only the caret siz e 2632 // constructed and this kludge is not called any more. So only the caret siz e
2633 // of an empty :first-line'd block is wrong. I think we can live with that. 2633 // of an empty :first-line'd block is wrong. I think we can live with that.
2634 RenderStyle* currentStyle = firstLineStyle(); 2634 RenderStyle* currentStyle = firstLineStyle();
2635 LayoutUnit height = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); 2635 LayoutUnit height = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
2636 2636
2637 enum CaretAlignment { alignLeft, alignRight, alignCenter }; 2637 enum CaretAlignment { alignLeft, alignRight, alignCenter };
2638 2638
2639 CaretAlignment alignment = alignLeft; 2639 CaretAlignment alignment = alignLeft;
2640 2640
2641 switch (simplifiedTextAlign(currentStyle->textAlign())) { 2641 switch (currentStyle->textAlign()) {
2642 case LEFT: 2642 case LEFT:
2643 case WEBKIT_LEFT:
2643 break; 2644 break;
2644 case CENTER: 2645 case CENTER:
2646 case WEBKIT_CENTER:
2645 alignment = alignCenter; 2647 alignment = alignCenter;
2646 break; 2648 break;
2647 case RIGHT: 2649 case RIGHT:
2650 case WEBKIT_RIGHT:
2648 alignment = alignRight; 2651 alignment = alignRight;
2649 break; 2652 break;
2650 case JUSTIFY: 2653 case JUSTIFY:
2654 case TASTART:
2651 if (!currentStyle->isLeftToRightDirection()) 2655 if (!currentStyle->isLeftToRightDirection())
2652 alignment = alignRight; 2656 alignment = alignRight;
2653 break; 2657 break;
2654 default: 2658 case TAEND:
2655 ASSERT_NOT_REACHED(); 2659 if (currentStyle->isLeftToRightDirection())
2660 alignment = alignRight;
2656 break; 2661 break;
2657 } 2662 }
2658 2663
2659 LayoutUnit x = borderLeft() + paddingLeft(); 2664 LayoutUnit x = borderLeft() + paddingLeft();
2660 LayoutUnit maxX = width - borderRight() - paddingRight(); 2665 LayoutUnit maxX = width - borderRight() - paddingRight();
2661 2666
2662 switch (alignment) { 2667 switch (alignment) {
2663 case alignLeft: 2668 case alignLeft:
2664 if (currentStyle->isLeftToRightDirection()) 2669 if (currentStyle->isLeftToRightDirection())
2665 x += textIndentOffset; 2670 x += textIndentOffset;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2806 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2802 for (RenderObject* child = startChild; child && child != endChild; ) { 2807 for (RenderObject* child = startChild; child && child != endChild; ) {
2803 // Save our next sibling as moveChildTo will clear it. 2808 // Save our next sibling as moveChildTo will clear it.
2804 RenderObject* nextSibling = child->nextSibling(); 2809 RenderObject* nextSibling = child->nextSibling();
2805 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2810 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2806 child = nextSibling; 2811 child = nextSibling;
2807 } 2812 }
2808 } 2813 }
2809 2814
2810 } // namespace WebCore 2815 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698