Title: [239381] trunk
Revision
239381
Author
ryanhad...@apple.com
Date
2018-12-19 11:11:06 -0800 (Wed, 19 Dec 2018)

Log Message

Unreviewed, rolling out r239347.

Caused the leaks bot to hit an exception and the new test
crashes on certain configurations.

Reverted changeset:

"Synchronous media query evaluation could destroy current
Frame/FrameView."
https://bugs.webkit.org/show_bug.cgi?id=192781
https://trac.webkit.org/changeset/239347

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239380 => 239381)


--- trunk/LayoutTests/ChangeLog	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/LayoutTests/ChangeLog	2018-12-19 19:11:06 UTC (rev 239381)
@@ -1,3 +1,17 @@
+2018-12-19  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r239347.
+
+        Caused the leaks bot to hit an exception and the new test
+        crashes on certain configurations.
+
+        Reverted changeset:
+
+        "Synchronous media query evaluation could destroy current
+        Frame/FrameView."
+        https://bugs.webkit.org/show_bug.cgi?id=192781
+        https://trac.webkit.org/changeset/239347
+
 2018-12-18  Justin Michaud  <justin_mich...@apple.com>
 
         Update CSS Properties and Values API to use new cycle fallback behaviour

Deleted: trunk/LayoutTests/printing/print-with-media-query-destory-expected.txt (239380 => 239381)


--- trunk/LayoutTests/printing/print-with-media-query-destory-expected.txt	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/LayoutTests/printing/print-with-media-query-destory-expected.txt	2018-12-19 19:11:06 UTC (rev 239381)
@@ -1,2 +0,0 @@
-Pass if no crash or assert
-

Deleted: trunk/LayoutTests/printing/print-with-media-query-destory.html (239380 => 239381)


--- trunk/LayoutTests/printing/print-with-media-query-destory.html	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/LayoutTests/printing/print-with-media-query-destory.html	2018-12-19 19:11:06 UTC (rev 239381)
@@ -1,28 +0,0 @@
-<div>Pass if no crash or assert</div>
-<script>
-if (window.testRunner)
-    testRunner.dumpAsText();
-    
-function wait() {
-if (window.testRunner)
-    testRunner.waitUntilDone();
-}
-
-function done() {
-if (window.testRunner)
-    testRunner.notifyDone();
-}
-</script>
-<iframe srcdoc="<script>
-window.matchMedia('print').addListener(function(mql) {
-    let parentWindow = window.parent;
-    window.frameElement.remove();
-    parentWindow.done();
-});
-
-if (window.internals) {
-    internals.setPrinting(800, 600);
-    window.parent.wait();
-} else
-    print();
-</script>">

Modified: trunk/Source/WebCore/ChangeLog (239380 => 239381)


--- trunk/Source/WebCore/ChangeLog	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/Source/WebCore/ChangeLog	2018-12-19 19:11:06 UTC (rev 239381)
@@ -1,3 +1,17 @@
+2018-12-19  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r239347.
+
+        Caused the leaks bot to hit an exception and the new test
+        crashes on certain configurations.
+
+        Reverted changeset:
+
+        "Synchronous media query evaluation could destroy current
+        Frame/FrameView."
+        https://bugs.webkit.org/show_bug.cgi?id=192781
+        https://trac.webkit.org/changeset/239347
+
 2018-12-19  Truitt Savell  <tsav...@apple.com>
 
         Unreviewed, rolling out r239358.

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (239380 => 239381)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2018-12-19 19:11:06 UTC (rev 239381)
@@ -435,8 +435,6 @@
     if (!m_mainDocumentError.isNull())
         return;
     clearMainResourceLoader();
-    if (!frameLoader())
-        return;
     if (!frameLoader()->stateMachine().creatingInitialEmptyDocument())
         frameLoader()->checkLoadComplete();
 

Modified: trunk/Source/WebCore/page/Frame.cpp (239380 => 239381)


