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. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
4 * All right reserved. | 4 * All right reserved. |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 // Now mark the line boxes as being constructed. | 355 // Now mark the line boxes as being constructed. |
356 LastLineBox()->SetConstructed(); | 356 LastLineBox()->SetConstructed(); |
357 | 357 |
358 // Return the last line. | 358 // Return the last line. |
359 return LastRootBox(); | 359 return LastRootBox(); |
360 } | 360 } |
361 | 361 |
362 ETextAlign LayoutBlockFlow::TextAlignmentForLine( | 362 ETextAlign LayoutBlockFlow::TextAlignmentForLine( |
363 bool ends_with_soft_break) const { | 363 bool ends_with_soft_break) const { |
364 ETextAlign alignment = Style()->GetTextAlign(); | 364 return Style()->GetTextAlign(!ends_with_soft_break); |
365 if (ends_with_soft_break) | |
366 return alignment; | |
367 | |
368 ETextAlignLast alignment_last = Style()->TextAlignLast(); | |
369 switch (alignment_last) { | |
370 case ETextAlignLast::kStart: | |
371 return ETextAlign::kStart; | |
372 case ETextAlignLast::kEnd: | |
373 return ETextAlign::kEnd; | |
374 case ETextAlignLast::kLeft: | |
375 return ETextAlign::kLeft; | |
376 case ETextAlignLast::kRight: | |
377 return ETextAlign::kRight; | |
378 case ETextAlignLast::kCenter: | |
379 return ETextAlign::kCenter; | |
380 case ETextAlignLast::kJustify: | |
381 return ETextAlign::kJustify; | |
382 case ETextAlignLast::kAuto: | |
383 if (alignment == ETextAlign::kJustify) | |
384 return ETextAlign::kStart; | |
385 return alignment; | |
386 } | |
387 | |
388 return alignment; | |
389 } | 365 } |
390 | 366 |
391 static bool TextAlignmentNeedsTrailingSpace(ETextAlign text_align, | 367 static bool TextAlignmentNeedsTrailingSpace(ETextAlign text_align, |
392 const ComputedStyle& style) { | 368 const ComputedStyle& style) { |
393 switch (text_align) { | 369 switch (text_align) { |
394 case ETextAlign::kLeft: | 370 case ETextAlign::kLeft: |
395 case ETextAlign::kWebkitLeft: | 371 case ETextAlign::kWebkitLeft: |
396 return false; | 372 return false; |
397 case ETextAlign::kRight: | 373 case ETextAlign::kRight: |
398 case ETextAlign::kWebkitRight: | 374 case ETextAlign::kWebkitRight: |
(...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 | 2630 |
2655 bool LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() const { | 2631 bool LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() const { |
2656 // LayoutBlockFlow is in charge of paint invalidation of the first line. | 2632 // LayoutBlockFlow is in charge of paint invalidation of the first line. |
2657 if (FirstLineBox()) | 2633 if (FirstLineBox()) |
2658 return false; | 2634 return false; |
2659 | 2635 |
2660 return LayoutBlock::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 2636 return LayoutBlock::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
2661 } | 2637 } |
2662 | 2638 |
2663 } // namespace blink | 2639 } // namespace blink |
OLD | NEW |