Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2250133004: No hang when inserting a list over uneditable element in contenteditable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra blanks in the test case Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/insert-list-over-uneditable-in-contenteditable.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/insert-list-over-uneditable-in-contenteditable.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698