OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) | 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) |
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) | 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) |
5 * (C) 2001 Peter Kelly (pmk@post.com) | 5 * (C) 2001 Peter Kelly (pmk@post.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) { | 787 if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) { |
788 ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(
m_end.container()); | 788 ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(
m_end.container()); |
789 pi->setData(pi->data().substring(m_end.offset()), ec); | 789 pi->setData(pi->data().substring(m_end.offset()), ec); |
790 } | 790 } |
791 } else { | 791 } else { |
792 if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) | 792 if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) |
793 rightContents = m_end.container()->cloneNode(false); | 793 rightContents = m_end.container()->cloneNode(false); |
794 Node* n = m_end.container()->firstChild(); | 794 Node* n = m_end.container()->firstChild(); |
795 if (n && m_end.offset()) { | 795 if (n && m_end.offset()) { |
796 NodeVector nodes; | 796 NodeVector nodes; |
797 for (int i = 0; i + 1 < m_end.offset() && n; i++, n = n->nextSib
ling()) { | 797 int i = 0; |
| 798 do { |
798 nodes.append(n); | 799 nodes.append(n); |
799 } | 800 if (!n->nextSibling()) |
| 801 break; |
| 802 n = n->nextSibling(); |
| 803 } while (i + 1 < m_end.offset()); |
800 for (int i = nodes.size() - 1; i >= 0; i--) { | 804 for (int i = nodes.size() - 1; i >= 0; i--) { |
801 Node* n = nodes[i].get(); | 805 n = nodes[i].get(); |
802 if (action == EXTRACT_CONTENTS) | 806 if (action == EXTRACT_CONTENTS) |
803 rightContents->insertBefore(n, rightContents->firstChild
(), ec); // will remove n from its parent | 807 rightContents->insertBefore(n, rightContents->firstChild
(), ec); // will remove n from its parent |
804 else if (action == CLONE_CONTENTS) | 808 else if (action == CLONE_CONTENTS) |
805 rightContents->insertBefore(n->cloneNode(true), rightCon
tents->firstChild(), ec); | 809 rightContents->insertBefore(n->cloneNode(true), rightCon
tents->firstChild(), ec); |
806 else | 810 else |
807 toContainerNode(m_end.container())->removeChild(n, ec); | 811 toContainerNode(m_end.container())->removeChild(n, ec); |
808 } | 812 } |
809 } | 813 } |
810 } | 814 } |
811 | 815 |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 { | 1988 { |
1985 if (range && range->boundaryPointsValid()) { | 1989 if (range && range->boundaryPointsValid()) { |
1986 WebCore::Position start = range->startPosition(); | 1990 WebCore::Position start = range->startPosition(); |
1987 WebCore::Position end = range->endPosition(); | 1991 WebCore::Position end = range->endPosition(); |
1988 start.node()->showTreeAndMark(start.node(), "S", end.node(), "E"); | 1992 start.node()->showTreeAndMark(start.node(), "S", end.node(), "E"); |
1989 fprintf(stderr, "start offset: %d, end offset: %d\n", start.deprecatedEd
itingOffset(), end.deprecatedEditingOffset()); | 1993 fprintf(stderr, "start offset: %d, end offset: %d\n", start.deprecatedEd
itingOffset(), end.deprecatedEditingOffset()); |
1990 } | 1994 } |
1991 } | 1995 } |
1992 | 1996 |
1993 #endif | 1997 #endif |
OLD | NEW |