Bug 21402 - Add a clip in RenderView::layout to avoid doing offscreen paint
Summary: Add a clip in RenderView::layout to avoid doing offscreen paint
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-06 08:39 PDT by Julien Chaffraix
Modified: 2023-05-08 10:48 PDT (History)
5 users (show)

See Also:


Attachments
Proposed fix: add a clip to the viewRect (1.43 KB, patch)
2008-10-06 08:44 PDT, Julien Chaffraix
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2008-10-06 08:39:59 PDT
Currently in RenderView.cpp, there is a FIXME about adding a clip to the LayoutState.

Path forthcoming.
Comment 1 Julien Chaffraix 2008-10-06 08:44:15 PDT
Created attachment 24114 [details]
Proposed fix: add a clip to the viewRect
Comment 2 Eric Seidel (no email) 2008-10-06 14:45:16 PDT
Comment on attachment 24114 [details]
Proposed fix: add a clip to the viewRect

This one is for Hyatt.
Comment 3 Julien Chaffraix 2008-10-07 02:55:23 PDT
Comment on attachment 24114 [details]
Proposed fix: add a clip to the viewRect

As discussed with David Hyatt and Dan Bernstein, the win is odd and should be confirmed on ToT (I had done some rough testing on ToT and good experiment on an old bramch) before thinking of integrating this patch.

Clearing the review flag to give me some time for performance experiments on ToT.
Comment 4 Ahmad Saleem 2023-05-08 10:26:31 PDT
I checked and we don't have FIXME in Webkit Source, which this patch was trying to modify and also this is current source:

https://searchfox.org/wubkat/source/Source/WebCore/rendering/RenderView.cpp#183


void RenderView::layout()
{
    StackStats::LayoutCheckPoint layoutCheckPoint;
    if (!document().paginated())
        m_pageLogicalSize = { };

    if (shouldUsePrintingLayout()) {
        if (!m_pageLogicalSize)
            m_pageLogicalSize = LayoutSize(logicalWidth(), 0_lu);
        m_minPreferredLogicalWidth = m_pageLogicalSize->width();
        m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
    }

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !shouldUsePrintingLayout() && (width() != viewWidth() || height() != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(MarkOnlyThis);

        for (auto& box : childrenOfType<RenderBox>(*this)) {
            if (box.hasRelativeLogicalHeight()
                || box.style().logicalHeight().isPercentOrCalculated()
                || box.style().logicalMinHeight().isPercentOrCalculated()
                || box.style().logicalMaxHeight().isPercentOrCalculated()
                || box.isSVGRootOrLegacySVGRoot()
                )
                box.setChildNeedsLayout(MarkOnlyThis);
        }
    }

    ASSERT(!frameView().layoutContext().layoutState());
    if (!needsLayout())
        return;

    ensureLayoutState().setViewportSize(frameView().size());

    LayoutStateMaintainer statePusher(*this, { }, false, valueOrDefault(m_pageLogicalSize).height(), m_pageLogicalHeightChanged);

    m_pageLogicalHeightChanged = false;

    RenderBlockFlow::layout();

#ifndef NDEBUG
    frameView().layoutContext().checkLayoutState();
#endif
    clearNeedsLayout();
}

________

Do we need anything else? Or we can close now?
Comment 5 Simon Fraser (smfr) 2023-05-08 10:48:29 PDT
I don't think we need this.