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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 { | 740 { |
741 VisiblePosition pos; | 741 VisiblePosition pos; |
742 switch (granularity) { | 742 switch (granularity) { |
743 case CharacterGranularity: | 743 case CharacterGranularity: |
744 if (isRange()) { | 744 if (isRange()) { |
745 if (directionOfSelection() == LTR) | 745 if (directionOfSelection() == LTR) |
746 pos = VisiblePosition(m_selection.end(), m_selection.affinity())
; | 746 pos = VisiblePosition(m_selection.end(), m_selection.affinity())
; |
747 else | 747 else |
748 pos = VisiblePosition(m_selection.start(), m_selection.affinity(
)); | 748 pos = VisiblePosition(m_selection.start(), m_selection.affinity(
)); |
749 } else { | 749 } else { |
750 pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).
right(); | 750 pos = rightPositionOf(VisiblePosition(m_selection.extent(), m_select
ion.affinity())); |
751 } | 751 } |
752 break; | 752 break; |
753 case WordGranularity: { | 753 case WordGranularity: { |
754 bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); | 754 bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); |
755 pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selectio
n.affinity()), skipsSpaceWhenMovingRight); | 755 pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selectio
n.affinity()), skipsSpaceWhenMovingRight); |
756 break; | 756 break; |
757 } | 757 } |
758 case SentenceGranularity: | 758 case SentenceGranularity: |
759 case LineGranularity: | 759 case LineGranularity: |
760 case ParagraphGranularity: | 760 case ParagraphGranularity: |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 { | 909 { |
910 VisiblePosition pos; | 910 VisiblePosition pos; |
911 switch (granularity) { | 911 switch (granularity) { |
912 case CharacterGranularity: | 912 case CharacterGranularity: |
913 if (isRange()) { | 913 if (isRange()) { |
914 if (directionOfSelection() == LTR) | 914 if (directionOfSelection() == LTR) |
915 pos = VisiblePosition(m_selection.start(), m_selection.affinity(
)); | 915 pos = VisiblePosition(m_selection.start(), m_selection.affinity(
)); |
916 else | 916 else |
917 pos = VisiblePosition(m_selection.end(), m_selection.affinity())
; | 917 pos = VisiblePosition(m_selection.end(), m_selection.affinity())
; |
918 } else { | 918 } else { |
919 pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).
left(); | 919 pos = leftPositionOf(VisiblePosition(m_selection.extent(), m_selecti
on.affinity())); |
920 } | 920 } |
921 break; | 921 break; |
922 case WordGranularity: { | 922 case WordGranularity: { |
923 bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); | 923 bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); |
924 pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection
.affinity()), skipsSpaceWhenMovingRight); | 924 pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection
.affinity()), skipsSpaceWhenMovingRight); |
925 break; | 925 break; |
926 } | 926 } |
927 case SentenceGranularity: | 927 case SentenceGranularity: |
928 case LineGranularity: | 928 case LineGranularity: |
929 case ParagraphGranularity: | 929 case ParagraphGranularity: |
(...skipping 1139 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 |