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

Side by Side Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 14995014: Don't move uneditable style and link elements during deletion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-05-14T15:16 Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/editing/deleting/delete-uneditable-style-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr eventStyleLoss() 421 void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr eventStyleLoss()
422 { 422 {
423 RefPtr<Range> range = m_selectionToDelete.toNormalizedRange(); 423 RefPtr<Range> range = m_selectionToDelete.toNormalizedRange();
424 RefPtr<Node> node = range->firstNode(); 424 RefPtr<Node> node = range->firstNode();
425 while (node && node != range->pastLastNode()) { 425 while (node && node != range->pastLastNode()) {
426 RefPtr<Node> nextNode = NodeTraversal::next(node.get()); 426 RefPtr<Node> nextNode = NodeTraversal::next(node.get());
427 if ((node->hasTagName(styleTag) && !(toElement(node.get())->hasAttribute (scopedAttr))) || node->hasTagName(linkTag)) { 427 if ((node->hasTagName(styleTag) && !(toElement(node.get())->hasAttribute (scopedAttr))) || node->hasTagName(linkTag)) {
428 nextNode = NodeTraversal::nextSkippingChildren(node.get()); 428 nextNode = NodeTraversal::nextSkippingChildren(node.get());
429 RefPtr<ContainerNode> rootEditableElement = node->rootEditableElemen t(); 429 RefPtr<ContainerNode> rootEditableElement = node->rootEditableElemen t();
430 removeNode(node); 430 if (rootEditableElement.get()) {
431 appendNode(node, rootEditableElement); 431 removeNode(node);
432 appendNode(node, rootEditableElement);
433 }
432 } 434 }
433 node = nextNode; 435 node = nextNode;
434 } 436 }
435 } 437 }
436 438
437 void DeleteSelectionCommand::handleGeneralDelete() 439 void DeleteSelectionCommand::handleGeneralDelete()
438 { 440 {
439 if (m_upstreamStart.isNull()) 441 if (m_upstreamStart.isNull())
440 return; 442 return;
441 443
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 831
830 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 832 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
831 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 833 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
832 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 834 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
833 bool DeleteSelectionCommand::preservesTypingStyle() const 835 bool DeleteSelectionCommand::preservesTypingStyle() const
834 { 836 {
835 return m_typingStyle; 837 return m_typingStyle;
836 } 838 }
837 839
838 } // namespace WebCore 840 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/deleting/delete-uneditable-style-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698