| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 unsigned LayoutText::resolvedTextLength() const | 1651 unsigned LayoutText::resolvedTextLength() const |
| 1652 { | 1652 { |
| 1653 int len = 0; | 1653 int len = 0; |
| 1654 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) | 1654 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) |
| 1655 len += box->len(); | 1655 len += box->len(); |
| 1656 return len; | 1656 return len; |
| 1657 } | 1657 } |
| 1658 | 1658 |
| 1659 int LayoutText::previousOffset(int current) const | |
| 1660 { | |
| 1661 if (m_text.is8Bit()) | |
| 1662 return current - 1; | |
| 1663 | |
| 1664 StringImpl* textImpl = m_text.impl(); | |
| 1665 TextBreakIterator* iterator = cursorMovementIterator(textImpl->characters16(
), textImpl->length()); | |
| 1666 if (!iterator) | |
| 1667 return current - 1; | |
| 1668 | |
| 1669 long result = iterator->preceding(current); | |
| 1670 if (result == TextBreakDone) | |
| 1671 result = current - 1; | |
| 1672 | |
| 1673 | |
| 1674 return result; | |
| 1675 } | |
| 1676 | |
| 1677 int LayoutText::previousOffsetForBackwardDeletion(int current) const | 1659 int LayoutText::previousOffsetForBackwardDeletion(int current) const |
| 1678 { | 1660 { |
| 1679 // Delete by one code point. Ideally we should delete grapheme where that | 1661 // Delete by one code point. Ideally we should delete grapheme where that |
| 1680 // makes sense. https://crbug.com/587241 | 1662 // makes sense. https://crbug.com/587241 |
| 1681 if (U16_IS_TRAIL(m_text[--current])) | 1663 if (U16_IS_TRAIL(m_text[--current])) |
| 1682 --current; | 1664 --current; |
| 1683 if (current < 0) | 1665 if (current < 0) |
| 1684 current = 0; | 1666 current = 0; |
| 1685 return current; | 1667 return current; |
| 1686 } | 1668 } |
| 1687 | 1669 |
| 1688 int LayoutText::nextOffset(int current) const | |
| 1689 { | |
| 1690 if (m_text.is8Bit()) | |
| 1691 return current + 1; | |
| 1692 | |
| 1693 StringImpl* textImpl = m_text.impl(); | |
| 1694 TextBreakIterator* iterator = cursorMovementIterator(textImpl->characters16(
), textImpl->length()); | |
| 1695 if (!iterator) | |
| 1696 return current + 1; | |
| 1697 | |
| 1698 long result = iterator->following(current); | |
| 1699 if (result == TextBreakDone) | |
| 1700 result = current + 1; | |
| 1701 | |
| 1702 return result; | |
| 1703 } | |
| 1704 | |
| 1705 bool LayoutText::computeCanUseSimpleFontCodePath() const | 1670 bool LayoutText::computeCanUseSimpleFontCodePath() const |
| 1706 { | 1671 { |
| 1707 if (m_text.is8Bit()) | 1672 if (m_text.is8Bit()) |
| 1708 return true; | 1673 return true; |
| 1709 return Character::characterRangeCodePath(characters16(), length()) == Simple
Path; | 1674 return Character::characterRangeCodePath(characters16(), length()) == Simple
Path; |
| 1710 } | 1675 } |
| 1711 | 1676 |
| 1712 #if ENABLE(ASSERT) | 1677 #if ENABLE(ASSERT) |
| 1713 | 1678 |
| 1714 void LayoutText::checkConsistency() const | 1679 void LayoutText::checkConsistency() const |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 1716 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
| 1752 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in
validationReason); | 1717 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in
validationReason); |
| 1753 if (box->truncation() != cNoTruncation) { | 1718 if (box->truncation() != cNoTruncation) { |
| 1754 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) | 1719 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) |
| 1755 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(
*ellipsisBox, invalidationReason); | 1720 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(
*ellipsisBox, invalidationReason); |
| 1756 } | 1721 } |
| 1757 } | 1722 } |
| 1758 } | 1723 } |
| 1759 | 1724 |
| 1760 } // namespace blink | 1725 } // namespace blink |
| OLD | NEW |