Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 1824143003: [All-In-One] Introduce BackspaceStateMachine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 return current - 1; 1667 return current - 1;
1668 1668
1669 long result = iterator->preceding(current); 1669 long result = iterator->preceding(current);
1670 if (result == TextBreakDone) 1670 if (result == TextBreakDone)
1671 result = current - 1; 1671 result = current - 1;
1672 1672
1673 1673
1674 return result; 1674 return result;
1675 } 1675 }
1676 1676
1677 int LayoutText::previousOffsetForBackwardDeletion(int current) const
1678 {
1679 // Delete by one code point. Ideally we should delete grapheme where that
1680 // makes sense. https://crbug.com/587241
1681 if (U16_IS_TRAIL(m_text[--current]))
1682 --current;
1683 if (current < 0)
1684 current = 0;
1685 return current;
1686 }
1687
1688 int LayoutText::nextOffset(int current) const 1677 int LayoutText::nextOffset(int current) const
1689 { 1678 {
1690 if (m_text.is8Bit()) 1679 if (m_text.is8Bit())
1691 return current + 1; 1680 return current + 1;
1692 1681
1693 StringImpl* textImpl = m_text.impl(); 1682 StringImpl* textImpl = m_text.impl();
1694 TextBreakIterator* iterator = cursorMovementIterator(textImpl->characters16( ), textImpl->length()); 1683 TextBreakIterator* iterator = cursorMovementIterator(textImpl->characters16( ), textImpl->length());
1695 if (!iterator) 1684 if (!iterator)
1696 return current + 1; 1685 return current + 1;
1697 1686
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1740 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1752 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1741 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1753 if (box->truncation() != cNoTruncation) { 1742 if (box->truncation() != cNoTruncation) {
1754 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1743 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1755 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox, invalidationReason); 1744 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox, invalidationReason);
1756 } 1745 }
1757 } 1746 }
1758 } 1747 }
1759 1748
1760 } // namespace blink 1749 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698