Bug 107361
Summary: | Don't recalcStyle and layout when changing page scale. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Dongseong Hwang <dongseong.hwang> |
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | bdakin, cmarrin, darin, kenneth, simon.fraser |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | |||
Bug Blocks: | 105978 |
Dongseong Hwang
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Simon Fraser (smfr)
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.
Dongseong Hwang
(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.