Eyes Above The Waves

Robert O'Callahan. Christian. Repatriate Kiwi. Hacker.

Friday 16 December 2005

Frame Display Lists And Next Steps

After extensive testing, I've submitted the frame display list patch for review. It's huge so that might take some time... The results are pretty good; it seems to be a little faster than today's code in Trender benchmarks, the code is smaller and cleaner and much more correct and extensible and better documented. It will also make it relatively easy to fix longstanding issues like caret drawing and visual merging of multiple outlines for the same element. It fixes two acid2 bugs (which I think leaves two left, both of which should be fixed by the reflow branch).

The question is where to go from here. I know where I want to get to:

  1. No view system
  2. Only toplevel windows, popups, and embedding widgets have native widgets.
  3. ... except for plugins, which have platform-specific solutions, but at least initially on each platform we'll hang each plugin off the top-level widget, wrapped in its own container specifically so that we can clip the plugin to an arbitrary rectangle.
  4. Optimize window updates (repaints, scrolls, plugin geometry changes) as follows:

    1. First, compute the area that will be need to be repainted. This includes areas under plugins that will be moved/resized.
    2. Render that area into an offscreen buffer.
    3. Perform the scroll and/or plugin widget changes.
    4. Copy the repaint area from the offscreen buffer to the screen.

    This should keep flicker to a minimum. Control over this process should actually be moved down into toolkit-specific code because platforms need different approaches here. The above is merely the most generic and something that can be implemented with few changes to our cross-platform nsIWidget API, and therefore is a good first step.


Getting rid of child widgets in Gecko content will eliminate a bunch of nasty per-platform code and associated platform-specific bugs, plus improve performance. In the short term it will break accessibility, at least on Windows.

Removing widgets from subdocuments and scroll areas can't happen until the plugin work happens (otherwise plugins will stop being clipped when they're outside the scrolling area ... eww!). Removing views will be easier when widgets are removed (otherwise we'll have to port a bunch of widget management code to the frame system). The plugin work will create significant flicker until the optimized window update is implemented, but the optimized window update would be a lot easier after the widget removal. Also it would be good to do optimized window update after view removal, otherwise we'll have to implement it in the view system and then reimplement in the frame system soon afterward.

So it's a bit of a conundrum. Currently I think the best approach is to do the plugin work first, then widget removal, then view removal, then optimized window update. We can live with flickery plugin scrolling on the trunk for a while. The main argument against this approach is that we might get to the end and discover that optimized window update hasn't really fixed flickery plugins, but I think we'll just have to chance our arm. We really need to move to platform-specific solutions to get plugins rendering into offscreen buffers, anyway.


Comments

Daniel Cater
It's bug 317375 I believe for those who are interested. There's no target milestone; is this 1.9 material?
Robert O'Callahan
Yes, it's all 1.9 material.
Michael
You mentioned fixing 'many many bugs' in the bug when testing Hixie's tests. Happen to recall a few of those? :)
Jason Barnabe
Even though I don't understand any of it, it sounds cool. Good work!
Mark El-Wakil
Reading your last post on this patch, you mentioned there will be brief moments where memory will spike due to a large number of frames within a visible page (you said ~500k or so). Are there any places in this new code where memory is conserved? Does only requiring once pass make much of a difference on memory consumption.
The scenario that came to mind for me was having an RSS feed open a ton of links. Would this be 500k * number_of_tabs, or 500k of memory that keeps getting allocated and deallocated serially?
Just curious :). In any case, thanks!
Rishi Maharaj
What Jason said. ;)
Robert O'Callahan
Mark: the latter, 500K allocated and deallocated serially.