Commit graph

31 commits

Author SHA1 Message Date
Matt Brubeck
ae5cfc31e3 Compute damage even when incremental layout is disabled
This fixes traversals that use the damage flags to decide which nodes to
process, such as `resolve_generated_content`, which was broken in
non-incremental mode.
2016-03-11 09:52:22 -08:00
bors-servo
1c63bf9822 Auto merge of #9861 - pcwalton:superflat, r=glennw
Flatten the WebRender API to allow us to use shared memory to transfer display lists.

Improves performance significantly.

Requires servo/webrender_traits#15 and servo/webrender#222.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9861)
<!-- Reviewable:end -->
2016-03-04 06:45:45 +05:30
bors-servo
aba500a698 Auto merge of #9858 - glennw:anim-smoothness, r=pcwalton
Fix animation smoothness when using requestAnimationFrame.

Previously, the flow for ticking animations was:

Compositor -> Constellation -> Layout -> Script

However, this means that the compositor <-> layout messages can thrash, meaning layout thread is very rarely idle.

This means that the script thread (which joins on the layout thread during reflow) was unable to execute and run rAF callbacks.

With this change, the flow is now:

Compositor -> Constellation -> Script (when rAF is active).
Compositor -> Constellation -> Layout (when transitions / animations are active and no rAF is present).

This makes rAF based animation *much* smoother.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9858)
<!-- Reviewable:end -->
2016-03-04 05:50:50 +05:30
Patrick Walton
5e17325e54 Flatten the WebRender API to allow us to use shared memory to transfer
display lists.

Improves performance significantly.

Requires servo/webrender_traits#15 and servo/webrender#222.
2016-03-03 14:44:48 -08:00
bors-servo
37bcc161fe Auto merge of #9832 - metajack:suppress-reflows, r=mbrubeck
Suppress reflows before RefreshTick or FirstLoad

This fixes a bug where partially loaded content is displayed to the user
before it should be, usually before stylesheets have loaded. This commit
supresses reflows until either FirstLoad or RefreshTick, whichever comes
first.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9832)
<!-- Reviewable:end -->
2016-03-04 04:00:30 +05:30
Jack Moffitt
2507bfb2cf Suppress reflows before RefreshTick or FirstLoad
This fixes a bug where partially loaded content is displayed to the user
before it should be, usually before stylesheets have loaded. This commit
supresses reflows until either FirstLoad or RefreshTick, whichever comes
first.

Unfortunately, hit_test and mouse_over did not do reflows if they were
necessary, and so by suppressing the initial spurious reflows, these
methods started to panic without a display list to query. This patch
also transforms these into queries similar to the other existing
queries.
2016-03-03 15:17:46 -07:00
Glenn Watson
92061132f3 Fix animation smoothness when using requestAnimationFrame.
Previously, the flow for ticking animations was:

Compositor -> Constellation -> Layout -> Script

However, this means that the compositor <-> layout messages can thrash, meaning layout thread is very rarely idle.

This means that the script thread (which joins on the layout thread during reflow) was unable to execute and run rAF callbacks.

With this change, the flow is now:

Compositor -> Constellation -> Script (when rAF is active).
Compositor -> Constellation -> Layout (when transitions / animations are active and no rAF is present).

This makes rAF based animation *much* smoother.
2016-03-04 07:26:00 +10:00
Patrick Walton
d3d2dd05f2 layout: Switch display list building from bottom-up to top-down.
This eliminates a lot of allocations and O(n^2) behavior.
2016-03-03 13:09:56 -08:00
Martin Robinson
e7019f2721 Flatten display list structure
Instead of producing a tree of stacking contexts, display list
generation now produces a flat list of display items and a tree of
stacking contexts. This will eventually allow display list construction
to produce and modify WebRender vertex buffers directly, removing the
overhead of display list conversion.  This change also moves
layerization of the display list to the paint thread, since it isn't
currently useful for WebRender.

To accomplish this, display list generation now takes three passes of
the flow tree:

        1. Calculation of absolute positions.
        2. Collection of a tree of stacking contexts.
        3. Creation of a list of display items.

