| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 VisiblePosition pos(m_selection.extent(), m_selection.affinity()); | 659 VisiblePosition pos(m_selection.extent(), m_selection.affinity()); |
| 660 | 660 |
| 661 // The difference between modifyExtendingRight and modifyExtendingForward is
: | 661 // The difference between modifyExtendingRight and modifyExtendingForward is
: |
| 662 // modifyExtendingForward always extends forward logically. | 662 // modifyExtendingForward always extends forward logically. |
| 663 // modifyExtendingRight behaves the same as modifyExtendingForward except fo
r extending character or word, | 663 // modifyExtendingRight behaves the same as modifyExtendingForward except fo
r extending character or word, |
| 664 // it extends forward logically if the enclosing block is LTR direction, | 664 // it extends forward logically if the enclosing block is LTR direction, |
| 665 // but it extends backward logically if the enclosing block is RTL direction
. | 665 // but it extends backward logically if the enclosing block is RTL direction
. |
| 666 switch (granularity) { | 666 switch (granularity) { |
| 667 case CharacterGranularity: | 667 case CharacterGranularity: |
| 668 if (directionOfEnclosingBlock() == LTR) | 668 if (directionOfEnclosingBlock() == LTR) |
| 669 pos = pos.next(CanSkipOverEditingBoundary); | 669 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); |
| 670 else | 670 else |
| 671 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); | 671 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); |
| 672 break; | 672 break; |
| 673 case WordGranularity: | 673 case WordGranularity: |
| 674 if (directionOfEnclosingBlock() == LTR) | 674 if (directionOfEnclosingBlock() == LTR) |
| 675 pos = nextWordPositionForPlatform(pos); | 675 pos = nextWordPositionForPlatform(pos); |
| 676 else | 676 else |
| 677 pos = previousWordPosition(pos); | 677 pos = previousWordPosition(pos); |
| 678 break; | 678 break; |
| 679 case LineBoundary: | 679 case LineBoundary: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 694 } | 694 } |
| 695 adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR); | 695 adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR); |
| 696 return pos; | 696 return pos; |
| 697 } | 697 } |
| 698 | 698 |
| 699 VisiblePosition FrameSelection::modifyExtendingForward(TextGranularity granulari
ty) | 699 VisiblePosition FrameSelection::modifyExtendingForward(TextGranularity granulari
ty) |
| 700 { | 700 { |
| 701 VisiblePosition pos(m_selection.extent(), m_selection.affinity()); | 701 VisiblePosition pos(m_selection.extent(), m_selection.affinity()); |
| 702 switch (granularity) { | 702 switch (granularity) { |
| 703 case CharacterGranularity: | 703 case CharacterGranularity: |
| 704 pos = pos.next(CanSkipOverEditingBoundary); | 704 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); |
| 705 break; | 705 break; |
| 706 case WordGranularity: | 706 case WordGranularity: |
| 707 pos = nextWordPositionForPlatform(pos); | 707 pos = nextWordPositionForPlatform(pos); |
| 708 break; | 708 break; |
| 709 case SentenceGranularity: | 709 case SentenceGranularity: |
| 710 pos = nextSentencePosition(pos); | 710 pos = nextSentencePosition(pos); |
| 711 break; | 711 break; |
| 712 case LineGranularity: | 712 case LineGranularity: |
| 713 pos = nextLinePosition(pos, lineDirectionPointForBlockDirectionNavigatio
n(EXTENT)); | 713 pos = nextLinePosition(pos, lineDirectionPointForBlockDirectionNavigatio
n(EXTENT)); |
| 714 break; | 714 break; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 | 773 |
| 774 VisiblePosition FrameSelection::modifyMovingForward(TextGranularity granularity) | 774 VisiblePosition FrameSelection::modifyMovingForward(TextGranularity granularity) |
| 775 { | 775 { |
| 776 VisiblePosition pos; | 776 VisiblePosition pos; |
| 777 // FIXME: Stay in editable content for the less common granularities. | 777 // FIXME: Stay in editable content for the less common granularities. |
| 778 switch (granularity) { | 778 switch (granularity) { |
| 779 case CharacterGranularity: | 779 case CharacterGranularity: |
| 780 if (isRange()) | 780 if (isRange()) |
| 781 pos = VisiblePosition(m_selection.end(), m_selection.affinity()); | 781 pos = VisiblePosition(m_selection.end(), m_selection.affinity()); |
| 782 else | 782 else |
| 783 pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).
next(CanSkipOverEditingBoundary); | 783 pos = nextPositionOf(VisiblePosition(m_selection.extent(), m_selecti
on.affinity()), CanSkipOverEditingBoundary); |
| 784 break; | 784 break; |
| 785 case WordGranularity: | 785 case WordGranularity: |
| 786 pos = nextWordPositionForPlatform(VisiblePosition(m_selection.extent(),
m_selection.affinity())); | 786 pos = nextWordPositionForPlatform(VisiblePosition(m_selection.extent(),
m_selection.affinity())); |
| 787 break; | 787 break; |
| 788 case SentenceGranularity: | 788 case SentenceGranularity: |
| 789 pos = nextSentencePosition(VisiblePosition(m_selection.extent(), m_selec
tion.affinity())); | 789 pos = nextSentencePosition(VisiblePosition(m_selection.extent(), m_selec
tion.affinity())); |
| 790 break; | 790 break; |
| 791 case LineGranularity: { | 791 case LineGranularity: { |
| 792 // down-arrowing from a range selection that ends at the start of a line
needs | 792 // down-arrowing from a range selection that ends at the start of a line
needs |
| 793 // to leave the selection at that line start (no need to call nextLinePo
sition!) | 793 // to leave the selection at that line start (no need to call nextLinePo
sition!) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 // The difference between modifyExtendingLeft and modifyExtendingBackward is
: | 826 // The difference between modifyExtendingLeft and modifyExtendingBackward is
: |
| 827 // modifyExtendingBackward always extends backward logically. | 827 // modifyExtendingBackward always extends backward logically. |
| 828 // modifyExtendingLeft behaves the same as modifyExtendingBackward except fo
r extending character or word, | 828 // modifyExtendingLeft behaves the same as modifyExtendingBackward except fo
r extending character or word, |
| 829 // it extends backward logically if the enclosing block is LTR direction, | 829 // it extends backward logically if the enclosing block is LTR direction, |
| 830 // but it extends forward logically if the enclosing block is RTL direction. | 830 // but it extends forward logically if the enclosing block is RTL direction. |
| 831 switch (granularity) { | 831 switch (granularity) { |
| 832 case CharacterGranularity: | 832 case CharacterGranularity: |
| 833 if (directionOfEnclosingBlock() == LTR) | 833 if (directionOfEnclosingBlock() == LTR) |
| 834 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); | 834 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); |
| 835 else | 835 else |
| 836 pos = pos.next(CanSkipOverEditingBoundary); | 836 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); |
| 837 break; | 837 break; |
| 838 case WordGranularity: | 838 case WordGranularity: |
| 839 if (directionOfEnclosingBlock() == LTR) | 839 if (directionOfEnclosingBlock() == LTR) |
| 840 pos = previousWordPosition(pos); | 840 pos = previousWordPosition(pos); |
| 841 else | 841 else |
| 842 pos = nextWordPositionForPlatform(pos); | 842 pos = nextWordPositionForPlatform(pos); |
| 843 break; | 843 break; |
| 844 case LineBoundary: | 844 case LineBoundary: |
| 845 if (directionOfEnclosingBlock() == LTR) | 845 if (directionOfEnclosingBlock() == LTR) |
| 846 pos = modifyExtendingBackward(granularity); | 846 pos = modifyExtendingBackward(granularity); |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 | 2069 |
| 2070 void showTree(const blink::FrameSelection* sel) | 2070 void showTree(const blink::FrameSelection* sel) |
| 2071 { | 2071 { |
| 2072 if (sel) | 2072 if (sel) |
| 2073 sel->showTreeForThis(); | 2073 sel->showTreeForThis(); |
| 2074 else | 2074 else |
| 2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 #endif | 2078 #endif |
| OLD | NEW |