Chromium Code Reviews| 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 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1665 return current - 1; | 1665 return current - 1; |
| 1666 | 1666 |
| 1667 long result = iterator->preceding(current); | 1667 long result = iterator->preceding(current); |
| 1668 if (result == TextBreakDone) | 1668 if (result == TextBreakDone) |
| 1669 result = current - 1; | 1669 result = current - 1; |
| 1670 | 1670 |
| 1671 | 1671 |
| 1672 return result; | 1672 return result; |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 #if OS(MACOSX) | 1675 #if OS(MACOSX) || OS(LINUX) |
|
lgombos
2013/10/31 02:18:51
Should this be OS(POSIX) instead to include Androi
| |
| 1676 | 1676 |
| 1677 #define HANGUL_CHOSEONG_START (0x1100) | 1677 #define HANGUL_CHOSEONG_START (0x1100) |
| 1678 #define HANGUL_CHOSEONG_END (0x115F) | 1678 #define HANGUL_CHOSEONG_END (0x115F) |
| 1679 #define HANGUL_JUNGSEONG_START (0x1160) | 1679 #define HANGUL_JUNGSEONG_START (0x1160) |
| 1680 #define HANGUL_JUNGSEONG_END (0x11A2) | 1680 #define HANGUL_JUNGSEONG_END (0x11A2) |
| 1681 #define HANGUL_JONGSEONG_START (0x11A8) | 1681 #define HANGUL_JONGSEONG_START (0x11A8) |
| 1682 #define HANGUL_JONGSEONG_END (0x11F9) | 1682 #define HANGUL_JONGSEONG_END (0x11F9) |
| 1683 #define HANGUL_SYLLABLE_START (0xAC00) | 1683 #define HANGUL_SYLLABLE_START (0xAC00) |
| 1684 #define HANGUL_SYLLABLE_END (0xD7AF) | 1684 #define HANGUL_SYLLABLE_END (0xD7AF) |
| 1685 #define HANGUL_JONGSEONG_COUNT (28) | 1685 #define HANGUL_JONGSEONG_COUNT (28) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1707 inline bool isRegionalIndicator(UChar32 c) | 1707 inline bool isRegionalIndicator(UChar32 c) |
| 1708 { | 1708 { |
| 1709 // National flag emoji each consists of a pair of regional indicator symbols . | 1709 // National flag emoji each consists of a pair of regional indicator symbols . |
| 1710 return 0x1F1E6 <= c && c <= 0x1F1FF; | 1710 return 0x1F1E6 <= c && c <= 0x1F1FF; |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 #endif | 1713 #endif |
| 1714 | 1714 |
| 1715 int RenderText::previousOffsetForBackwardDeletion(int current) const | 1715 int RenderText::previousOffsetForBackwardDeletion(int current) const |
| 1716 { | 1716 { |
| 1717 #if OS(MACOSX) | 1717 #if OS(MACOSX) || OS(LINUX) |
| 1718 ASSERT(m_text); | 1718 ASSERT(m_text); |
| 1719 StringImpl& text = *m_text.impl(); | 1719 StringImpl& text = *m_text.impl(); |
| 1720 UChar32 character; | 1720 UChar32 character; |
| 1721 bool sawRegionalIndicator = false; | 1721 bool sawRegionalIndicator = false; |
| 1722 while (current > 0) { | 1722 while (current > 0) { |
| 1723 if (U16_IS_TRAIL(text[--current])) | 1723 if (U16_IS_TRAIL(text[--current])) |
| 1724 --current; | 1724 --current; |
| 1725 if (current < 0) | 1725 if (current < 0) |
| 1726 break; | 1726 break; |
| 1727 | 1727 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1750 break; | 1750 break; |
| 1751 } | 1751 } |
| 1752 | 1752 |
| 1753 if (current <= 0) | 1753 if (current <= 0) |
| 1754 return current; | 1754 return current; |
| 1755 | 1755 |
| 1756 // Hangul | 1756 // Hangul |
| 1757 character = text.characterStartingAt(current); | 1757 character = text.characterStartingAt(current); |
| 1758 if (((character >= HANGUL_CHOSEONG_START) && (character <= HANGUL_JONGSEONG_ END)) || ((character >= HANGUL_SYLLABLE_START) && (character <= HANGUL_SYLLABLE_ END))) { | 1758 if (((character >= HANGUL_CHOSEONG_START) && (character <= HANGUL_JONGSEONG_ END)) || ((character >= HANGUL_SYLLABLE_START) && (character <= HANGUL_SYLLABLE_ END))) { |
| 1759 HangulState state; | 1759 HangulState state; |
| 1760 HangulState initialState; | |
| 1761 | 1760 |
| 1762 if (character < HANGUL_JUNGSEONG_START) | 1761 if (character < HANGUL_JUNGSEONG_START) |
| 1763 state = HangulStateL; | 1762 state = HangulStateL; |
| 1764 else if (character < HANGUL_JONGSEONG_START) | 1763 else if (character < HANGUL_JONGSEONG_START) |
| 1765 state = HangulStateV; | 1764 state = HangulStateV; |
| 1766 else if (character < HANGUL_SYLLABLE_START) | 1765 else if (character < HANGUL_SYLLABLE_START) |
| 1767 state = HangulStateT; | 1766 state = HangulStateT; |
| 1768 else | 1767 else |
| 1769 state = isHangulLVT(character) ? HangulStateLVT : HangulStateLV; | 1768 state = isHangulLVT(character) ? HangulStateLVT : HangulStateLV; |
| 1770 | 1769 |
| 1771 initialState = state; | |
| 1772 | |
| 1773 while (current > 0 && ((character = text.characterStartingAt(current - 1 )) >= HANGUL_CHOSEONG_START) && (character <= HANGUL_SYLLABLE_END) && ((characte r <= HANGUL_JONGSEONG_END) || (character >= HANGUL_SYLLABLE_START))) { | 1770 while (current > 0 && ((character = text.characterStartingAt(current - 1 )) >= HANGUL_CHOSEONG_START) && (character <= HANGUL_SYLLABLE_END) && ((characte r <= HANGUL_JONGSEONG_END) || (character >= HANGUL_SYLLABLE_START))) { |
| 1774 switch (state) { | 1771 switch (state) { |
| 1775 case HangulStateV: | 1772 case HangulStateV: |
| 1776 if (character <= HANGUL_CHOSEONG_END) | 1773 if (character <= HANGUL_CHOSEONG_END) |
| 1777 state = HangulStateL; | 1774 state = HangulStateL; |
| 1778 else if ((character >= HANGUL_SYLLABLE_START) && (character <= H ANGUL_SYLLABLE_END) && !isHangulLVT(character)) | 1775 else if ((character >= HANGUL_SYLLABLE_START) && (character <= H ANGUL_SYLLABLE_END) && !isHangulLVT(character)) |
| 1779 state = HangulStateLV; | 1776 state = HangulStateLV; |
| 1780 else if (character > HANGUL_JUNGSEONG_END) | 1777 else if (character > HANGUL_JUNGSEONG_END) |
| 1781 state = HangulStateBreak; | 1778 state = HangulStateBreak; |
| 1782 break; | 1779 break; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1794 } | 1791 } |
| 1795 if (state == HangulStateBreak) | 1792 if (state == HangulStateBreak) |
| 1796 break; | 1793 break; |
| 1797 | 1794 |
| 1798 --current; | 1795 --current; |
| 1799 } | 1796 } |
| 1800 } | 1797 } |
| 1801 | 1798 |
| 1802 return current; | 1799 return current; |
| 1803 #else | 1800 #else |
| 1804 // Platforms other than Mac delete by one code point. | 1801 // Platforms other than Mac or Linux delete by one code point. |
| 1805 if (U16_IS_TRAIL(m_text[--current])) | 1802 if (U16_IS_TRAIL(m_text[--current])) |
| 1806 --current; | 1803 --current; |
| 1807 if (current < 0) | 1804 if (current < 0) |
| 1808 current = 0; | 1805 current = 0; |
| 1809 return current; | 1806 return current; |
| 1810 #endif | 1807 #endif |
| 1811 } | 1808 } |
| 1812 | 1809 |
| 1813 int RenderText::nextOffset(int current) const | 1810 int RenderText::nextOffset(int current) const |
| 1814 { | 1811 { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1858 | 1855 |
| 1859 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); | 1856 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); |
| 1860 if (!secureTextTimer) { | 1857 if (!secureTextTimer) { |
| 1861 secureTextTimer = new SecureTextTimer(this); | 1858 secureTextTimer = new SecureTextTimer(this); |
| 1862 gSecureTextTimers->add(this, secureTextTimer); | 1859 gSecureTextTimers->add(this, secureTextTimer); |
| 1863 } | 1860 } |
| 1864 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); | 1861 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
| 1865 } | 1862 } |
| 1866 | 1863 |
| 1867 } // namespace WebCore | 1864 } // namespace WebCore |
| OLD | NEW |