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

Side by Side Diff: Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp

Issue 1310043003: Introduce previousPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T16:28:03 Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 appendBlockPlaceholder(parent); 259 appendBlockPlaceholder(parent);
260 260
261 setEndingSelection(VisibleSelection(firstPositionInNode(parent.get()), T extAffinity::Downstream, endingSelection().isDirectional())); 261 setEndingSelection(VisibleSelection(firstPositionInNode(parent.get()), T extAffinity::Downstream, endingSelection().isDirectional()));
262 return; 262 return;
263 } 263 }
264 264
265 265
266 //--------------------------------------------------------------------- 266 //---------------------------------------------------------------------
267 // Handle case when position is in the first visible position in its block, and 267 // Handle case when position is in the first visible position in its block, and
268 // similar case where previous position is in another, presumeably nested, b lock. 268 // similar case where previous position is in another, presumeably nested, b lock.
269 if (isFirstInBlock || !inSameBlock(visiblePos, visiblePos.previous())) { 269 if (isFirstInBlock || !inSameBlock(visiblePos, previousPositionOf(visiblePos ))) {
270 Node* refNode = nullptr; 270 Node* refNode = nullptr;
271 insertionPosition = positionOutsideTabSpan(insertionPosition); 271 insertionPosition = positionOutsideTabSpan(insertionPosition);
272 272
273 if (isFirstInBlock && !nestNewBlock) { 273 if (isFirstInBlock && !nestNewBlock) {
274 if (listChild && listChild != startBlock) { 274 if (listChild && listChild != startBlock) {
275 RefPtrWillBeRawPtr<Element> listChildToInsert = listChild->clone ElementWithoutChildren(); 275 RefPtrWillBeRawPtr<Element> listChildToInsert = listChild->clone ElementWithoutChildren();
276 appendNode(blockToInsert, listChildToInsert.get()); 276 appendNode(blockToInsert, listChildToInsert.get());
277 insertNodeBefore(listChildToInsert.get(), listChild); 277 insertNodeBefore(listChildToInsert.get(), listChild);
278 } else { 278 } else {
279 refNode = startBlock.get(); 279 refNode = startBlock.get();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 433 }
434 434
435 DEFINE_TRACE(InsertParagraphSeparatorCommand) 435 DEFINE_TRACE(InsertParagraphSeparatorCommand)
436 { 436 {
437 visitor->trace(m_style); 437 visitor->trace(m_style);
438 CompositeEditCommand::trace(visitor); 438 CompositeEditCommand::trace(visitor);
439 } 439 }
440 440
441 441
442 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/commands/InsertListCommand.cpp ('k') | Source/core/editing/commands/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698