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

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

Issue 1302353002: Get rid of redundant member function PositionAlgorithm<Strategy>::{upstream,downstream} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T04:51:20 Rebase Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = insertBlockPlacehold er(start.deepEquivalent()); 388 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = insertBlockPlacehold er(start.deepEquivalent());
389 start = VisiblePosition(positionBeforeNode(placeholder.get())); 389 start = VisiblePosition(positionBeforeNode(placeholder.get()));
390 end = start; 390 end = start;
391 } 391 }
392 392
393 // Insert the list at a position visually equivalent to start of the 393 // Insert the list at a position visually equivalent to start of the
394 // paragraph that is being moved into the list. 394 // paragraph that is being moved into the list.
395 // Try to avoid inserting it somewhere where it will be surrounded by 395 // Try to avoid inserting it somewhere where it will be surrounded by
396 // inline ancestors of start, since it is easier for editing to produce 396 // inline ancestors of start, since it is easier for editing to produce
397 // clean markup when inline elements are pushed down as far as possible. 397 // clean markup when inline elements are pushed down as far as possible.
398 Position insertionPos(start.deepEquivalent().upstream()); 398 Position insertionPos(mostBackwardCaretPosition(start.deepEquivalent())) ;
399 // Also avoid the containing list item. 399 // Also avoid the containing list item.
400 Node* listChild = enclosingListChild(insertionPos.anchorNode()); 400 Node* listChild = enclosingListChild(insertionPos.anchorNode());
401 if (isHTMLLIElement(listChild)) 401 if (isHTMLLIElement(listChild))
402 insertionPos = positionInParentBeforeNode(*listChild); 402 insertionPos = positionInParentBeforeNode(*listChild);
403 403
404 insertNodeAt(listElement, insertionPos); 404 insertNodeAt(listElement, insertionPos);
405 405
406 // We inserted the list at the start of the content we're about to move 406 // We inserted the list at the start of the content we're about to move
407 // Update the start of content, so we don't try to move the list into it self. bug 19066 407 // Update the start of content, so we don't try to move the list into it self. bug 19066
408 // Layout is necessary since start's node's inline layoutObjects may hav e been destroyed by the insertion 408 // Layout is necessary since start's node's inline layoutObjects may hav e been destroyed by the insertion
(...skipping 18 matching lines...) Expand all
427 return listElement; 427 return listElement;
428 } 428 }
429 429
430 DEFINE_TRACE(InsertListCommand) 430 DEFINE_TRACE(InsertListCommand)
431 { 431 {
432 visitor->trace(m_listElement); 432 visitor->trace(m_listElement);
433 CompositeEditCommand::trace(visitor); 433 CompositeEditCommand::trace(visitor);
434 } 434 }
435 435
436 } 436 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698