Release assert under RenderView::pageOrViewLogicalHeight
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2018 22:27:28 +0000 (22:27 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2018 22:27:28 +0000 (22:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189798
<rdar://problem/43659749>

Reviewed by Simon Fraser.

Source/WebCore:

Only the mainframe's render view is sized to the page while printing.
Use the matching check (see RenderView::layout) when accessing m_pageLogicalSize.

Test: printing/crash-while-formatting-subframe-for-printing.html

* rendering/RenderView.cpp:
(WebCore::RenderView::pageOrViewLogicalHeight const):

LayoutTests:

* printing/crash-while-formatting-subframe-for-printing-expected.txt: Added.
* printing/crash-while-formatting-subframe-for-printing.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/printing/crash-while-formatting-subframe-for-printing-expected.txt [new file with mode: 0644]
LayoutTests/printing/crash-while-formatting-subframe-for-printing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderView.cpp

index f31fa63..8827b38 100644 (file)
@@ -1,3 +1,14 @@
+2018-09-20  Zalan Bujtas  <zalan@apple.com>
+
+        Release assert under RenderView::pageOrViewLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=189798
+        <rdar://problem/43659749>
+
+        Reviewed by Simon Fraser.
+
+        * printing/crash-while-formatting-subframe-for-printing-expected.txt: Added.
+        * printing/crash-while-formatting-subframe-for-printing.html: Added.
+
 2018-09-20  Sihui Liu  <sihui_liu@apple.com>
 
         REGRESSION(r196265): WKWebView fires mouseover, mouseenter, and mouseleave events even when it's in a background window
diff --git a/LayoutTests/printing/crash-while-formatting-subframe-for-printing-expected.txt b/LayoutTests/printing/crash-while-formatting-subframe-for-printing-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/printing/crash-while-formatting-subframe-for-printing.html b/LayoutTests/printing/crash-while-formatting-subframe-for-printing.html
new file mode 100644 (file)
index 0000000..c859c73
--- /dev/null
@@ -0,0 +1,17 @@
+<title>Unfortunately not 100% repro.</title>
+<body onload="runTests()">
+    <div id="foobar">
+        <iframe style="width: 90%" src="data:text/html,<body style='width: 80%'>PASS if no crash</body>"></iframe>
+    </div>
+</body>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function runTests() {
+    setTimeout(function() {
+        foobar.style.width = "400px";
+    }, 0);
+    window.print();
+}
+</script>
index b8c0724..58efed2 100644 (file)
@@ -1,3 +1,19 @@
+2018-09-20  Zalan Bujtas  <zalan@apple.com>
+
+        Release assert under RenderView::pageOrViewLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=189798
+        <rdar://problem/43659749>
+
+        Reviewed by Simon Fraser.
+
+        Only the mainframe's render view is sized to the page while printing.
+        Use the matching check (see RenderView::layout) when accessing m_pageLogicalSize.
+
+        Test: printing/crash-while-formatting-subframe-for-printing.html
+
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::pageOrViewLogicalHeight const):
+
 2018-09-20  Sihui Liu  <sihui_liu@apple.com>
 
         REGRESSION(r196265): WKWebView fires mouseover, mouseenter, and mouseleave events even when it's in a background window
index b6ecdcf..175100c 100644 (file)
@@ -248,7 +248,7 @@ void RenderView::layout()
 
 LayoutUnit RenderView::pageOrViewLogicalHeight() const
 {
-    if (document().printing())
+    if (shouldUsePrintingLayout())
         return m_pageLogicalSize->height();
     
     if (multiColumnFlow() && !style().hasInlineColumnAxis()) {