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

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

Issue 1395693009: [Editing][BugFix] Fix if condition in ReplaceSelectionCommand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 insertionPos = endingSelection().start(); 1006 insertionPos = endingSelection().start();
1007 } 1007 }
1008 1008
1009 // We don't want any of the pasted content to end up nested in a Mail blockq uote, so first break 1009 // We don't want any of the pasted content to end up nested in a Mail blockq uote, so first break
1010 // out of any surrounding Mail blockquotes. Unless we're inserting in a tabl e, in which case 1010 // out of any surrounding Mail blockquotes. Unless we're inserting in a tabl e, in which case
1011 // breaking the blockquote will prevent the content from actually being inse rted in the table. 1011 // breaking the blockquote will prevent the content from actually being inse rted in the table.
1012 if (startIsInsideMailBlockquote && m_preventNesting && !(enclosingNodeOfType (insertionPos, &isTableStructureNode))) { 1012 if (startIsInsideMailBlockquote && m_preventNesting && !(enclosingNodeOfType (insertionPos, &isTableStructureNode))) {
1013 applyCommandToComposite(BreakBlockquoteCommand::create(document())); 1013 applyCommandToComposite(BreakBlockquoteCommand::create(document()));
1014 // This will leave a br between the split. 1014 // This will leave a br between the split.
1015 Node* br = endingSelection().start().anchorNode(); 1015 Node* br = endingSelection().start().anchorNode();
1016 ASSERT(isHTMLBRElement(br)); 1016 if (isHTMLBRElement(br)) {
yosin_UTC9 2015/10/15 05:57:18 It seems this can fix issue 541402 too. However, i
1017 // Insert content between the two blockquotes, but remove the br (since it was just a placeholder). 1017 // Insert content between the two blockquotes, but remove the br (si nce it was just a placeholder).
1018 insertionPos = positionInParentBeforeNode(*br); 1018 insertionPos = positionInParentBeforeNode(*br);
1019 removeNode(br); 1019 removeNode(br);
1020 }
1020 } 1021 }
1021 1022
1022 // Inserting content could cause whitespace to collapse, e.g. inserting <div >foo</div> into hello^ world. 1023 // Inserting content could cause whitespace to collapse, e.g. inserting <div >foo</div> into hello^ world.
1023 prepareWhitespaceAtPositionForSplit(insertionPos); 1024 prepareWhitespaceAtPositionForSplit(insertionPos);
1024 1025
1025 // If the downstream node has been removed there's no point in continuing. 1026 // If the downstream node has been removed there's no point in continuing.
1026 if (!mostForwardCaretPosition(insertionPos).anchorNode()) 1027 if (!mostForwardCaretPosition(insertionPos).anchorNode())
1027 return; 1028 return;
1028 1029
1029 // NOTE: This would be an incorrect usage of downstream() if downstream() we re changed to mean the last position after 1030 // NOTE: This would be an incorrect usage of downstream() if downstream() we re changed to mean the last position after
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 DEFINE_TRACE(ReplaceSelectionCommand) 1550 DEFINE_TRACE(ReplaceSelectionCommand)
1550 { 1551 {
1551 visitor->trace(m_startOfInsertedContent); 1552 visitor->trace(m_startOfInsertedContent);
1552 visitor->trace(m_endOfInsertedContent); 1553 visitor->trace(m_endOfInsertedContent);
1553 visitor->trace(m_insertionStyle); 1554 visitor->trace(m_insertionStyle);
1554 visitor->trace(m_documentFragment); 1555 visitor->trace(m_documentFragment);
1555 CompositeEditCommand::trace(visitor); 1556 CompositeEditCommand::trace(visitor);
1556 } 1557 }
1557 1558
1558 } // namespace blink 1559 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698