| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // The selection to delete spans more than one node. | 494 // The selection to delete spans more than one node. |
| 495 RefPtr<Node> node(startNode); | 495 RefPtr<Node> node(startNode); |
| 496 | 496 |
| 497 if (startOffset > 0) { | 497 if (startOffset > 0) { |
| 498 if (startNode->isTextNode()) { | 498 if (startNode->isTextNode()) { |
| 499 // in a text node that needs to be trimmed | 499 // in a text node that needs to be trimmed |
| 500 Text* text = toText(node); | 500 Text* text = toText(node); |
| 501 deleteTextFromNode(text, startOffset, text->length() - startOffs
et); | 501 deleteTextFromNode(text, startOffset, text->length() - startOffs
et); |
| 502 node = NodeTraversal::next(*node); | 502 node = NodeTraversal::next(*node); |
| 503 } else { | 503 } else { |
| 504 node = startNode->childNode(startOffset); | 504 node = startNode->traverseToChildAt(startOffset); |
| 505 } | 505 } |
| 506 } else if (startNode == m_upstreamEnd.deprecatedNode() && startNode->isT
extNode()) { | 506 } else if (startNode == m_upstreamEnd.deprecatedNode() && startNode->isT
extNode()) { |
| 507 Text* text = toText(m_upstreamEnd.deprecatedNode()); | 507 Text* text = toText(m_upstreamEnd.deprecatedNode()); |
| 508 deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset())
; | 508 deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset())
; |
| 509 } | 509 } |
| 510 | 510 |
| 511 // handle deleting all nodes that are completely selected | 511 // handle deleting all nodes that are completely selected |
| 512 while (node && node != m_downstreamEnd.deprecatedNode()) { | 512 while (node && node != m_downstreamEnd.deprecatedNode()) { |
| 513 if (comparePositions(firstPositionInOrBeforeNode(node.get()), m_down
streamEnd) >= 0) { | 513 if (comparePositions(firstPositionInOrBeforeNode(node.get()), m_down
streamEnd) >= 0) { |
| 514 // NodeTraversal::nextSkippingChildren just blew past the end po
sition, so stop deleting | 514 // NodeTraversal::nextSkippingChildren just blew past the end po
sition, so stop deleting |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 | 862 |
| 863 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, | 863 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, |
| 864 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't | 864 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't |
| 865 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. | 865 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. |
| 866 bool DeleteSelectionCommand::preservesTypingStyle() const | 866 bool DeleteSelectionCommand::preservesTypingStyle() const |
| 867 { | 867 { |
| 868 return m_typingStyle; | 868 return m_typingStyle; |
| 869 } | 869 } |
| 870 | 870 |
| 871 } // namespace WebCore | 871 } // namespace WebCore |
| OLD | NEW |