Skip to content

Commit

Permalink
[FIX] Avoid recomputing style after printing.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Jan 24, 2024
1 parent 019ac53 commit bc868aa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions qt/src/3rdparty/webkit/Source/WebCore/page/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,14 @@ Color Frame::getDocumentBackgroundColor() const

void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
{
printf("setPrinting\n");
m_doc->setPrinting(printing);
view()->adjustMediaTypeForPrinting(printing);

m_doc->styleSelectorChanged(RecalcStyleImmediately);
if (printing)
view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize);
if (not printing)
return;

// Subframes of the one we're printing don't lay out to the page size.
m_doc->styleSelectorChanged(RecalcStyleImmediately);
view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize);
for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
child->setPrinting(printing, IntSize(), 0, shouldAdjustViewSize);
}
Expand Down

0 comments on commit bc868aa

Please sign in to comment.