--- trunk/Source/WebCore/page/Frame.cpp	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/Source/WebCore/page/Frame.cpp	2018-12-19 19:11:06 UTC (rev 239381)
@@ -661,23 +661,22 @@
 
 void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
 {
-    if (!view())
-        return;
     // In setting printing, we should not validate resources already cached for the document.
     // See https://bugs.webkit.org/show_bug.cgi?id=43704
     ResourceCacheValidationSuppressor validationSuppressor(m_doc->cachedResourceLoader());
 
     m_doc->setPrinting(printing);
-    auto& frameView = *view();
-    frameView.adjustMediaTypeForPrinting(printing);
+    if (auto* frameView = view()) {
+        frameView->adjustMediaTypeForPrinting(printing);
 
-    m_doc->styleScope().didChangeStyleSheetEnvironment();
-    if (shouldUsePrintingLayout())
-        frameView.forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
-    else {
-        frameView.forceLayout();
-        if (shouldAdjustViewSize == AdjustViewSize)
-            frameView.adjustViewSize();
+        m_doc->styleScope().didChangeStyleSheetEnvironment();
+        if (shouldUsePrintingLayout())
+            frameView->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
+        else {
+            frameView->forceLayout();
+            if (shouldAdjustViewSize == AdjustViewSize)
+                frameView->adjustViewSize();
+        }
     }
 
     // Subframes of the one we're printing don't lay out to the page size.

Modified: trunk/Source/WebCore/page/FrameView.cpp (239380 => 239381)


--- trunk/Source/WebCore/page/FrameView.cpp	2018-12-19 18:57:09 UTC (rev 239380)
+++ trunk/Source/WebCore/page/FrameView.cpp	2018-12-19 19:11:06 UTC (rev 239381)
@@ -4586,56 +4586,48 @@
 
 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot shouldAdjustViewSize)
 {
-    if (!renderView())
-        return;
-
-    Ref<FrameView> protectedThis(*this);
-    auto& renderView = *this->renderView();
-
     // Dumping externalRepresentation(frame().renderer()).ascii() is a good trick to see
     // the state of things before and after the layout
-    float pageLogicalWidth = renderView.style().isHorizontalWritingMode() ? pageSize.width() : pageSize.height();
-    float pageLogicalHeight = renderView.style().isHorizontalWritingMode() ? pageSize.height() : pageSize.width();
+    if (RenderView* renderView = this->renderView()) {
+        float pageLogicalWidth = renderView->style().isHorizontalWritingMode() ? pageSize.width() : pageSize.height();
+        float pageLogicalHeight = renderView->style().isHorizontalWritingMode() ? pageSize.height() : pageSize.width();
 
-    renderView.setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) });
-    renderView.setNeedsLayoutAndPrefWidthsRecalc();
-    forceLayout();
-    if (hasOneRef())
-        return;
+        renderView->setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) });
+        renderView->setNeedsLayoutAndPrefWidthsRecalc();
+        forceLayout();
 
-    // If we don't fit in the given page width, we'll lay out again. If we don't fit in the
-    // page width when shrunk, we will lay out at maximum shrink and clip extra content.
-    // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping
-    // implementation should not do this!
-    bool horizontalWritingMode = renderView.style().isHorizontalWritingMode();
-    const LayoutRect& documentRect = renderView.documentRect();
-    LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height();
-    if (docLogicalWidth > pageLogicalWidth) {
-        int expectedPageWidth = std::min<float>(documentRect.width(), pageSize.width() * maximumShrinkFactor);
-        int expectedPageHeight = std::min<float>(documentRect.height(), pageSize.height() * maximumShrinkFactor);
-        FloatSize maxPageSize = frame().resizePageRectsKeepingRatio(FloatSize(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageWidth, expectedPageHeight));
-        pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height();
-        pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width();
+        // If we don't fit in the given page width, we'll lay out again. If we don't fit in the
+        // page width when shrunk, we will lay out at maximum shrink and clip extra content.
+        // FIXME: We are assuming a shrink-to-fit printing implementation.  A cropping
+        // implementation should not do this!
+        bool horizontalWritingMode = renderView->style().isHorizontalWritingMode();
+        const LayoutRect& documentRect = renderView->documentRect();
+        LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height();
+        if (docLogicalWidth > pageLogicalWidth) {
+            int expectedPageWidth = std::min<float>(documentRect.width(), pageSize.width() * maximumShrinkFactor);
+            int expectedPageHeight = std::min<float>(documentRect.height(), pageSize.height() * maximumShrinkFactor);
+            FloatSize maxPageSize = frame().resizePageRectsKeepingRatio(FloatSize(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageWidth, expectedPageHeight));
+            pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height();
+            pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width();
 
-        renderView.setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) });
-        renderView.setNeedsLayoutAndPrefWidthsRecalc();
-        forceLayout();
-        if (hasOneRef())
-            return;
+            renderView->setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) });
+            renderView->setNeedsLayoutAndPrefWidthsRecalc();
+            forceLayout();
 
-        const LayoutRect& updatedDocumentRect = renderView.documentRect();
-        LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumentRect.height() : updatedDocumentRect.width();
-        LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRect.y() : updatedDocumentRect.x();
-        LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocumentRect.maxX() : updatedDocumentRect.maxY();
-        LayoutUnit clippedLogicalLeft;
-        if (!renderView.style().isLeftToRightDirection())
-            clippedLogicalLeft = docLogicalRight - pageLogicalWidth;
-        LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWidth, docLogicalHeight);
+            const LayoutRect& updatedDocumentRect = renderView->documentRect();
+            LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumentRect.height() : updatedDocumentRect.width();
+            LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRect.y() : updatedDocumentRect.x();
+            LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocumentRect.maxX() : updatedDocumentRect.maxY();
+            LayoutUnit clippedLogicalLeft;
+            if (!renderView->style().isLeftToRightDirection())
+                clippedLogicalLeft = docLogicalRight - pageLogicalWidth;
+            LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWidth, docLogicalHeight);
 
-        if (!horizontalWritingMode)
-            overflow = overflow.transposedRect();
-        renderView.clearLayoutOverflow();
-        renderView.addLayoutOverflow(overflow); // This is how we clip in case we overflow again.
+            if (!horizontalWritingMode)
+                overflow = overflow.transposedRect();
+            renderView->clearLayoutOverflow();
+            renderView->addLayoutOverflow(overflow); // This is how we clip in case we overflow again.
+        }
     }
 
     if (shouldAdjustViewSize)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to