[webkit-dev] Avoid extra page layout on resize
Artem.Ananiev at Sun.COM
Fri Jan 18 02:13:15 PST 2008
I have a question about the way webkit layouts page contents, and what
is the right way to implement ScrollView class. In my current
implementation (Java platform) I see the following:
1. Suppose user resizes the window, so the top-most frame/scroll view
has the size 800x600.
2. Scroll view updates its values (frame geometry, visible rect, etc.)
and calls layout() to relayout the page.
3. If the page doesn't fit into 800x600, say, it is 1200 in height, then
WebKit calls scroll view's resizeContents() method with 800x1200.
4. As the requested contents height is greater than scroll view height,
vertical scrollbar appears, and the page needs relayout again.
5. In the second layout, WebKit calls resizeContens() with the smaller
width (say, 780, if scrollbar is 20 pixels wide) and some height (say,
This two-steps layout process looks strange to me. It also leads to
extra repaints, and the performance is not as good as desired. The
question is: (at the step 3) why resizeContents() is called with 800 as
a value of width, while it is clear that contents doesn't fit to the
page and vertical scrollbar is required? What methods must be
implemented by platform, so WebKit may take vertical scrollbar into
consideration before it actually appear?
More information about the webkit-dev