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

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

Issue 59753002: text-align-last only affect to the last line when text-align is justify. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Combining the two ref tests as one ref test Created 6 years, 6 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 | « LayoutTests/fast/css3-text/css3-text-align-last/text-align-last-start-expected.html ('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 * 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const 313 ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const
314 { 314 {
315 ETextAlign alignment = style()->textAlign(); 315 ETextAlign alignment = style()->textAlign();
316 if (endsWithSoftBreak) 316 if (endsWithSoftBreak)
317 return alignment; 317 return alignment;
318 318
319 if (!RuntimeEnabledFeatures::css3TextEnabled()) 319 if (!RuntimeEnabledFeatures::css3TextEnabled())
320 return (alignment == JUSTIFY) ? TASTART : alignment; 320 return (alignment == JUSTIFY) ? TASTART : alignment;
321 321
322 if (alignment != JUSTIFY)
323 return alignment;
324
322 TextAlignLast alignmentLast = style()->textAlignLast(); 325 TextAlignLast alignmentLast = style()->textAlignLast();
323 switch (alignmentLast) { 326 switch (alignmentLast) {
324 case TextAlignLastStart: 327 case TextAlignLastStart:
325 return TASTART; 328 return TASTART;
326 case TextAlignLastEnd: 329 case TextAlignLastEnd:
327 return TAEND; 330 return TAEND;
328 case TextAlignLastLeft: 331 case TextAlignLastLeft:
329 return LEFT; 332 return LEFT;
330 case TextAlignLastRight: 333 case TextAlignLastRight:
331 return RIGHT; 334 return RIGHT;
332 case TextAlignLastCenter: 335 case TextAlignLastCenter:
333 return CENTER; 336 return CENTER;
334 case TextAlignLastJustify: 337 case TextAlignLastJustify:
335 return JUSTIFY; 338 return JUSTIFY;
336 case TextAlignLastAuto: 339 case TextAlignLastAuto:
337 if (alignment != JUSTIFY)
338 return alignment;
339 if (style()->textJustify() == TextJustifyDistribute) 340 if (style()->textJustify() == TextJustifyDistribute)
340 return JUSTIFY; 341 return JUSTIFY;
341 return TASTART; 342 return TASTART;
342 } 343 }
343 344
344 return alignment; 345 return alignment;
345 } 346 }
346 347
347 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av ailableLogicalWidth) 348 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av ailableLogicalWidth)
348 { 349 {
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2182 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2182 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2183 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2183 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2184 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2184 2185
2185 if (!style()->isLeftToRightDirection()) 2186 if (!style()->isLeftToRightDirection())
2186 return logicalWidth() - logicalLeft; 2187 return logicalWidth() - logicalLeft;
2187 return logicalLeft; 2188 return logicalLeft;
2188 } 2189 }
2189 2190
2190 } 2191 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/css3-text/css3-text-align-last/text-align-last-start-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698