Also fixes initial window size to get based on the windowing code instead of
being hardcoded everywhere. This code works on HiDPI displays, but does not
appropriately scale the output up yet.
When loading pages, the constellation spawns a new script<-->layout<-->renderer pipeline that loads in the background while scripts continue executing on the currently loaded page.
script caches last loaded url -- currently no caching policy
naive caching of render layers for near-instant forward/back
handling evicted pipelines is currently broken
Performance will be better and benchmarking easier if we don't run layout an extra unnecessary time when loading a page from the commandline. This is happening because we always send a resize event to the script task from the compositor whenever the platform tells us one happened, even if the window size didn't change. This PR fixes this by checking that the window size is actually different before sending the event.
This PR makes text runs store the results of shaping as a vector of ARC<GlyphStore>; each element of the vector holds the shaped glyphs for a nonbreakable unit of text (basically a word). This change allows us to cache the shaped glyphs for the words, an approach that Gecko (and probably WebKit) uses. We get pretty good cache hit ratios even on the first run of layout for a page (I saw 62% on Wikipedia's main page today), although a lot of that is due to whitespace. This really comes into its own on subsequent layout runs, though, which are completely cached in the typical case.
This is a preliminary step to adding parallel text shaping. In order to have enough time to do a useful amount of work in parallel, we need to trigger text shaping earlier. This PR moves TextRun creation into the box building phase of layout.
I'm pushing this in before the rest of the text shaping patches to avoid bitrot; it's already been through one unpleasant rebase.
I added the minimal amount of code needed to place left-floats on the screen (right floats should also be possible soon). Text does not wrap around floats yet.
One thing I'm curious about is whether some existing abstractions (like Cell) can be used instead of this weird overwriting thing done in float_context.rs.
There is now a SharedChan from the compositor to the renderer. Using this, tiles are re-rendered the tiles at a higher resolution after zooming (this is currently bound to a MouseClickUp event). Also, extra texture layers are deleted, which fixes a bug where old content was being displayed when a new paint message was sent.
Depends on rust-layers: 1e1e359da32c9d0ddb4f93b505a658d669008426