| 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 m_current.setNextBreakablePosition(nextBreakablePosition); | 992 m_current.setNextBreakablePosition(nextBreakablePosition); |
| 993 | 993 |
| 994 // If we're in the middle of a word or at the start of a new one and can't | 994 // If we're in the middle of a word or at the start of a new one and can't |
| 995 // break there, then continue to the next character. | 995 // break there, then continue to the next character. |
| 996 if (!betweenWords && !midWordBreak) { | 996 if (!betweenWords && !midWordBreak) { |
| 997 if (m_ignoringSpaces) { | 997 if (m_ignoringSpaces) { |
| 998 // Stop ignoring spaces and begin at this | 998 // Stop ignoring spaces and begin at this |
| 999 // new point. | 999 // new point. |
| 1000 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; | 1000 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; |
| 1001 wordSpacingForWordMeasurement = | 1001 wordSpacingForWordMeasurement = |
| 1002 (applyWordSpacing && wordMeasurements.last().width) ? wordSpacing | 1002 (applyWordSpacing && wordMeasurements.back().width) ? wordSpacing |
| 1003 : 0; | 1003 : 0; |
| 1004 stopIgnoringSpaces(lastSpace); | 1004 stopIgnoringSpaces(lastSpace); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 prepareForNextCharacter(layoutText, prohibitBreakInside, | 1007 prepareForNextCharacter(layoutText, prohibitBreakInside, |
| 1008 previousCharacterIsSpace); | 1008 previousCharacterIsSpace); |
| 1009 m_atStart = false; | 1009 m_atStart = false; |
| 1010 nextCharacter(c, lastCharacter, secondToLastCharacter); | 1010 nextCharacter(c, lastCharacter, secondToLastCharacter); |
| 1011 continue; | 1011 continue; |
| 1012 } | 1012 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 prepareForNextCharacter(layoutText, prohibitBreakInside, | 1161 prepareForNextCharacter(layoutText, prohibitBreakInside, |
| 1162 previousCharacterIsSpace); | 1162 previousCharacterIsSpace); |
| 1163 m_atStart = false; | 1163 m_atStart = false; |
| 1164 nextCharacter(c, lastCharacter, secondToLastCharacter); | 1164 nextCharacter(c, lastCharacter, secondToLastCharacter); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 m_layoutTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, | 1167 m_layoutTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, |
| 1168 secondToLastCharacter); | 1168 secondToLastCharacter); |
| 1169 | 1169 |
| 1170 wordMeasurements.grow(wordMeasurements.size() + 1); | 1170 wordMeasurements.grow(wordMeasurements.size() + 1); |
| 1171 WordMeasurement& wordMeasurement = wordMeasurements.last(); | 1171 WordMeasurement& wordMeasurement = wordMeasurements.back(); |
| 1172 wordMeasurement.layoutText = layoutText; | 1172 wordMeasurement.layoutText = layoutText; |
| 1173 | 1173 |
| 1174 // IMPORTANT: current.offset() is > layoutText.textLength() here! | 1174 // IMPORTANT: current.offset() is > layoutText.textLength() here! |
| 1175 float lastWidthMeasurement = 0; | 1175 float lastWidthMeasurement = 0; |
| 1176 wordMeasurement.startOffset = lastSpace; | 1176 wordMeasurement.startOffset = lastSpace; |
| 1177 wordMeasurement.endOffset = m_current.offset(); | 1177 wordMeasurement.endOffset = m_current.offset(); |
| 1178 midWordBreak = false; | 1178 midWordBreak = false; |
| 1179 if (!m_ignoringSpaces) { | 1179 if (!m_ignoringSpaces) { |
| 1180 lastWidthMeasurement = | 1180 lastWidthMeasurement = |
| 1181 textWidth(layoutText, lastSpace, m_current.offset() - lastSpace, font, | 1181 textWidth(layoutText, lastSpace, m_current.offset() - lastSpace, font, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 inline WordMeasurement& BreakingContext::calculateWordWidth( | 1276 inline WordMeasurement& BreakingContext::calculateWordWidth( |
| 1277 WordMeasurements& wordMeasurements, | 1277 WordMeasurements& wordMeasurements, |
| 1278 LineLayoutText& layoutText, | 1278 LineLayoutText& layoutText, |
| 1279 unsigned lastSpace, | 1279 unsigned lastSpace, |
| 1280 float& lastWidthMeasurement, | 1280 float& lastWidthMeasurement, |
| 1281 float wordSpacingForWordMeasurement, | 1281 float wordSpacingForWordMeasurement, |
| 1282 const Font& font, | 1282 const Font& font, |
| 1283 float wordTrailingSpaceWidth, | 1283 float wordTrailingSpaceWidth, |
| 1284 UChar c) { | 1284 UChar c) { |
| 1285 wordMeasurements.grow(wordMeasurements.size() + 1); | 1285 wordMeasurements.grow(wordMeasurements.size() + 1); |
| 1286 WordMeasurement& wordMeasurement = wordMeasurements.last(); | 1286 WordMeasurement& wordMeasurement = wordMeasurements.back(); |
| 1287 wordMeasurement.layoutText = layoutText; | 1287 wordMeasurement.layoutText = layoutText; |
| 1288 wordMeasurement.endOffset = m_current.offset(); | 1288 wordMeasurement.endOffset = m_current.offset(); |
| 1289 wordMeasurement.startOffset = lastSpace; | 1289 wordMeasurement.startOffset = lastSpace; |
| 1290 | 1290 |
| 1291 if (wordTrailingSpaceWidth && c == spaceCharacter) | 1291 if (wordTrailingSpaceWidth && c == spaceCharacter) |
| 1292 lastWidthMeasurement = | 1292 lastWidthMeasurement = |
| 1293 textWidth(layoutText, lastSpace, m_current.offset() + 1 - lastSpace, | 1293 textWidth(layoutText, lastSpace, m_current.offset() + 1 - lastSpace, |
| 1294 font, m_width.currentWidth(), m_collapseWhiteSpace, | 1294 font, m_width.currentWidth(), m_collapseWhiteSpace, |
| 1295 &wordMeasurement.fallbackFonts, | 1295 &wordMeasurement.fallbackFonts, |
| 1296 &wordMeasurement.glyphBounds) - | 1296 &wordMeasurement.glyphBounds) - |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 | 1491 |
| 1492 if (style.getTextIndentType() == TextIndentHanging) | 1492 if (style.getTextIndentType() == TextIndentHanging) |
| 1493 indentText = indentText == IndentText ? DoNotIndentText : IndentText; | 1493 indentText = indentText == IndentText ? DoNotIndentText : IndentText; |
| 1494 | 1494 |
| 1495 return indentText; | 1495 return indentText; |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 } // namespace blink | 1498 } // namespace blink |
| 1499 | 1499 |
| 1500 #endif // BreakingContextInlineHeaders_h | 1500 #endif // BreakingContextInlineHeaders_h |
| OLD | NEW |