diff options
author | Steve Block <steveblock@google.com> | 2012-04-13 07:44:07 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-13 07:44:07 -0700 |
commit | 4bce85f156520b887f758a4b03691c56f349f6e5 (patch) | |
tree | ef7f57041d90088c53f09e0406056ebfcdfa9b03 /Source | |
parent | 66e7b4a51dbcf67187cacb04f4a5eeb1567972c6 (diff) | |
parent | 27621ca63c064d1a1d6af6373c2c9f7018e19861 (diff) | |
download | external_webkit-4bce85f156520b887f758a4b03691c56f349f6e5.zip external_webkit-4bce85f156520b887f758a4b03691c56f349f6e5.tar.gz external_webkit-4bce85f156520b887f758a4b03691c56f349f6e5.tar.bz2 |
Merge "Cherry-pick WebKit change r94511 to fix a LayoutTest crash"
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/dom/Range.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp index 469a94a..268687f 100644 --- a/Source/WebCore/dom/Range.cpp +++ b/Source/WebCore/dom/Range.cpp @@ -51,6 +51,8 @@ using namespace std; static WTF::RefCountedLeakCounter rangeCounter("Range"); #endif +typedef Vector<RefPtr<Node> > NodeVector; + inline Range::Range(PassRefPtr<Document> ownerDocument) : m_ownerDocument(ownerDocument) , m_start(m_ownerDocument) @@ -662,8 +664,6 @@ static inline unsigned lengthOfContentsInNode(Node* node) PassRefPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionCode& ec) { - typedef Vector<RefPtr<Node> > NodeVector; - RefPtr<DocumentFragment> fragment; if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) fragment = DocumentFragment::create(m_ownerDocument.get()); @@ -873,9 +873,14 @@ PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node // FIXME: This assertion may fail if DOM is modified during mutation event // FIXME: Share code with Range::processNodes ASSERT(!firstChildInAncestorToProcess || firstChildInAncestorToProcess->parentNode() == ancestor); - RefPtr<Node> next; - for (Node* child = firstChildInAncestorToProcess.get(); child; child = next.get()) { - next = direction == ProcessContentsForward ? child->nextSibling() : child->previousSibling(); + + NodeVector nodes; + for (Node* child = firstChildInAncestorToProcess.get(); child; + child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling()) + nodes.append(child); + + for (NodeVector::const_iterator it = nodes.begin(); it != nodes.end(); it++) { + Node* child = it->get(); switch (action) { case DELETE_CONTENTS: ancestor->removeChild(child, ec); |