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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.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 * 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 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 // However, as soon as some content is entered, the line boxes will be 2655 // However, as soon as some content is entered, the line boxes will be
2656 // constructed and this kludge is not called any more. So only the caret siz e 2656 // constructed and this kludge is not called any more. So only the caret siz e
2657 // of an empty :first-line'd block is wrong. I think we can live with that. 2657 // of an empty :first-line'd block is wrong. I think we can live with that.
2658 RenderStyle* currentStyle = firstLineStyle(); 2658 RenderStyle* currentStyle = firstLineStyle();
2659 LayoutUnit height = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); 2659 LayoutUnit height = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
2660 2660
2661 enum CaretAlignment { alignLeft, alignRight, alignCenter }; 2661 enum CaretAlignment { alignLeft, alignRight, alignCenter };
2662 2662
2663 CaretAlignment alignment = alignLeft; 2663 CaretAlignment alignment = alignLeft;
2664 2664
2665 switch (currentStyle->textAlign()) { 2665 switch (simplifiedTextAlign(currentStyle->textAlign())) {
2666 case LEFT: 2666 case LEFT:
2667 case WEBKIT_LEFT:
2668 break; 2667 break;
2669 case CENTER: 2668 case CENTER:
2670 case WEBKIT_CENTER:
2671 alignment = alignCenter; 2669 alignment = alignCenter;
2672 break; 2670 break;
2673 case RIGHT: 2671 case RIGHT:
2674 case WEBKIT_RIGHT:
2675 alignment = alignRight; 2672 alignment = alignRight;
2676 break; 2673 break;
2677 case JUSTIFY: 2674 case JUSTIFY:
2678 case TASTART:
2679 if (!currentStyle->isLeftToRightDirection()) 2675 if (!currentStyle->isLeftToRightDirection())
2680 alignment = alignRight; 2676 alignment = alignRight;
2681 break; 2677 break;
2682 case TAEND: 2678 default:
2683 if (currentStyle->isLeftToRightDirection()) 2679 ASSERT_NOT_REACHED();
2684 alignment = alignRight;
2685 break; 2680 break;
2686 } 2681 }
2687 2682
2688 LayoutUnit x = borderLeft() + paddingLeft(); 2683 LayoutUnit x = borderLeft() + paddingLeft();
2689 LayoutUnit maxX = width - borderRight() - paddingRight(); 2684 LayoutUnit maxX = width - borderRight() - paddingRight();
2690 2685
2691 switch (alignment) { 2686 switch (alignment) {
2692 case alignLeft: 2687 case alignLeft:
2693 if (currentStyle->isLeftToRightDirection()) 2688 if (currentStyle->isLeftToRightDirection())
2694 x += textIndentOffset; 2689 x += textIndentOffset;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2825 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2831 for (RenderObject* child = startChild; child && child != endChild; ) { 2826 for (RenderObject* child = startChild; child && child != endChild; ) {
2832 // Save our next sibling as moveChildTo will clear it. 2827 // Save our next sibling as moveChildTo will clear it.
2833 RenderObject* nextSibling = child->nextSibling(); 2828 RenderObject* nextSibling = child->nextSibling();
2834 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2829 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2835 child = nextSibling; 2830 child = nextSibling;
2836 } 2831 }
2837 } 2832 }
2838 2833
2839 } // namespace WebCore 2834 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698