Should never be reached failure in WebCore::RenderElement::clearLayoutRootIfNeeded
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Dec 2015 22:56:57 +0000 (22:56 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Dec 2015 22:56:57 +0000 (22:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151590

Reviewed by Simon Fraser.

We should always set the layoutroot when a new subtree layout is requested (and convert it
to a full layout when needed). It ensures that renderers are detached cleanly even when
they are set as layoutroot.

Source/WebCore:

Test: fast/block/assert-when-layout-root-is-not-cleared.html

* page/FrameView.cpp:
(WebCore::FrameView::scheduleRelayoutOfSubtree):

LayoutTests:

* fast/block/assert-when-layout-root-is-not-cleared-expected.txt: Added.
* fast/block/assert-when-layout-root-is-not-cleared.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/block/assert-when-layout-root-is-not-cleared-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/assert-when-layout-root-is-not-cleared.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp

index e49307b..735a236 100644 (file)
@@ -1,3 +1,17 @@
+2015-12-27  Zalan Bujtas  <zalan@apple.com>
+
+        Should never be reached failure in WebCore::RenderElement::clearLayoutRootIfNeeded
+        https://bugs.webkit.org/show_bug.cgi?id=151590
+
+        Reviewed by Simon Fraser.
+
+        We should always set the layoutroot when a new subtree layout is requested (and convert it
+        to a full layout when needed). It ensures that renderers are detached cleanly even when
+        they are set as layoutroot.
+
+        * fast/block/assert-when-layout-root-is-not-cleared-expected.txt: Added.
+        * fast/block/assert-when-layout-root-is-not-cleared.html: Added.
+
 2015-12-25  Zalan Bujtas  <zalan@apple.com>
 
         Subpixel rendering: Add subpixel support for outline.
diff --git a/LayoutTests/fast/block/assert-when-layout-root-is-not-cleared-expected.txt b/LayoutTests/fast/block/assert-when-layout-root-is-not-cleared-expected.txt
new file mode 100644 (file)
index 0000000..45ea3f4
--- /dev/null
@@ -0,0 +1,2 @@
+Pass if no assert in debug.
+foo
diff --git a/LayoutTests/fast/block/assert-when-layout-root-is-not-cleared.html b/LayoutTests/fast/block/assert-when-layout-root-is-not-cleared.html
new file mode 100644 (file)
index 0000000..690463e
--- /dev/null
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+window.onload = function() {
+    document.designMode = 'on';
+    document.execCommand('selectAll');
+    document.execCommand('indent');
+}
+</script>
+<style>
+* {
+    -webkit-appearance: checkbox;
+}
+</style>
+</head>
+<body>Pass if no assert in debug.<div>foo</div></body>
+</html>
index 78d492f..25e6ef4 100644 (file)
@@ -1,3 +1,19 @@
+2015-12-27  Zalan Bujtas  <zalan@apple.com>
+
+        Should never be reached failure in WebCore::RenderElement::clearLayoutRootIfNeeded
+        https://bugs.webkit.org/show_bug.cgi?id=151590
+
+        Reviewed by Simon Fraser.
+
+        We should always set the layoutroot when a new subtree layout is requested (and convert it
+        to a full layout when needed). It ensures that renderers are detached cleanly even when
+        they are set as layoutroot.
+
+        Test: fast/block/assert-when-layout-root-is-not-cleared.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scheduleRelayoutOfSubtree):
+
 2015-12-26  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         [CMake] Rearrange new gamepad files with deprecated files
index 4c3cec5..5d43755 100644 (file)
@@ -2654,7 +2654,8 @@ void FrameView::scheduleRelayoutOfSubtree(RenderElement& newRelayoutRoot)
     ASSERT(frame().view() == this);
 
     if (renderView.needsLayout()) {
-        newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No);
+        m_layoutRoot = &newRelayoutRoot;
+        convertSubtreeLayoutToFullLayout();
         return;
     }
 
@@ -2695,8 +2696,8 @@ void FrameView::scheduleRelayoutOfSubtree(RenderElement& newRelayoutRoot)
     }
 
     // Just do a full relayout.
+    m_layoutRoot = &newRelayoutRoot;
     convertSubtreeLayoutToFullLayout();
-    newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No);
     InspectorInstrumentation::didInvalidateLayout(frame());
 }