Bug 107361 - Don't recalcStyle and layout when changing page scale.
Summary: Don't recalcStyle and layout when changing page scale.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 105978
  Show dependency treegraph
 
Reported: 2013-01-18 22:57 PST by Dongseong Hwang
Modified: 2013-01-23 02:19 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dongseong Hwang 2013-01-18 22:57:19 PST
When we do pinch zoom, WebCore recalculates style and re-layouts. It affects user experience badly.
void Page::setPageScaleFactor(float scale, const IntPoint& origin)
{
    ...
    if (document->renderer())
        document->renderer()->setNeedsLayout(true);

    document->recalcStyle(Node::Force);
    ...
}

It is originated from Bug 48385, which created Frame::scalePage.
AFAIK, Bug 48385 made Frame::scalePage recalcStyle and layout, because it want to apply pageScale to transform.
However, I concern why we should apply pageScale to transform.
GraphicsLayer can know pageScale. GraphicsLayer can handle pageScale without scaled transform.

On the other hands, near past, deviceScaleFactor was born, but we don't apply deviceScaleFactor to transform. I think it is a bit weird.
When we work near device screen, we must consider pageScale * deviceScaleFactor.
It forces us to apply deviceScaleFactor to transform before drawing contents on device. And we must remember it is not allowed to apply pageScale to transform at that time.

In my opinion, StyleResolver should not slightly apply pageScale to transform, and we apply pageScale when it is needed. (e.g. r73525)
It will be more clear as well as performance benefit.
I wish Page::setPageScaleFactor not to cause recalcStyle and layout. I need your opinion.
Comment 1 Simon Fraser (smfr) 2013-01-19 11:02:58 PST
Page scale uses a transform on the root (RenderView), just like a CSS transform. Changing transforms requires layout, because it affects overflow; this is used to update the scrollbars when scaled.
Comment 2 Dongseong Hwang 2013-01-23 02:19:06 PST
(In reply to comment #1)
> Page scale uses a transform on the root (RenderView), just like a CSS transform. Changing transforms requires layout, because it affects overflow; this is used to update the scrollbars when scaled.

Thank you for your explanation. I can grasp how transform effects. Chromium avoids changing transform using Settings::applyPageScaleFactorInCompositorKey(). EFL and Qt will follows Chromium's way.