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, 2010, 2011 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 container = m_start.container(); | 887 container = m_start.container(); |
888 RefPtrWillBeRawPtr<Text> newText = toText(container)->splitText(m_start. offset(), exceptionState); | 888 RefPtrWillBeRawPtr<Text> newText = toText(container)->splitText(m_start. offset(), exceptionState); |
889 if (exceptionState.hadException()) | 889 if (exceptionState.hadException()) |
890 return; | 890 return; |
891 | 891 |
892 container = m_start.container(); | 892 container = m_start.container(); |
893 container->parentNode()->insertBefore(newNode.release(), newText.get(), exceptionState); | 893 container->parentNode()->insertBefore(newNode.release(), newText.get(), exceptionState); |
894 if (exceptionState.hadException()) | 894 if (exceptionState.hadException()) |
895 return; | 895 return; |
896 | 896 |
897 if (collapsed) | 897 if (collapsed) { |
898 if (!newText->parentNode()) { | |
Yuta Kitamura
2014/08/08 06:20:58
OK, I understand that load event must be fired syn
kangil_
2014/08/08 06:32:50
Done.
| |
899 exceptionState.throwDOMException(HierarchyRequestError, "This op eration would set range's end to parent with new offset, but there's no parent i nto which to continue."); | |
900 return; | |
901 } | |
898 m_end.setToBeforeChild(*newText); | 902 m_end.setToBeforeChild(*newText); |
903 } | |
899 } else { | 904 } else { |
900 RefPtrWillBeRawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAG MENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get(); | 905 RefPtrWillBeRawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAG MENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get(); |
901 if (lastChild && lastChild == m_start.childBefore()) { | 906 if (lastChild && lastChild == m_start.childBefore()) { |
902 // The insertion will do nothing, but we need to extend the range to include | 907 // The insertion will do nothing, but we need to extend the range to include |
903 // the inserted nodes. | 908 // the inserted nodes. |
904 Node* firstChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? t oDocumentFragment(newNode)->firstChild() : newNode.get(); | 909 Node* firstChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? t oDocumentFragment(newNode)->firstChild() : newNode.get(); |
905 ASSERT(firstChild); | 910 ASSERT(firstChild); |
906 m_start.setToBeforeChild(*firstChild); | 911 m_start.setToBeforeChild(*firstChild); |
907 return; | 912 return; |
908 } | 913 } |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1702 | 1707 |
1703 void showTree(const blink::Range* range) | 1708 void showTree(const blink::Range* range) |
1704 { | 1709 { |
1705 if (range && range->boundaryPointsValid()) { | 1710 if (range && range->boundaryPointsValid()) { |
1706 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); | 1711 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); |
1707 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); | 1712 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); |
1708 } | 1713 } |
1709 } | 1714 } |
1710 | 1715 |
1711 #endif | 1716 #endif |
OLD | NEW |