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
Line height is only based on the tallest box in each line and does not factor in the vertical-alignment. Improves whitespace handling by passing the whitespace state between function invocations.
There were too many changes on master to easily rebase. It was easier to merge to a fresh branch.
Here is the original PR: https://github.com/mozilla/servo/pull/509
This makes the rendering code serial instead of parallel since it now just dispatches commands to the GPU.
It also adds some more profiling data.
r? @pcwalton
This removes the task per tile rendering and instead renders tiles
serially. This also unwraps the rendering into a single function so that it's
much clearer.