OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |