OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 PositionTemplate<Strategy> editablePosition = position; | 552 PositionTemplate<Strategy> editablePosition = position; |
553 | 553 |
554 if (position.anchorNode()->treeScope() != highestRoot.treeScope()) { | 554 if (position.anchorNode()->treeScope() != highestRoot.treeScope()) { |
555 Node* shadowAncestor = highestRoot.treeScope().ancestorInThisScope(edita
blePosition.anchorNode()); | 555 Node* shadowAncestor = highestRoot.treeScope().ancestorInThisScope(edita
blePosition.anchorNode()); |
556 if (!shadowAncestor) | 556 if (!shadowAncestor) |
557 return PositionTemplate<Strategy>(); | 557 return PositionTemplate<Strategy>(); |
558 | 558 |
559 editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor)
; | 559 editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor)
; |
560 } | 560 } |
561 | 561 |
562 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition
) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) | 562 Node* nonEditableNode = nullptr; |
| 563 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition
) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) { |
| 564 nonEditableNode = editablePosition.anchorNode(); |
563 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio
nTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVis
uallyDistinctCandidate(editablePosition); | 565 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio
nTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVis
uallyDistinctCandidate(editablePosition); |
| 566 } |
564 | 567 |
565 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe
stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) | 568 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe
stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) |
566 return PositionTemplate<Strategy>(); | 569 return PositionTemplate<Strategy>(); |
567 | 570 |
| 571 // If |editablePosition| has the non-editable child skipped, get the next si
bling position. |
| 572 // If not, we can't get the next paragraph in InsertListCommand::doApply's w
hile loop. |
| 573 // See http://crbug.com/571420 |
| 574 if (nonEditableNode && nonEditableNode->isDescendantOf(editablePosition.anch
orNode())) |
| 575 editablePosition = nextVisuallyDistinctCandidate(editablePosition); |
568 return editablePosition; | 576 return editablePosition; |
569 } | 577 } |
570 | 578 |
571 Position firstEditablePositionAfterPositionInRoot(const Position& position, Node
& highestRoot) | 579 Position firstEditablePositionAfterPositionInRoot(const Position& position, Node
& highestRoot) |
572 { | 580 { |
573 return firstEditablePositionAfterPositionInRootAlgorithm<EditingStrategy>(po
sition, highestRoot); | 581 return firstEditablePositionAfterPositionInRootAlgorithm<EditingStrategy>(po
sition, highestRoot); |
574 } | 582 } |
575 | 583 |
576 PositionInFlatTree firstEditablePositionAfterPositionInRoot(const PositionInFlat
Tree& position, Node& highestRoot) | 584 PositionInFlatTree firstEditablePositionAfterPositionInRoot(const PositionInFlat
Tree& position, Node& highestRoot) |
577 { | 585 { |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 return InputType::DeleteWordBackward; | 1906 return InputType::DeleteWordBackward; |
1899 if (granularity == LineBoundary) | 1907 if (granularity == LineBoundary) |
1900 return InputType::DeleteLineBackward; | 1908 return InputType::DeleteLineBackward; |
1901 return InputType::DeleteContentBackward; | 1909 return InputType::DeleteContentBackward; |
1902 default: | 1910 default: |
1903 return InputType::None; | 1911 return InputType::None; |
1904 } | 1912 } |
1905 } | 1913 } |
1906 | 1914 |
1907 } // namespace blink | 1915 } // namespace blink |
OLD | NEW |