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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 804 |
805 void CompositeEditCommand::deleteInsignificantText(const Position& start, const
Position& end) | 805 void CompositeEditCommand::deleteInsignificantText(const Position& start, const
Position& end) |
806 { | 806 { |
807 if (start.isNull() || end.isNull()) | 807 if (start.isNull() || end.isNull()) |
808 return; | 808 return; |
809 | 809 |
810 if (comparePositions(start, end) >= 0) | 810 if (comparePositions(start, end) >= 0) |
811 return; | 811 return; |
812 | 812 |
813 WillBeHeapVector<RefPtrWillBeMember<Text> > nodes; | 813 WillBeHeapVector<RefPtrWillBeMember<Text> > nodes; |
814 for (Node& node : NodeTraversal::from(start.deprecatedNode())) { | 814 for (Node& node : NodeTraversal::startsAt(start.deprecatedNode())) { |
815 if (node.isTextNode()) | 815 if (node.isTextNode()) |
816 nodes.append(toText(&node)); | 816 nodes.append(toText(&node)); |
817 if (&node == end.deprecatedNode()) | 817 if (&node == end.deprecatedNode()) |
818 break; | 818 break; |
819 } | 819 } |
820 | 820 |
821 for (size_t i = 0; i < nodes.size(); ++i) { | 821 for (size_t i = 0; i < nodes.size(); ++i) { |
822 Text* textNode = nodes[i].get(); | 822 Text* textNode = nodes[i].get(); |
823 int startOffset = textNode == start.deprecatedNode() ? start.deprecatedE
ditingOffset() : 0; | 823 int startOffset = textNode == start.deprecatedNode() ? start.deprecatedE
ditingOffset() : 0; |
824 int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditing
Offset() : static_cast<int>(textNode->length()); | 824 int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditing
Offset() : static_cast<int>(textNode->length()); |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 } | 1494 } |
1495 | 1495 |
1496 void CompositeEditCommand::trace(Visitor* visitor) | 1496 void CompositeEditCommand::trace(Visitor* visitor) |
1497 { | 1497 { |
1498 visitor->trace(m_commands); | 1498 visitor->trace(m_commands); |
1499 visitor->trace(m_composition); | 1499 visitor->trace(m_composition); |
1500 EditCommand::trace(visitor); | 1500 EditCommand::trace(visitor); |
1501 } | 1501 } |
1502 | 1502 |
1503 } // namespace blink | 1503 } // namespace blink |
OLD | NEW |