OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 void CompositeEditCommand::deleteInsignificantText(const Position& start, const
Position& end) | 791 void CompositeEditCommand::deleteInsignificantText(const Position& start, const
Position& end) |
792 { | 792 { |
793 if (start.isNull() || end.isNull()) | 793 if (start.isNull() || end.isNull()) |
794 return; | 794 return; |
795 | 795 |
796 if (comparePositions(start, end) >= 0) | 796 if (comparePositions(start, end) >= 0) |
797 return; | 797 return; |
798 | 798 |
799 Vector<RefPtr<Text> > nodes; | 799 Vector<RefPtr<Text> > nodes; |
800 for (Node* node = start.deprecatedNode(); node; node = NodeTraversal::next(n
ode)) { | 800 for (Node* node = start.deprecatedNode(); node; node = NodeTraversal::next(*
node)) { |
801 if (node->isTextNode()) | 801 if (node->isTextNode()) |
802 nodes.append(toText(node)); | 802 nodes.append(toText(node)); |
803 if (node == end.deprecatedNode()) | 803 if (node == end.deprecatedNode()) |
804 break; | 804 break; |
805 } | 805 } |
806 | 806 |
807 for (size_t i = 0; i < nodes.size(); ++i) { | 807 for (size_t i = 0; i < nodes.size(); ++i) { |
808 Text* textNode = nodes[i].get(); | 808 Text* textNode = nodes[i].get(); |
809 int startOffset = textNode == start.deprecatedNode() ? start.deprecatedE
ditingOffset() : 0; | 809 int startOffset = textNode == start.deprecatedNode() ? start.deprecatedE
ditingOffset() : 0; |
810 int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditing
Offset() : static_cast<int>(textNode->length()); | 810 int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditing
Offset() : static_cast<int>(textNode->length()); |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 return node.release(); | 1463 return node.release(); |
1464 } | 1464 } |
1465 | 1465 |
1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1467 { | 1467 { |
1468 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1468 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1469 return breakNode.release(); | 1469 return breakNode.release(); |
1470 } | 1470 } |
1471 | 1471 |
1472 } // namespace WebCore | 1472 } // namespace WebCore |
OLD | NEW |