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 * Copyright (C) 2013 Adobe Systems Incorporated. | 6 * Copyright (C) 2013 Adobe Systems Incorporated. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 if (!m_appliedStartWidth) { | 1106 if (!m_appliedStartWidth) { |
1107 m_width.addUncommittedWidth( | 1107 m_width.addUncommittedWidth( |
1108 inlineLogicalWidthFromAncestorsIfNeeded(m_current.getLineLayoutItem(), | 1108 inlineLogicalWidthFromAncestorsIfNeeded(m_current.getLineLayoutItem(), |
1109 true, false) | 1109 true, false) |
1110 .toFloat()); | 1110 .toFloat()); |
1111 m_appliedStartWidth = true; | 1111 m_appliedStartWidth = true; |
1112 } | 1112 } |
1113 | 1113 |
1114 midWordBreak = false; | 1114 midWordBreak = false; |
1115 if (!m_width.fitsOnLine()) { | 1115 if (!m_width.fitsOnLine()) { |
1116 if (hyphenation && (m_nextObject || isLineEmpty || | 1116 if (hyphenation && |
1117 hasVisibleText(layoutText, m_current.offset()))) { | 1117 (m_nextObject || isLineEmpty || |
| 1118 hasVisibleText(layoutText, m_current.offset()))) { |
1118 m_width.addUncommittedWidth(-wordMeasurement.width); | 1119 m_width.addUncommittedWidth(-wordMeasurement.width); |
1119 DCHECK(lastSpace == static_cast<unsigned>(wordMeasurement.startOffset)); | 1120 DCHECK(lastSpace == static_cast<unsigned>(wordMeasurement.startOffset)); |
1120 DCHECK(m_current.offset() == | 1121 DCHECK(m_current.offset() == |
1121 static_cast<unsigned>(wordMeasurement.endOffset)); | 1122 static_cast<unsigned>(wordMeasurement.endOffset)); |
1122 if (hyphenate(layoutText, style, font, *hyphenation, | 1123 if (hyphenate(layoutText, style, font, *hyphenation, |
1123 lastSpaceWordSpacing, wordMeasurement)) { | 1124 lastSpaceWordSpacing, wordMeasurement)) { |
1124 m_width.addUncommittedWidth(wordMeasurement.width); | 1125 m_width.addUncommittedWidth(wordMeasurement.width); |
1125 hyphenated = true; | 1126 hyphenated = true; |
1126 m_atEnd = true; | 1127 m_atEnd = true; |
1127 return false; | 1128 return false; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 float lastWidthMeasurement, | 1404 float lastWidthMeasurement, |
1404 const LineLayoutText& layoutText, | 1405 const LineLayoutText& layoutText, |
1405 const Font& font, | 1406 const Font& font, |
1406 bool applyWordSpacing, | 1407 bool applyWordSpacing, |
1407 float wordSpacing) { | 1408 float wordSpacing) { |
1408 if (!m_autoWrap && !breakWords) | 1409 if (!m_autoWrap && !breakWords) |
1409 return false; | 1410 return false; |
1410 | 1411 |
1411 // If we break only after white-space, consider the current character | 1412 // If we break only after white-space, consider the current character |
1412 // as candidate width for this line. | 1413 // as candidate width for this line. |
1413 if (midWordBreak || trailingSpaceExceedsAvailableWidth( | 1414 if (midWordBreak || |
1414 canBreakMidWord, layoutText, wordMeasurement, | 1415 trailingSpaceExceedsAvailableWidth(canBreakMidWord, layoutText, |
1415 applyWordSpacing, wordSpacing, font) || | 1416 wordMeasurement, applyWordSpacing, |
| 1417 wordSpacing, font) || |
1416 !m_width.fitsOnLine()) { | 1418 !m_width.fitsOnLine()) { |
1417 if (m_lineBreak.atTextParagraphSeparator()) { | 1419 if (m_lineBreak.atTextParagraphSeparator()) { |
1418 if (!stoppedIgnoringSpaces && m_current.offset() > 0) | 1420 if (!stoppedIgnoringSpaces && m_current.offset() > 0) |
1419 m_lineMidpointState.ensureCharacterGetsLineBox(m_current); | 1421 m_lineMidpointState.ensureCharacterGetsLineBox(m_current); |
1420 m_lineBreak.increment(); | 1422 m_lineBreak.increment(); |
1421 m_lineInfo.setPreviousLineBrokeCleanly(true); | 1423 m_lineInfo.setPreviousLineBrokeCleanly(true); |
1422 wordMeasurement.endOffset = m_lineBreak.offset(); | 1424 wordMeasurement.endOffset = m_lineBreak.offset(); |
1423 } | 1425 } |
1424 if (isBreakAtSoftHyphen() && !disableSoftHyphen) | 1426 if (isBreakAtSoftHyphen() && !disableSoftHyphen) |
1425 hyphenated = true; | 1427 hyphenated = true; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 | 1544 |
1543 if (style.getTextIndentType() == TextIndentHanging) | 1545 if (style.getTextIndentType() == TextIndentHanging) |
1544 indentText = indentText == IndentText ? DoNotIndentText : IndentText; | 1546 indentText = indentText == IndentText ? DoNotIndentText : IndentText; |
1545 | 1547 |
1546 return indentText; | 1548 return indentText; |
1547 } | 1549 } |
1548 | 1550 |
1549 } // namespace blink | 1551 } // namespace blink |
1550 | 1552 |
1551 #endif // BreakingContextInlineHeaders_h | 1553 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |