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 * Copyright (C) 2013 Adobe Systems Incorporated. | 5 * Copyright (C) 2013 Adobe Systems Incorporated. |
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 m_width.addUncommittedWidth((inlineLogicalWidth(m_current.object()) + border
PaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox)).toFloat()); | 450 m_width.addUncommittedWidth((inlineLogicalWidth(m_current.object()) + border
PaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox)).toFloat()); |
451 } | 451 } |
452 | 452 |
453 inline void BreakingContext::handleReplaced() | 453 inline void BreakingContext::handleReplaced() |
454 { | 454 { |
455 LineLayoutBox replacedBox(m_current.object()); | 455 LineLayoutBox replacedBox(m_current.object()); |
456 | 456 |
457 if (m_atStart) | 457 if (m_atStart) |
458 m_width.updateAvailableWidth(replacedBox.logicalHeight()); | 458 m_width.updateAvailableWidth(replacedBox.logicalHeight()); |
459 | 459 |
460 // Break on replaced elements if either has normal white-space. | 460 // Break on replaced elements if either has normal white-space, |
461 if ((m_autoWrap || ComputedStyle::autoWrap(m_lastWS)) && (!m_current.object(
).isImage() || m_allowImagesToBreak)) { | 461 // or if the replaced element is ruby that can break before. |
| 462 if ((m_autoWrap || ComputedStyle::autoWrap(m_lastWS)) && (!m_current.object(
).isImage() || m_allowImagesToBreak) |
| 463 && (!m_current.object().isRubyRun() || toLayoutRubyRun(m_current.object(
))->canBreakBefore(m_layoutTextInfo.m_lineBreakIterator))) { |
462 m_width.commit(); | 464 m_width.commit(); |
463 m_lineBreak.moveToStartOf(m_current.object()); | 465 m_lineBreak.moveToStartOf(m_current.object()); |
464 } | 466 } |
465 | 467 |
466 if (m_ignoringSpaces) | 468 if (m_ignoringSpaces) |
467 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.objec
t(), 0)); | 469 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.objec
t(), 0)); |
468 | 470 |
469 m_lineInfo.setEmpty(false, m_block, &m_width); | 471 m_lineInfo.setEmpty(false, m_block, &m_width); |
470 m_ignoringSpaces = false; | 472 m_ignoringSpaces = false; |
471 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = false
; | 473 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = false
; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 return; | 887 return; |
886 } | 888 } |
887 } else if (m_blockStyle->autoWrap() && !m_width.fitsOnLine() && !m_width.com
mittedWidth()) { | 889 } else if (m_blockStyle->autoWrap() && !m_width.fitsOnLine() && !m_width.com
mittedWidth()) { |
888 // If the container autowraps but the current child does not then we sti
ll need to ensure that it | 890 // If the container autowraps but the current child does not then we sti
ll need to ensure that it |
889 // wraps and moves below any floats. | 891 // wraps and moves below any floats. |
890 m_width.fitBelowFloats(m_lineInfo.isFirstLine()); | 892 m_width.fitBelowFloats(m_lineInfo.isFirstLine()); |
891 } | 893 } |
892 | 894 |
893 if (!m_current.object().isFloatingOrOutOfFlowPositioned()) { | 895 if (!m_current.object().isFloatingOrOutOfFlowPositioned()) { |
894 m_lastObject = m_current.object(); | 896 m_lastObject = m_current.object(); |
895 if (m_lastObject.isReplaced() && m_autoWrap && (!m_lastObject.isImage()
|| m_allowImagesToBreak) && (!m_lastObject.isListMarker() || LineLayoutListMarke
r(m_lastObject).isInside())) { | 897 if (m_lastObject.isReplaced() && m_autoWrap && (!m_lastObject.isImage()
|| m_allowImagesToBreak) && (!m_lastObject.isListMarker() || LineLayoutListMarke
r(m_lastObject).isInside()) |
| 898 && !m_lastObject.isRubyRun()) { |
896 m_width.commit(); | 899 m_width.commit(); |
897 m_lineBreak.moveToStartOf(m_nextObject); | 900 m_lineBreak.moveToStartOf(m_nextObject); |
898 } | 901 } |
899 } | 902 } |
900 } | 903 } |
901 | 904 |
902 inline IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, const ComputedStyle& style) | 905 inline IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, const ComputedStyle& style) |
903 { | 906 { |
904 IndentTextOrNot shouldIndentText = DoNotIndentText; | 907 IndentTextOrNot shouldIndentText = DoNotIndentText; |
905 if (isFirstLine || (isAfterHardLineBreak && style.textIndentLine()) == TextI
ndentEachLine) | 908 if (isFirstLine || (isAfterHardLineBreak && style.textIndentLine()) == TextI
ndentEachLine) |
906 shouldIndentText = IndentText; | 909 shouldIndentText = IndentText; |
907 | 910 |
908 if (style.textIndentType() == TextIndentHanging) | 911 if (style.textIndentType() == TextIndentHanging) |
909 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 912 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
910 | 913 |
911 return shouldIndentText; | 914 return shouldIndentText; |
912 } | 915 } |
913 | 916 |
914 } | 917 } |
915 | 918 |
916 #endif // BreakingContextInlineHeaders_h | 919 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |