Unreviewed, fix assertions after r204311.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Aug 2016 01:16:59 +0000 (01:16 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Aug 2016 01:16:59 +0000 (01:16 +0000)
Range::textNodeSplit() can now get called with a node that
does not have a nextSibling(), in the case where this node
does not have a parent.

* dom/Range.cpp:
(WebCore::Range::textNodeSplit):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Range.cpp

index 991e6d7..7be62ad 100644 (file)
@@ -1,5 +1,16 @@
 2016-08-09  Chris Dumez  <cdumez@apple.com>
 
+        Unreviewed, fix assertions after r204311.
+
+        Range::textNodeSplit() can now get called with a node that
+        does not have a nextSibling(), in the case where this node
+        does not have a parent.
+
+        * dom/Range.cpp:
+        (WebCore::Range::textNodeSplit):
+
+2016-08-09  Chris Dumez  <cdumez@apple.com>
+
         CharacterData.data setter optimization is not spec-compliant and is observable
         https://bugs.webkit.org/show_bug.cgi?id=160712
 
index 8454218..2f7aadb 100644 (file)
@@ -1693,8 +1693,8 @@ void Range::textNodeSplit(Text* oldNode)
     ASSERT(oldNode);
     ASSERT(&oldNode->document() == &ownerDocument());
     ASSERT(oldNode->isTextNode());
-    ASSERT(oldNode->nextSibling());
-    ASSERT(oldNode->nextSibling()->isTextNode());
+    ASSERT(!oldNode->parentNode() || oldNode->nextSibling());
+    ASSERT(!oldNode->parentNode() || oldNode->nextSibling()->isTextNode());
     boundaryTextNodesSplit(m_start, oldNode);
     boundaryTextNodesSplit(m_end, oldNode);
 }