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

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

Issue 1702233002: Editing: Make the |EditingState*| argument of CompositeEditCommand::insertNodeAt mandatory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (editingState->isAborted()) 381 if (editingState->isAborted())
382 return; 382 return;
383 } 383 }
384 384
385 // Make sure empty cell has some height, if a placeholder can be inserte d. 385 // Make sure empty cell has some height, if a placeholder can be inserte d.
386 document().updateLayoutIgnorePendingStylesheets(); 386 document().updateLayoutIgnorePendingStylesheets();
387 LayoutObject* r = node->layoutObject(); 387 LayoutObject* r = node->layoutObject();
388 if (r && r->isTableCell() && toLayoutTableCell(r)->contentHeight() <= 0) { 388 if (r && r->isTableCell() && toLayoutTableCell(r)->contentHeight() <= 0) {
389 Position firstEditablePosition = firstEditablePositionInNode(node.ge t()); 389 Position firstEditablePosition = firstEditablePositionInNode(node.ge t());
390 if (firstEditablePosition.isNotNull()) 390 if (firstEditablePosition.isNotNull())
391 insertBlockPlaceholder(firstEditablePosition); 391 insertBlockPlaceholder(firstEditablePosition, editingState);
392 } 392 }
393 return; 393 return;
394 } 394 }
395 395
396 if (node == m_startBlock) { 396 if (node == m_startBlock) {
397 VisiblePosition previous = previousPositionOf(createVisiblePosition(firs tPositionInNode(m_startBlock.get()))); 397 VisiblePosition previous = previousPositionOf(createVisiblePosition(firs tPositionInNode(m_startBlock.get())));
398 if (previous.isNotNull() && !isEndOfBlock(previous)) 398 if (previous.isNotNull() && !isEndOfBlock(previous))
399 m_needPlaceholder = true; 399 m_needPlaceholder = true;
400 } 400 }
401 if (node == m_endBlock) { 401 if (node == m_endBlock) {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = m_needPlaceholder ? HTMLBREl ement::create(document()) : nullptr; 909 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = m_needPlaceholder ? HTMLBREl ement::create(document()) : nullptr;
910 910
911 if (placeholder) { 911 if (placeholder) {
912 if (m_sanitizeMarkup) { 912 if (m_sanitizeMarkup) {
913 removeRedundantBlocks(editingState); 913 removeRedundantBlocks(editingState);
914 if (editingState->isAborted()) 914 if (editingState->isAborted())
915 return; 915 return;
916 } 916 }
917 // handleGeneralDelete cause DOM mutation events so |m_endingPosition| 917 // handleGeneralDelete cause DOM mutation events so |m_endingPosition|
918 // can be out of document. 918 // can be out of document.
919 if (m_endingPosition.inDocument()) 919 if (m_endingPosition.inDocument()) {
920 insertNodeAt(placeholder.get(), m_endingPosition); 920 insertNodeAt(placeholder.get(), m_endingPosition, editingState);
921 if (editingState->isAborted())
922 return;
923 }
921 } 924 }
922 925
923 rebalanceWhitespaceAt(m_endingPosition); 926 rebalanceWhitespaceAt(m_endingPosition);
924 927
925 calculateTypingStyleAfterDelete(); 928 calculateTypingStyleAfterDelete();
926 929
927 setEndingSelection(VisibleSelection(m_endingPosition, affinity, endingSelect ion().isDirectional())); 930 setEndingSelection(VisibleSelection(m_endingPosition, affinity, endingSelect ion().isDirectional()));
928 clearTransientState(); 931 clearTransientState();
929 } 932 }
930 933
(...skipping 29 matching lines...) Expand all
960 visitor->trace(m_deleteIntoBlockquoteStyle); 963 visitor->trace(m_deleteIntoBlockquoteStyle);
961 visitor->trace(m_startRoot); 964 visitor->trace(m_startRoot);
962 visitor->trace(m_endRoot); 965 visitor->trace(m_endRoot);
963 visitor->trace(m_startTableRow); 966 visitor->trace(m_startTableRow);
964 visitor->trace(m_endTableRow); 967 visitor->trace(m_endTableRow);
965 visitor->trace(m_temporaryPlaceholder); 968 visitor->trace(m_temporaryPlaceholder);
966 CompositeEditCommand::trace(visitor); 969 CompositeEditCommand::trace(visitor);
967 } 970 }
968 971
969 } // namespace blink 972 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698