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

Unified Diff: Source/core/editing/InsertParagraphSeparatorCommand.cpp

Issue 17381003: When trying to break a line after an image followed by some text, contrary to the expected behavior… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/editing/inserting/insert-paragraph-after-non-editable-node-before-text-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InsertParagraphSeparatorCommand.cpp
diff --git a/Source/core/editing/InsertParagraphSeparatorCommand.cpp b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
index cbfb99ffe943974088824d9f53bf77d5a566950b..3eca03506ca01381ae088077d269544c3a21db1a 100644
--- a/Source/core/editing/InsertParagraphSeparatorCommand.cpp
+++ b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
@@ -316,6 +316,15 @@ void InsertParagraphSeparatorCommand::doApply()
// before we walk the DOM tree.
insertionPosition = positionOutsideTabSpan(VisiblePosition(insertionPosition).deepEquivalent());
+ // If the returned position lies either at the end or at the start of an element that is ignored by editing
+ // we should move to its upstream or downstream position.
+ if (editingIgnoresContent(insertionPosition.deprecatedNode())) {
+ if (insertionPosition.atLastEditingPositionForNode())
+ insertionPosition = insertionPosition.downstream();
+ else if (insertionPosition.atFirstEditingPositionForNode())
+ insertionPosition = insertionPosition.upstream();
+ }
+
// Make sure we do not cause a rendered space to become unrendered.
// FIXME: We need the affinity for pos, but pos.downstream() does not give it
Position leadingWhitespace = insertionPosition.leadingWhitespacePosition(VP_DEFAULT_AFFINITY);
« no previous file with comments | « LayoutTests/editing/inserting/insert-paragraph-after-non-editable-node-before-text-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698