servo/components/layout
bors-servo 9d47b344d9 Auto merge of #9663 - pcwalton:browser-html-jank-fix, r=glennw
compositing: Stop compositing unnecessarily after each animation frame.

Instead, schedule a delayed composite after each frame of an animation.

The previous code would cause jank, because the following sequence
frequently occurred:

1. The page uses `requestAnimationFrame()` to request a frame.

2. The compositor receives the message, schedules a composite,
dispatches the rAF message to the script thread, composites, and goes to
sleep waiting for vblank (frame 1).

3. The script makes a change and sends it through the pipeline.
Eventually it gets painted and is sent to the compositor, but the
compositor is sleeping.

4. The compositor wakes up, sees the new painted content, page flips,
and goes to sleep (frame 2). Repeat from step 1.

The problem is that we have two composition frames, not just one. This
halves Web apps' framerate!

This commit fixes the problem by scheduling the composite in step 2 to
12 ms in the future. We already have this delayed-composition
functionality in the form of the scrolling timer, which I repurposed and
renamed to the "delayed composition timer" for this task. This change
gives the page 12 ms to prepare the frame, which seems to usually be
enough, especially with WebRender.

Note that simply removing the scheduled composite after rAF is not the
correct solution. If this is done, then pages that call rAF and don't
modify the page won't receive future rAFs, since the compositor will be
sleeping and won't be notified of vblank.

Fixes a bunch of jank in browser.html. The remaining jank seems to be a
problem with browser.html itself.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9663)
<!-- Reviewable:end -->
2016-02-25 03:56:02 +05:30
..
animation.rs Move AnimationState to script_traits 2016-01-13 18:14:12 -05:00
block.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
Cargo.toml Auto merge of #9722 - mbrubeck:slow-selector, r=nox 2016-02-24 18:55:39 +05:30
construct.rs Remove unused fixed_descendants: AbsoluteDescendants 2016-01-28 09:43:14 +01:00
context.rs Refactor style to be completely backend-independent 2016-02-13 16:05:14 +01:00
data.rs Refactor style to be completely backend-independent 2016-02-13 16:05:14 +01:00
display_list_builder.rs Auto merge of #9589 - glennw:webrender, r=pcwalton 2016-02-19 00:54:06 +05:30
flex.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
floats.rs Move util::persistent_list to layout 2016-02-20 19:20:38 +01:00
flow.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
flow_list.rs Add Multicolumn support block fragmentation. 2016-01-28 09:43:14 +01:00
flow_ref.rs Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
fragment.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
generated_content.rs Introduce a concept of restyle damage to the style system. 2016-01-04 09:38:04 -08:00
incremental.rs style: Refactor the per_pseudo map from StyleData to avoid having an option value type. 2016-02-13 16:05:17 +01:00
inline.rs Auto merge of #9668 - glennw:inline-accuracy, r=pcwalton 2016-02-18 17:48:15 +05:30
layout_debug.rs Update to rustc 1.7.0-nightly (b4707ebca 2015-12-27) 2016-01-14 14:56:18 -06:00
layout_thread.rs Auto merge of #9663 - pcwalton:browser-html-jank-fix, r=glennw 2016-02-25 03:56:02 +05:30
lib.rs Move util::persistent_list to layout 2016-02-20 19:20:38 +01:00
list_item.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
model.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
multicol.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
opaque_node.rs Replace OpaqueNodeMethods::from_{threadsafe_,}layout_node by opaque methods. 2015-06-24 14:55:43 +02:00
parallel.rs Remove parallel display list construction 2016-02-19 15:53:12 -08:00
persistent_list.rs Move util::persistent_list to layout 2016-02-20 19:20:38 +01:00
query.rs Completed implementation of devtools' getLayout. 2016-02-24 13:51:47 -05:00
sequential.rs Bonus Fix - Rename traverse_dom_preorder to traverse_dom. 2016-01-06 19:21:13 -08:00
table.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
table_caption.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
table_cell.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
table_colgroup.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
table_row.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
table_rowgroup.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
table_wrapper.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
text.rs Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
traversal.rs layout: Stop parameterizing on N for RecalcStyleAndConstructFlows 2016-02-13 16:05:17 +01:00
webrender_helpers.rs Add WebRender integration to Servo. 2016-02-18 10:35:29 +10:00
wrapper.rs Dirty elements whose selectors are affected by sibling changes 2016-02-23 17:31:38 -08:00