| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 return false; | 732 return false; |
| 733 } | 733 } |
| 734 | 734 |
| 735 return true; | 735 return true; |
| 736 } | 736 } |
| 737 | 737 |
| 738 ALWAYS_INLINE int lastBreakablePositionForBreakAll(LineLayoutText text, | 738 ALWAYS_INLINE int lastBreakablePositionForBreakAll(LineLayoutText text, |
| 739 const ComputedStyle& style, | 739 const ComputedStyle& style, |
| 740 int start, | 740 int start, |
| 741 int end) { | 741 int end) { |
| 742 LazyLineBreakIterator lineBreakIterator(text.text(), style.locale()); | 742 LazyLineBreakIterator lineBreakIterator(text.text(), |
| 743 localeForLineBreakIterator(style)); |
| 743 int lastBreakablePosition = 0, nextBreakablePosition = -1; | 744 int lastBreakablePosition = 0, nextBreakablePosition = -1; |
| 744 for (int i = start;; i = nextBreakablePosition + 1) { | 745 for (int i = start;; i = nextBreakablePosition + 1) { |
| 745 lineBreakIterator.isBreakable(i, nextBreakablePosition, | 746 lineBreakIterator.isBreakable(i, nextBreakablePosition, |
| 746 LineBreakType::BreakAll); | 747 LineBreakType::BreakAll); |
| 747 if (nextBreakablePosition == end) | 748 if (nextBreakablePosition == end) |
| 748 return end; | 749 return end; |
| 749 if (nextBreakablePosition < 0 || nextBreakablePosition > end) | 750 if (nextBreakablePosition < 0 || nextBreakablePosition > end) |
| 750 return lastBreakablePosition; | 751 return lastBreakablePosition; |
| 751 lastBreakablePosition = nextBreakablePosition; | 752 lastBreakablePosition = nextBreakablePosition; |
| 752 } | 753 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 | 792 |
| 792 ALWAYS_INLINE bool BreakingContext::rewindToFirstMidWordBreak( | 793 ALWAYS_INLINE bool BreakingContext::rewindToFirstMidWordBreak( |
| 793 LineLayoutText text, | 794 LineLayoutText text, |
| 794 const ComputedStyle& style, | 795 const ComputedStyle& style, |
| 795 const Font& font, | 796 const Font& font, |
| 796 bool breakAll, | 797 bool breakAll, |
| 797 WordMeasurement& wordMeasurement) { | 798 WordMeasurement& wordMeasurement) { |
| 798 int start = wordMeasurement.startOffset; | 799 int start = wordMeasurement.startOffset; |
| 799 int end = canMidWordBreakBefore(text) ? start : start + 1; | 800 int end = canMidWordBreakBefore(text) ? start : start + 1; |
| 800 if (breakAll) { | 801 if (breakAll) { |
| 801 LazyLineBreakIterator lineBreakIterator(text.text(), style.locale()); | 802 LazyLineBreakIterator lineBreakIterator(text.text(), |
| 803 localeForLineBreakIterator(style)); |
| 802 int nextBreakable = -1; | 804 int nextBreakable = -1; |
| 803 lineBreakIterator.isBreakable(end, nextBreakable, LineBreakType::BreakAll); | 805 lineBreakIterator.isBreakable(end, nextBreakable, LineBreakType::BreakAll); |
| 804 if (nextBreakable < 0) | 806 if (nextBreakable < 0) |
| 805 return false; | 807 return false; |
| 806 end = nextBreakable; | 808 end = nextBreakable; |
| 807 } | 809 } |
| 808 if (end >= wordMeasurement.endOffset) | 810 if (end >= wordMeasurement.endOffset) |
| 809 return false; | 811 return false; |
| 810 | 812 |
| 811 float width = textWidth(text, start, end - start, font, | 813 float width = textWidth(text, start, end - start, font, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 if (layoutText.isWordBreak()) { | 982 if (layoutText.isWordBreak()) { |
| 981 m_width.commit(); | 983 m_width.commit(); |
| 982 m_lineBreak.moveToStartOf(m_current.getLineLayoutItem()); | 984 m_lineBreak.moveToStartOf(m_current.getLineLayoutItem()); |
| 983 ASSERT(m_current.offset() == layoutText.textLength()); | 985 ASSERT(m_current.offset() == layoutText.textLength()); |
| 984 } | 986 } |
| 985 | 987 |
| 986 if (m_layoutTextInfo.m_text != layoutText) { | 988 if (m_layoutTextInfo.m_text != layoutText) { |
| 987 m_layoutTextInfo.m_text = layoutText; | 989 m_layoutTextInfo.m_text = layoutText; |
| 988 m_layoutTextInfo.m_font = &font; | 990 m_layoutTextInfo.m_font = &font; |
| 989 m_layoutTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator( | 991 m_layoutTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator( |
| 990 layoutText.text(), style.locale()); | 992 layoutText.text(), localeForLineBreakIterator(style)); |
| 991 } else if (m_layoutTextInfo.m_font != &font) { | 993 } else if (m_layoutTextInfo.m_font != &font) { |
| 992 m_layoutTextInfo.m_font = &font; | 994 m_layoutTextInfo.m_font = &font; |
| 993 } | 995 } |
| 994 | 996 |
| 995 // Non-zero only when kerning is enabled, in which case we measure | 997 // Non-zero only when kerning is enabled, in which case we measure |
| 996 // words with their trailing space, then subtract its width. | 998 // words with their trailing space, then subtract its width. |
| 997 float wordTrailingSpaceWidth = | 999 float wordTrailingSpaceWidth = |
| 998 (font.getFontDescription().getTypesettingFeatures() & Kerning) | 1000 (font.getFontDescription().getTypesettingFeatures() & Kerning) |
| 999 ? font.width(constructTextRun(font, &spaceCharacter, 1, style, | 1001 ? font.width(constructTextRun(font, &spaceCharacter, 1, style, |
| 1000 style.direction())) + | 1002 style.direction())) + |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 | 1545 |
| 1544 if (style.getTextIndentType() == TextIndentHanging) | 1546 if (style.getTextIndentType() == TextIndentHanging) |
| 1545 indentText = indentText == IndentText ? DoNotIndentText : IndentText; | 1547 indentText = indentText == IndentText ? DoNotIndentText : IndentText; |
| 1546 | 1548 |
| 1547 return indentText; | 1549 return indentText; |
| 1548 } | 1550 } |
| 1549 | 1551 |
| 1550 } // namespace blink | 1552 } // namespace blink |
| 1551 | 1553 |
| 1552 #endif // BreakingContextInlineHeaders_h | 1554 #endif // BreakingContextInlineHeaders_h |
| OLD | NEW |