From 6c2af9490927c3c5959b5cb07461b646f8b32f6c Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Fri, 21 May 2010 16:53:46 +0100 Subject: Merge WebKit at r59636: Initial merge by git Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91 --- WebCore/dom/Range.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'WebCore/dom/Range.cpp') diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp index c704262..a5abdd4 100644 --- a/WebCore/dom/Range.cpp +++ b/WebCore/dom/Range.cpp @@ -1714,6 +1714,31 @@ void Range::nodeChildrenChanged(ContainerNode* container) boundaryNodeChildrenChanged(m_end, container); } +static inline void boundaryNodeChildrenWillBeRemoved(RangeBoundaryPoint& boundary, ContainerNode* container) +{ + for (Node* nodeToBeRemoved = container->firstChild(); nodeToBeRemoved; nodeToBeRemoved = nodeToBeRemoved->nextSibling()) { + if (boundary.childBefore() == nodeToBeRemoved) { + boundary.setToStartOfNode(container); + return; + } + + for (Node* n = boundary.container(); n; n = n->parentNode()) { + if (n == nodeToBeRemoved) { + boundary.setToStartOfNode(container); + return; + } + } + } +} + +void Range::nodeChildrenWillBeRemoved(ContainerNode* container) +{ + ASSERT(container); + ASSERT(container->document() == m_ownerDocument); + boundaryNodeChildrenWillBeRemoved(m_start, container); + boundaryNodeChildrenWillBeRemoved(m_end, container); +} + static inline void boundaryNodeWillBeRemoved(RangeBoundaryPoint& boundary, Node* nodeToBeRemoved) { if (boundary.childBefore() == nodeToBeRemoved) { -- cgit v1.1