Add asserts against layout time render tree mutations
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Sep 2017 17:45:09 +0000 (17:45 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Sep 2017 17:45:09 +0000 (17:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177361

Reviewed by Zalan Bujtas.

We don't have any mutations left. Add asserts.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertChildInternal):
(WebCore::RenderElement::removeChildInternal):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderElement.cpp

index 04c1fec..25d0ba7 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-22  Antti Koivisto  <antti@apple.com>
+
+        Add asserts against layout time render tree mutations
+        https://bugs.webkit.org/show_bug.cgi?id=177361
+
+        Reviewed by Zalan Bujtas.
+
+        We don't have any mutations left. Add asserts.
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::insertChildInternal):
+        (WebCore::RenderElement::removeChildInternal):
+
 2017-09-22  Chris Dumez  <cdumez@apple.com>
 
         Use high resolution timestamp for event time
index 7173ec5..c8c0b4d 100644 (file)
@@ -508,6 +508,8 @@ void RenderElement::destroyLeftoverChildren()
 
 void RenderElement::insertChildInternal(RenderObject* newChild, RenderObject* beforeChild, NotifyChildrenType notifyChildren)
 {
+    RELEASE_ASSERT_WITH_MESSAGE(!view().layoutState(), "Layout must not mutate render tree");
+
     ASSERT(canHaveChildren() || canHaveGeneratedChildren());
     ASSERT(!newChild->parent());
     ASSERT(!isRenderBlockFlow() || (!newChild->isTableSection() && !newChild->isTableRow() && !newChild->isTableCell()));
@@ -565,6 +567,8 @@ void RenderElement::insertChildInternal(RenderObject* newChild, RenderObject* be
 
 void RenderElement::removeChildInternal(RenderObject& oldChild, NotifyChildrenType notifyChildren)
 {
+    RELEASE_ASSERT_WITH_MESSAGE(!view().layoutState(), "Layout must not mutate render tree");
+
     ASSERT(canHaveChildren() || canHaveGeneratedChildren());
     ASSERT(oldChild.parent() == this);