OLD | NEW |
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const | 268 ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const |
269 { | 269 { |
270 ETextAlign alignment = style()->textAlign(); | 270 ETextAlign alignment = style()->textAlign(); |
271 if (endsWithSoftBreak) | 271 if (endsWithSoftBreak) |
272 return alignment; | 272 return alignment; |
273 | 273 |
274 if (!RuntimeEnabledFeatures::css3TextEnabled()) | 274 if (!RuntimeEnabledFeatures::css3TextEnabled()) |
275 return (alignment == JUSTIFY) ? TASTART : alignment; | 275 return (alignment == JUSTIFY) ? TASTART : alignment; |
276 | 276 |
277 if (alignment != JUSTIFY) | |
278 return alignment; | |
279 | |
280 TextAlignLast alignmentLast = style()->textAlignLast(); | 277 TextAlignLast alignmentLast = style()->textAlignLast(); |
281 switch (alignmentLast) { | 278 switch (alignmentLast) { |
282 case TextAlignLastStart: | 279 case TextAlignLastStart: |
283 return TASTART; | 280 return TASTART; |
284 case TextAlignLastEnd: | 281 case TextAlignLastEnd: |
285 return TAEND; | 282 return TAEND; |
286 case TextAlignLastLeft: | 283 case TextAlignLastLeft: |
287 return LEFT; | 284 return LEFT; |
288 case TextAlignLastRight: | 285 case TextAlignLastRight: |
289 return RIGHT; | 286 return RIGHT; |
290 case TextAlignLastCenter: | 287 case TextAlignLastCenter: |
291 return CENTER; | 288 return CENTER; |
292 case TextAlignLastJustify: | 289 case TextAlignLastJustify: |
293 return JUSTIFY; | 290 return JUSTIFY; |
294 case TextAlignLastAuto: | 291 case TextAlignLastAuto: |
295 if (style()->textJustify() == TextJustifyDistribute) | 292 if (alignment == JUSTIFY) |
296 return JUSTIFY; | 293 return TASTART; |
297 return TASTART; | 294 return alignment; |
298 } | 295 } |
299 | 296 |
300 return alignment; | 297 return alignment; |
301 } | 298 } |
302 | 299 |
303 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B
idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av
ailableLogicalWidth) | 300 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B
idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av
ailableLogicalWidth) |
304 { | 301 { |
305 // The direction of the block should determine what happens with wide lines. | 302 // The direction of the block should determine what happens with wide lines. |
306 // In particular with RTL blocks, wide lines should still spill out to the l
eft. | 303 // In particular with RTL blocks, wide lines should still spill out to the l
eft. |
307 if (isLeftToRightDirection) { | 304 if (isLeftToRightDirection) { |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2046 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
2050 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2047 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2051 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2048 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2052 | 2049 |
2053 if (!style()->isLeftToRightDirection()) | 2050 if (!style()->isLeftToRightDirection()) |
2054 return logicalWidth() - logicalLeft; | 2051 return logicalWidth() - logicalLeft; |
2055 return logicalLeft; | 2052 return logicalLeft; |
2056 } | 2053 } |
2057 | 2054 |
2058 } | 2055 } |
OLD | NEW |