| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 return false; | 643 return false; |
| 644 | 644 |
| 645 TextRun run = constructTextRun(font, text, start, len, style); | 645 TextRun run = constructTextRun(font, text, start, len, style); |
| 646 run.setTabSize(!m_collapseWhiteSpace, style.getTabSize()); | 646 run.setTabSize(!m_collapseWhiteSpace, style.getTabSize()); |
| 647 run.setXPos(m_width.currentWidth()); | 647 run.setXPos(m_width.currentWidth()); |
| 648 unsigned maxPrefixLength = font.offsetForPosition(run, maxPrefixWidth, false
); | 648 unsigned maxPrefixLength = font.offsetForPosition(run, maxPrefixWidth, false
); |
| 649 if (maxPrefixLength < Hyphenation::minimumPrefixLength) | 649 if (maxPrefixLength < Hyphenation::minimumPrefixLength) |
| 650 return false; | 650 return false; |
| 651 | 651 |
| 652 unsigned prefixLength = hyphenation.lastHyphenLocation( | 652 unsigned prefixLength = hyphenation.lastHyphenLocation( |
| 653 StringView(text.text(), start, len), | 653 text.text().createView(start, len), |
| 654 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1); | 654 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1); |
| 655 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength) | 655 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength) |
| 656 return false; | 656 return false; |
| 657 | 657 |
| 658 // TODO(kojii): getCharacterRange() measures as if the word were not broken | 658 // TODO(kojii): getCharacterRange() measures as if the word were not broken |
| 659 // as defined in the spec, and is faster than measuring each fragment, but | 659 // as defined in the spec, and is faster than measuring each fragment, but |
| 660 // ignores the kerning between the last letter and the hyphen. | 660 // ignores the kerning between the last letter and the hyphen. |
| 661 return rewindToMidWordBreak(wordMeasurement, start + prefixLength, | 661 return rewindToMidWordBreak(wordMeasurement, start + prefixLength, |
| 662 font.getCharacterRange(run, 0, prefixLength).width() + hyphenWidth); | 662 font.getCharacterRange(run, 0, prefixLength).width() + hyphenWidth); |
| 663 } | 663 } |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 | 1152 |
| 1153 if (style.getTextIndentType() == TextIndentHanging) | 1153 if (style.getTextIndentType() == TextIndentHanging) |
| 1154 indentText = indentText == IndentText ? DoNotIndentText : IndentText; | 1154 indentText = indentText == IndentText ? DoNotIndentText : IndentText; |
| 1155 | 1155 |
| 1156 return indentText; | 1156 return indentText; |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 } // namespace blink | 1159 } // namespace blink |
| 1160 | 1160 |
| 1161 #endif // BreakingContextInlineHeaders_h | 1161 #endif // BreakingContextInlineHeaders_h |
| OLD | NEW |