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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1635203002: Apply text indent if the text direction matches the text alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 // Just update the line info's pagination strut without altering our logical height yet. If the line ends up containing 2053 // Just update the line info's pagination strut without altering our logical height yet. If the line ends up containing
2054 // no content, then we don't want to improperly grow the height of the block . 2054 // no content, then we don't want to improperly grow the height of the block .
2055 lineInfo.setFloatPaginationStrut(lineInfo.floatPaginationStrut() + paginatio nStrut); 2055 lineInfo.setFloatPaginationStrut(lineInfo.floatPaginationStrut() + paginatio nStrut);
2056 return true; 2056 return true;
2057 } 2057 }
2058 2058
2059 LayoutUnit LayoutBlockFlow::startAlignedOffsetForLine(LayoutUnit position, Inden tTextOrNot indentText) 2059 LayoutUnit LayoutBlockFlow::startAlignedOffsetForLine(LayoutUnit position, Inden tTextOrNot indentText)
2060 { 2060 {
2061 ETextAlign textAlign = style()->textAlign(); 2061 ETextAlign textAlign = style()->textAlign();
2062 2062
2063 if (textAlign == TASTART) // FIXME: Handle TAEND here 2063 bool applyIndentText;
2064 switch (textAlign) { // FIXME: Handle TAEND here
2065 case LEFT:
2066 case WEBKIT_LEFT:
2067 applyIndentText = style()->isLeftToRightDirection();
2068 break;
2069 case RIGHT:
2070 case WEBKIT_RIGHT:
2071 applyIndentText = !style()->isLeftToRightDirection();
2072 break;
2073 case TASTART:
2074 applyIndentText = true;
2075 break;
2076 default:
2077 applyIndentText = false;
2078 }
2079
2080 if (applyIndentText)
2064 return startOffsetForLine(position, indentText); 2081 return startOffsetForLine(position, indentText);
2065 2082
2066 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here 2083 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
2067 LayoutUnit totalLogicalWidth; 2084 LayoutUnit totalLogicalWidth;
2068 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), DoNotInde ntText); 2085 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), DoNotInde ntText);
2069 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , DoNotIndentText) - logicalLeft; 2086 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , DoNotIndentText) - logicalLeft;
2070 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2087 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2071 2088
2072 if (!style()->isLeftToRightDirection()) 2089 if (!style()->isLeftToRightDirection())
2073 return logicalWidth() - logicalLeft; 2090 return logicalWidth() - logicalLeft;
(...skipping 16 matching lines...) Expand all
2090 if (!line || !line->isFirstLineStyle()) 2107 if (!line || !line->isFirstLineStyle())
2091 return reason; 2108 return reason;
2092 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be 2109 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be
2093 // expensive to figure out if the first line is affected by any ::first-line selectors at all, 2110 // expensive to figure out if the first line is affected by any ::first-line selectors at all,
2094 // we just invalidate it unconditionally, since that's typically cheaper. 2111 // we just invalidate it unconditionally, since that's typically cheaper.
2095 invalidateDisplayItemClient(*line); 2112 invalidateDisplayItemClient(*line);
2096 return reason; 2113 return reason;
2097 } 2114 }
2098 2115
2099 } 2116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698