After collection of display items, they are sorted based upon the index
of their parent stacking contexts and their position in CSS 2.1
Appendeix E stacking order.

This is a big change, but it actually simplifies display list generation.
2016-03-01 14:50:07 -08:00
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
Patrick Walton
9b4cc41695 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.
2016-02-24 14:06:46 -08:00
bors-servo
7f8c34ce8e Auto merge of #9706 - mrobinson:remove-parallel-display-list-building, r=pcwalton
Remove parallel display list construction

Parallel display list construction hasn't been shown to give any
performance gains. It is also incompatible with the current flat display
list implementation. Once flat display lists have landed, we can explore
possible benefits of parallel construction once again.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9706)
<!-- Reviewable:end -->
2016-02-25 02:52:45 +05:30
benshu
0785d91ae4 Completed implementation of devtools' getLayout. 2016-02-24 13:51:47 -05:00
Martin Robinson
630a9d4255 Remove parallel display list construction
Parallel display list construction hasn't been shown to give any
performance gains. It is also incompatible with the current flat display
list implementation. Once flat display lists have landed, we can explore
possible benefits of parallel construction once again.
2016-02-19 15:53:12 -08:00
bors-servo
ab07b06823 Auto merge of #9589 - glennw:webrender, r=pcwalton
Add WebRender integration to Servo.

WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9589)
<!-- Reviewable:end -->
2016-02-19 00:54:06 +05:30
Anthony Ramine
db8d502f41 Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
Glenn Watson
c0531c312f Add WebRender integration to Servo.
WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
2016-02-18 10:35:29 +10:00
Emilio Cobos Álvarez
dd503dfacb Refactor style to be completely backend-independent
This commit refactors the style crate to be completely independent of
the actual implementation and pseudo-elements supported.

This also adds a gecko backend which introduces parsing for the
anonymous box pseudo-elements[1], although there's still no way of
querying them.

https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
2016-02-13 16:05:14 +01:00
Josh Matthews
e6d906dbbf Report CSS errors to script task for further processing. 2016-02-11 14:48:47 -05:00
bors-servo
fb3fe3d784 Auto merge of #9522 - pcwalton:two-overflows, r=mbrubeck
layout: Separate out overflow-for-scrolling from overflow-for-paint.

Closes #9484.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9522)
<!-- Reviewable:end -->
2016-02-05 10:58:50 +05:30
bors-servo
87aaa5ffe0 Auto merge of #9523 - ruud-v-a:hasher, r=Wafflespeanut
Upgrade to new Hasher API

This fixes #9494.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9523)
<!-- Reviewable:end -->
2016-02-05 07:32:13 +05:30
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Patrick Walton
7c5b2d6cb3 layout: Separate out overflow-for-scrolling from overflow-for-paint.
Closes #9484.
2016-02-03 16:06:24 -08:00
Ruud van Asseldonk
95be0b9a25 Upgrade to new Hasher API 2016-02-03 20:06:39 +01:00
Simon Sapin
357463864b Avoid a transmute that relied on undefined struct layout. 2016-01-27 16:37:08 +01:00
Bobby Holley
384cdfcfff Hoist ParseErrorReporter into style and remove the dependency on msg.
The pipeline id stuff is currently unused. If someone needs it, they can add
an additional trait bound on their css error reporter to get the pipeline id.
2016-01-11 18:01:48 -08:00
bors-servo
47617578af Auto merge of #9245 - Ms2ger:reexports, r=nox
Stop reexporting style types from layout_interface.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9245)
<!-- Reviewable:end -->
2016-01-11 23:57:51 +05:30
Ms2ger
9dc85e0d40 Stop reexporting ReflowGoal from layout_interface. 2016-01-11 10:00:17 +01:00
Ms2ger
39ba25572b Stop reexporting Animation from layout_interface. 2016-01-11 09:47:08 +01:00
John DeSilva
f32995543d Move Epoch to gfx_traits
Resolves #9222. Moved Epoch from components/msg/compositor_msg to
components/gfx_traits/lib. Updated use statements to reflect the move.
2016-01-10 17:36:52 -05:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Renamed from components/layout/layout_task.rs (Browse further)