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

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: 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
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const 314 ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const
315 { 315 {
316 ETextAlign alignment = style()->textAlign(); 316 ETextAlign alignment = style()->textAlign();
317 if (endsWithSoftBreak) 317 if (endsWithSoftBreak)
318 return alignment; 318 return alignment;
319 319
320 if (!RuntimeEnabledFeatures::css3TextEnabled()) 320 if (!RuntimeEnabledFeatures::css3TextEnabled())
321 return (alignment == JUSTIFY) ? TASTART : alignment; 321 return (alignment == JUSTIFY) ? TASTART : alignment;
322 322
323 if (alignment != JUSTIFY)
324 return alignment;
325
323 TextAlignLast alignmentLast = style()->textAlignLast(); 326 TextAlignLast alignmentLast = style()->textAlignLast();
324 switch (alignmentLast) { 327 switch (alignmentLast) {
325 case TextAlignLastStart: 328 case TextAlignLastStart:
326 return TASTART; 329 return TASTART;
327 case TextAlignLastEnd: 330 case TextAlignLastEnd:
328 return TAEND; 331 return TAEND;
329 case TextAlignLastLeft: 332 case TextAlignLastLeft:
330 return LEFT; 333 return LEFT;
331 case TextAlignLastRight: 334 case TextAlignLastRight:
332 return RIGHT; 335 return RIGHT;
333 case TextAlignLastCenter: 336 case TextAlignLastCenter:
334 return CENTER; 337 return CENTER;
335 case TextAlignLastJustify: 338 case TextAlignLastJustify:
336 return JUSTIFY; 339 return JUSTIFY;
337 case TextAlignLastAuto: 340 case TextAlignLastAuto:
338 if (alignment != JUSTIFY)
339 return alignment;
340 if (style()->textJustify() == TextJustifyDistribute) 341 if (style()->textJustify() == TextJustifyDistribute)
341 return JUSTIFY; 342 return JUSTIFY;
342 return TASTART; 343 return TASTART;
343 } 344 }
344 345
345 return alignment; 346 return alignment;
346 } 347 }
347 348
348 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av ailableLogicalWidth) 349 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av ailableLogicalWidth)
349 { 350 {
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2183 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2183 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2184 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2184 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2185 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2185 2186
2186 if (!style()->isLeftToRightDirection()) 2187 if (!style()->isLeftToRightDirection())
2187 return logicalWidth() - logicalLeft; 2188 return logicalWidth() - logicalLeft;
2188 return logicalLeft; 2189 return logicalLeft;
2189 } 2190 }
2190 2191
2191 } 2192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698