Changeset 239381 in webkit
- Timestamp:
- Dec 19, 2018, 11:11:06 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/printing/print-with-media-query-destory-expected.txt (deleted)
-
LayoutTests/printing/print-with-media-query-destory.html (deleted)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
Source/WebCore/page/Frame.cpp (modified) (2 diffs)
-
Source/WebCore/page/FrameView.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r239365 r239381 1 2018-12-19 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r239347. 4 5 Caused the leaks bot to hit an exception and the new test 6 crashes on certain configurations. 7 8 Reverted changeset: 9 10 "Synchronous media query evaluation could destroy current 11 Frame/FrameView." 12 https://bugs.webkit.org/show_bug.cgi?id=192781 13 https://trac.webkit.org/changeset/239347 14 1 15 2018-12-18 Justin Michaud <justin_michaud@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r239380 r239381 1 2018-12-19 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r239347. 4 5 Caused the leaks bot to hit an exception and the new test 6 crashes on certain configurations. 7 8 Reverted changeset: 9 10 "Synchronous media query evaluation could destroy current 11 Frame/FrameView." 12 https://bugs.webkit.org/show_bug.cgi?id=192781 13 https://trac.webkit.org/changeset/239347 14 1 15 2018-12-19 Truitt Savell <tsavell@apple.com> 2 16 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r239347 r239381 436 436 return; 437 437 clearMainResourceLoader(); 438 if (!frameLoader())439 return;440 438 if (!frameLoader()->stateMachine().creatingInitialEmptyDocument()) 441 439 frameLoader()->checkLoadComplete(); -
trunk/Source/WebCore/page/Frame.cpp
r239347 r239381 662 662 void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize) 663 663 { 664 if (!view())665 return;666 664 // In setting printing, we should not validate resources already cached for the document. 667 665 // See https://bugs.webkit.org/show_bug.cgi?id=43704 … … 669 667 670 668 m_doc->setPrinting(printing); 671 auto& frameView = *view(); 672 frameView.adjustMediaTypeForPrinting(printing); 673 674 m_doc->styleScope().didChangeStyleSheetEnvironment(); 675 if (shouldUsePrintingLayout()) 676 frameView.forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize); 677 else { 678 frameView.forceLayout(); 679 if (shouldAdjustViewSize == AdjustViewSize) 680 frameView.adjustViewSize(); 669 if (auto* frameView = view()) { 670 frameView->adjustMediaTypeForPrinting(printing); 671 672 m_doc->styleScope().didChangeStyleSheetEnvironment(); 673 if (shouldUsePrintingLayout()) 674 frameView->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize); 675 else { 676 frameView->forceLayout(); 677 if (shouldAdjustViewSize == AdjustViewSize) 678 frameView->adjustViewSize(); 679 } 681 680 } 682 681 -
trunk/Source/WebCore/page/FrameView.cpp
r239347 r239381 4587 4587 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot shouldAdjustViewSize) 4588 4588 { 4589 if (!renderView())4590 return;4591 4592 Ref<FrameView> protectedThis(*this);4593 auto& renderView = *this->renderView();4594 4595 4589 // Dumping externalRepresentation(frame().renderer()).ascii() is a good trick to see 4596 4590 // the state of things before and after the layout 4597 float pageLogicalWidth = renderView.style().isHorizontalWritingMode() ? pageSize.width() : pageSize.height(); 4598 float pageLogicalHeight = renderView.style().isHorizontalWritingMode() ? pageSize.height() : pageSize.width(); 4599 4600 renderView.setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) }); 4601 renderView.setNeedsLayoutAndPrefWidthsRecalc(); 4602 forceLayout(); 4603 if (hasOneRef()) 4604 return; 4605 4606 // If we don't fit in the given page width, we'll lay out again. If we don't fit in the 4607 // page width when shrunk, we will lay out at maximum shrink and clip extra content. 4608 // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping 4609 // implementation should not do this! 4610 bool horizontalWritingMode = renderView.style().isHorizontalWritingMode(); 4611 const LayoutRect& documentRect = renderView.documentRect(); 4612 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height(); 4613 if (docLogicalWidth > pageLogicalWidth) { 4614 int expectedPageWidth = std::min<float>(documentRect.width(), pageSize.width() * maximumShrinkFactor); 4615 int expectedPageHeight = std::min<float>(documentRect.height(), pageSize.height() * maximumShrinkFactor); 4616 FloatSize maxPageSize = frame().resizePageRectsKeepingRatio(FloatSize(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageWidth, expectedPageHeight)); 4617 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height(); 4618 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width(); 4619 4620 renderView.setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) }); 4621 renderView.setNeedsLayoutAndPrefWidthsRecalc(); 4591 if (RenderView* renderView = this->renderView()) { 4592 float pageLogicalWidth = renderView->style().isHorizontalWritingMode() ? pageSize.width() : pageSize.height(); 4593 float pageLogicalHeight = renderView->style().isHorizontalWritingMode() ? pageSize.height() : pageSize.width(); 4594 4595 renderView->setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) }); 4596 renderView->setNeedsLayoutAndPrefWidthsRecalc(); 4622 4597 forceLayout(); 4623 if (hasOneRef()) 4624 return; 4625 4626 const LayoutRect& updatedDocumentRect = renderView.documentRect(); 4627 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumentRect.height() : updatedDocumentRect.width(); 4628 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRect.y() : updatedDocumentRect.x(); 4629 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocumentRect.maxX() : updatedDocumentRect.maxY(); 4630 LayoutUnit clippedLogicalLeft; 4631 if (!renderView.style().isLeftToRightDirection()) 4632 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; 4633 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWidth, docLogicalHeight); 4634 4635 if (!horizontalWritingMode) 4636 overflow = overflow.transposedRect(); 4637 renderView.clearLayoutOverflow(); 4638 renderView.addLayoutOverflow(overflow); // This is how we clip in case we overflow again. 4598 4599 // If we don't fit in the given page width, we'll lay out again. If we don't fit in the 4600 // page width when shrunk, we will lay out at maximum shrink and clip extra content. 4601 // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping 4602 // implementation should not do this! 4603 bool horizontalWritingMode = renderView->style().isHorizontalWritingMode(); 4604 const LayoutRect& documentRect = renderView->documentRect(); 4605 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height(); 4606 if (docLogicalWidth > pageLogicalWidth) { 4607 int expectedPageWidth = std::min<float>(documentRect.width(), pageSize.width() * maximumShrinkFactor); 4608 int expectedPageHeight = std::min<float>(documentRect.height(), pageSize.height() * maximumShrinkFactor); 4609 FloatSize maxPageSize = frame().resizePageRectsKeepingRatio(FloatSize(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageWidth, expectedPageHeight)); 4610 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height(); 4611 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width(); 4612 4613 renderView->setPageLogicalSize({ floor(pageLogicalWidth), floor(pageLogicalHeight) }); 4614 renderView->setNeedsLayoutAndPrefWidthsRecalc(); 4615 forceLayout(); 4616 4617 const LayoutRect& updatedDocumentRect = renderView->documentRect(); 4618 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumentRect.height() : updatedDocumentRect.width(); 4619 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRect.y() : updatedDocumentRect.x(); 4620 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocumentRect.maxX() : updatedDocumentRect.maxY(); 4621 LayoutUnit clippedLogicalLeft; 4622 if (!renderView->style().isLeftToRightDirection()) 4623 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; 4624 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWidth, docLogicalHeight); 4625 4626 if (!horizontalWritingMode) 4627 overflow = overflow.transposedRect(); 4628 renderView->clearLayoutOverflow(); 4629 renderView->addLayoutOverflow(overflow); // This is how we clip in case we overflow again. 4630 } 4639 4631 } 4640 4632
Note:
See TracChangeset
for help on using the changeset viewer.