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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCur
rentWord.deepEquivalent() == previousWordPosition(nextWordPosition(originalPosit
ion)).deepEquivalent(); | 633 bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCur
rentWord.deepEquivalent() == previousWordPosition(nextWordPosition(originalPosit
ion)).deepEquivalent(); |
634 if (movingBackwardsMovedPositionToStartOfCurrentWord) | 634 if (movingBackwardsMovedPositionToStartOfCurrentWord) |
635 positionAfterCurrentWord = positionAfterSpacingAndFollowingWord; | 635 positionAfterCurrentWord = positionAfterSpacingAndFollowingWord; |
636 } | 636 } |
637 return positionAfterCurrentWord; | 637 return positionAfterCurrentWord; |
638 } | 638 } |
639 | 639 |
640 static void adjustPositionForUserSelectAll(VisiblePosition& pos, bool isForward) | 640 static void adjustPositionForUserSelectAll(VisiblePosition& pos, bool isForward) |
641 { | 641 { |
642 if (Node* rootUserSelectAll = EditingStrategy::rootUserSelectAllForNode(pos.
deepEquivalent().anchorNode())) | 642 if (Node* rootUserSelectAll = EditingStrategy::rootUserSelectAllForNode(pos.
deepEquivalent().anchorNode())) |
643 pos = VisiblePosition(isForward ? positionAfterNode(rootUserSelectAll).d
ownstream(CanCrossEditingBoundary) : positionBeforeNode(rootUserSelectAll).upstr
eam(CanCrossEditingBoundary)); | 643 pos = VisiblePosition(isForward ? mostForwardCaretPosition(positionAfter
Node(rootUserSelectAll), CanCrossEditingBoundary) : mostBackwardCaretPosition(po
sitionBeforeNode(rootUserSelectAll), CanCrossEditingBoundary)); |
644 } | 644 } |
645 | 645 |
646 VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity
) | 646 VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity
) |
647 { | 647 { |
648 VisiblePosition pos(m_selection.extent(), m_selection.affinity()); | 648 VisiblePosition pos(m_selection.extent(), m_selection.affinity()); |
649 | 649 |
650 // The difference between modifyExtendingRight and modifyExtendingForward is
: | 650 // The difference between modifyExtendingRight and modifyExtendingForward is
: |
651 // modifyExtendingForward always extends forward logically. | 651 // modifyExtendingForward always extends forward logically. |
652 // modifyExtendingRight behaves the same as modifyExtendingForward except fo
r extending character or word, | 652 // modifyExtendingRight behaves the same as modifyExtendingForward except fo
r extending character or word, |
653 // it extends forward logically if the enclosing block is LTR direction, | 653 // it extends forward logically if the enclosing block is LTR direction, |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 | 2058 |
2059 void showTree(const blink::FrameSelection* sel) | 2059 void showTree(const blink::FrameSelection* sel) |
2060 { | 2060 { |
2061 if (sel) | 2061 if (sel) |
2062 sel->showTreeForThis(); | 2062 sel->showTreeForThis(); |
2063 else | 2063 else |
2064 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2064 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
2065 } | 2065 } |
2066 | 2066 |
2067 #endif | 2067 #endif |
OLD | NEW |