This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well.
Source-Repo: https://github.com/servo/servo
Source-Revision: 639fdd6b128e0cfd418e4ae0dd78de3f5aecac4c
Otherwise, the heuristics can pass even when there are no floats,
causing block formatting contexts to be speculated to be flowing around
floats that don't exist!
Closes#10237.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 3f733217109a98f559904ebf9935e43e553bd076
Fixes#10200. r? @pcwalton
Note: The reftest uses a transition of non-zero duration, because I couldn't find any other way to reproduce the bug. Unfortunately this makes it unreliable in debug builds. I tried to fix this using reftest-wait with setTimeout and requestAnimationFrame, but it still wouldn't complete the animation consistently. To make the test work in debug builds we may need `transitionend` events (#10245) or a different way to reproduce the bug.
Source-Repo: https://github.com/servo/servo
Source-Revision: 159be44193ef7d60a5c35629d791323e5357e7db
Fixes#9993. This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: bed91b3334786970c91a47c3bc95889d8675b4d5
The old code tried to do the speculation as a single bottom-up pass
after intrinsic inline-size calculation, which was unable to handle
cases like this:
<div>
<div style="float: left">Foo</div>
</div>
<div>
<div style="overflow: hidden">Bar</div>
</div>
No single bottom-up pass could possibly handle this case, because the
inline-size of the float flowing out of the "Foo" block could never make
it down to the "Bar" block, where it is needed for speculation.
On the pages I tried, this regresses layout performance by 1%-2%.
I first noticed this breaking some pages, like the Google SERPs, several
months ago.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 1554331f06900e69f246ed9986a08aae91a0a71e
This fixes `margin-collapse-104.htm`, which is currently accidentally
passing due to lack of #10085. When that PR lands, then that will become
a representative test case.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 9b2ae3a62faafceb3149dc455fc6123de2b306f7
After #10021, `LayoutThread::repaint` no longer forced a repaint because of the `restyle_damage` check. This patch adds the correct restyle damage and fixes#10163.
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 8984d95a28ac1060f3c809e98434513fdf9f09b5
This allows geckolib to pass gecko style structs and have the style system write to them directly, provided we implement all the traits.
Source-Repo: https://github.com/servo/servo
Source-Revision: 605842f193aedc1151ab38a99c49f693c76e5cf3
This PR cleans up the layerization infrastructure for canvas, which was unused, and removes unused dependencies.
It also takes in account my recent username change to update angle's dependency (offscreen_gl_context requires extra work due to webrender depending on it).
r? @jdm
Source-Repo: https://github.com/servo/servo
Source-Revision: 2887623c4ae1960dfef52b14cd4afc3b279f9feb
This is a follow-up to #9876. It avoids clearing and rebuilding SelectorMaps
when vh and vw units need to be recomputed. Instead it just dirties all nodes,
to force elements to be re-cascaded.
Filed #10104 for later follow-up work to dirty only affected nodes.
r? @SimonSapin
Source-Repo: https://github.com/servo/servo
Source-Revision: 41060dbdd77b2bcd02d03c7fe00663f612bac2e4
A few changes:
* Make `compute_damage` short-circuit more, by skipping comparisons if they will only set flags that are already set.
* Update some obsolete comments.
* Add a bunch of missing properties to `compute_damage`.
* Set `RECONSTRUCT_FLOW` when `text-decoration` changes, because it can affect text fragment splitting/merging.
I believe this is all of the computed properties except for the animation properties. (I wasn't sure what to do with those.) After this lands I'd like to work on moving this information into `properties.mako.rs` so that this function can be auto-generated, and so that newly-added properties can default to setting all flags instead of none.
Source-Repo: https://github.com/servo/servo
Source-Revision: d1e27eb4f4090ff891afdeb62ae29e4f2dde27e0
@jdm PTAL I'm not sure what is the approach of updating cargo components here, I've made a pull request https://github.com/servo/heapsize/pull/54 but it has to be landed first before merge and version bump.
Source-Repo: https://github.com/servo/servo
Source-Revision: 9a8ba23a763b2a8d272c4335974d5a68623c054c
This reduces CPU usage when mousing over simple pages (example.com). More complex pages (Wikipedia) still reflow a lot due to other bugs.
Additionally, this change causes Servo to stop painting the results of hit test queries. This is also a win for CPU usage.
This significantly improves #9999, though there's more that can be done. I'll leave it open in case @paulrouget thinks this PR isn't enough.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 9813d11f862a61a7cffb4cf2d7de0fa7d269c62a
Requires a patch to rust-selectors, and doesn't currently recalculate the styles correctly (which is needed to make actual toggling work correctly).
Still trying to figure out what it takes to get style recalc to do what this needs.
Source-Repo: https://github.com/servo/servo
Source-Revision: 090da52913a47e027a96d4f6a39c56e55b9db811
Right now, the only reason that overflow calculation works is that we
rely on script inducing extra reflows that are sent for display. This
was preventing #10021 from landing.
This change regresses layout performance by about 1% in my tests.
Fixes#7797 properly.
r? @mbrubeck
cc @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 8120fb5c2d170d5d9838696a7a5b871a43f57bb2
Right now, there's a huge amount of complexity in T{Node,Element,Document} and friends because of the lifetime parameter.
Before I started generalizing this code for use by Gecko, these wrappers were plain structs. They had (and still have) a phantom lifetime associated with them to prevent references to DOM nodes from leaking past the end of restyle, when they might be invalidated by a GC.
When I generalized them, I decided to put the lifetime on the trait as well, since there are some situations where the lifetime is, in fact, necessary. Specifically, they are necessary for the compiler to understand that all the things borrowed from all the nodes and elements and so on have the same lifetime (the lifetime of the restyle), rather than the lifetime of whichever particular element or node pointer the value was borrowed from. This come up in situations where we do |let el = node.as_element()| or |let n = el.as_node()| and then borrow something from the result. The compiler thinks the borrow lifetime is that of |el| or |n|, when it's actually longer.
In practice though, I think the style and layout algorithms we use don't run into this issue much, and we can hack around it where it comes up. So I think we should remove the lifetimes from the traits, which will let us aggregate the embedding-provided traits together onto a single meta-trait and significantly simplify the code.
Source-Repo: https://github.com/servo/servo
Source-Revision: aea8d8959dcb157a8cc381f1403246ce8ca1ca00
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. r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: d330ecdafcdb2556a8ab028436ec87aa6b6db6fe
This fixes#7846, a failure in the "quotes-036.htm" test. Servo lays out this test correctly in its initial layout, but then messes it up in any relayout (whether it's an incremental or full layout).
The problem is that the ResolveGeneratedContent traversal is not safe to run more than once on the same flow. It mutates some GeneratedContent fragments into ScannedText fragments, but leaves others unmodified (in particular, those that generate empty content). The next time layout runs, these remaining GeneratedContent fragments are processed *again* but with an incorrect correct quote nesting level (because some of the surrounding GeneratedContent fragments are gone).
This patch ensures that each GeneratedContent fragment is resolved only once.
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 71b1122e97303c51bac73d03d8af617069a75d21
Add the `scrollWidth` and `scrollHeight` extensions to the element interface. My goal was to create a method that encompassed getting `scrollWidth`, `scrollHeight`, `scrollTop`, and `scrollLeft`.
I also noted that `clientHeight` and `clientWidth` to not handle the root element and the body element correctly.
Source-Repo: https://github.com/servo/servo
Source-Revision: 7ff7932a8cb15c42a436958e953cc904ba7a0bd8
This fixes a bug in line splitting caused by the following actions when `LineBreaker::split_line_at_last_known_good_position` is called:
1. Push some number of previous fragments onto the front of the work list.
2. Push the current fragment back onto the front work list.
This resulted in the work list being out of order. The correct order is action 2 followed by action 1. Fixes#9830. r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 059edc3287909ce705ba90804c778ee50f1e157e
Now that WebRender uses an Iframe display item, we do not need the Noop
item for the non-WebRender path. We can simply reuse the Iframe display
item. Also remove the layer_id member from the LayeredItem struct, as
it is unused.
Source-Repo: https://github.com/servo/servo
Source-Revision: 40083a7aa84c2459f2f1de7dd826d39f80e2195f
We need to bump webrender before being able to bump Serde, but we also needs these bumps, so let's include them ASAP first because bumping a lot of things is always a pain.
Source-Repo: https://github.com/servo/servo
Source-Revision: 0f526054ebfa164ca2545d881b8392a744af7870
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.
Source-Repo: https://github.com/servo/servo
Source-Revision: aba500a698584e66975cd93006ca8cf745370f7d
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.
Source-Repo: https://github.com/servo/servo
Source-Revision: 37bcc161fe45bf8c1cb1172b8e0d12c7d03371b6
Flat display lists were a 2x regression on the spheres demo. This patch series fixes that.
See the individual commits for more details.
r? @mrobinson
Source-Repo: https://github.com/servo/servo
Source-Revision: 55fc48e4c46917a0f036d0054fac296bb5719434
Now we only query for the topmost node, and apply the hover state to all
of the parent elements.
This fixes things like #9705, where the hover state was applied only to
the children.
This also makes us more conformant with other browsers in the case of
taking in account margins and paddings.
For example, prior to this PR, when your mouse was over the inner
element, in the bottom part, `hover` styles didn't apply to the parent.
```html
<style>
div {
padding: 10px;
margin: 10px;
height: 15px;
background: blue;
}
div:hover {
background: red;
}
</style>
<div>
<div></div>
</div>
```
Fixes#9705
Source-Repo: https://github.com/servo/servo
Source-Revision: 056a7cf1a2284063e5d32c6627b86f6931957a74
It was introduced in 4dc9d8b1c5a4e68eee09af547ae7069455c9abe9.
Source-Repo: https://github.com/servo/servo
Source-Revision: de7c67575e5cfe71578d226026484da5c6de8707
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.
Source-Repo: https://github.com/servo/servo
Source-Revision: 62814f7cb486bc267a796b7ce58c51d59240fad0
Two related fixes for border-collapse:
* Fix border collapsing across table-row-group flows
This fixes the border-end calculation for table rows whose borders are collapsed with rows in different rowgroups. The border collapsing code now uses an iterator that yields all the rows as a flat sequence, regardless of how they are grouped in rowgroups. It gets rid of `TableRowGroupFlow::preliminary_collapsed_borders` which was never correct. (It was read but never written.)
This may fix#8120 but I'm not 100% certain. (I haven't managed to reproduce the intermittent failure locally, and my reduced test case still fails but in a different way.)
* Fix confusing `push_or_mutate` API
This fixes a bug when recalculating border collapsing for an existing table row. The bug was caused by using `push_or_mutate` which has no effect if there is already a value at the specified index.
The fix switches incorrect `push_or_mutate` calls to use `push_or_set` instead. It also renames `push_or_mutate` to `get_mut_or_push` which I think is a less-confusing name for this method.
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 1d6aece589410e13d9773d702f4426d3e197155c
Mostly straightforward; includes some extra fixes to make `<canvas>`
work the same way as `<img>` for reflow.
Rebase of #8531.
Source-Repo: https://github.com/servo/servo
Source-Revision: 8c23cbb78b36ac143bbea3b2e64961bfc46d8e0d
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
Source-Repo: https://github.com/servo/servo
Source-Revision: 9d47b344d9d0cf6faa3430bb32bdb4ba3eb11cf7
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.
Source-Repo: https://github.com/servo/servo
Source-Revision: 7f8c34ce8ed6e5758d2723a2c736107f9765aa24
Rebase of #7267. Fixes#3598.
This avoids all of the sketchy issues of trying to read the style data for margins from the script thread. I replaced it with a layout query that fetches the margin style properties for a given element.
Source-Repo: https://github.com/servo/servo
Source-Revision: 09e987b559688caeef75aecd265c68f8d2b5c7e2
This fixes incremental layout of nodes that match pseudo-class selectors such as :first-child, :nth-child, :last-child, :first-of-type, etc. Fixes#8191 and other intermittent layout bugs.
This code is based on the following flags from Gecko:
https://hg.mozilla.org/mozilla-central/file/e1cf617a1f28/dom/base/nsINode.h#l134
Depends on servo/rust-selectors#71. r? @SimonSapin
There are a couple of TODO items in this commit, but I'd appreciate feedback on the general approach before I finish it up. (Also, if someone who knows more than I do could give some advice about atomic orderings...)
Source-Repo: https://github.com/servo/servo
Source-Revision: 438b3a444b40ea85e53be0bd1c4689680d577727
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!
Source-Repo: https://github.com/servo/servo
Source-Revision: ab07b06823ea9748a6091aee2281495f86f00bce
--HG--
rename : servo/tests/unit/net_traits/lib.rs => servo/resources/shaders/clear.fs.glsl
rename : servo/tests/unit/net_traits/lib.rs => servo/resources/shaders/debug_color.fs.glsl
rename : servo/tests/unit/net_traits/lib.rs => servo/resources/shaders/mask.fs.glsl
This fixes rounding accuracy issues that could result in layout producing results off by a small number of Au.
Source-Repo: https://github.com/servo/servo
Source-Revision: 83be388f59b1bb4dfccc6ccd89022caa13b37a94
This allows, among other things, having different implementations for parsing pseudo{elements, classes} in both `ports/geckolib` and in servo.
Source-Repo: https://github.com/servo/servo
Source-Revision: c11844cbf28054784c8d65781cff20045d8ee48b
Fixes#9556.
This makes Servo compile with one warning less.
Source-Repo: https://github.com/servo/servo
Source-Revision: cb8be1434f61e6bfe4639d42b1422329b0451a47
A bunch of random things that we might as well merge into the tree.
Source-Repo: https://github.com/servo/servo
Source-Revision: 629b1d33d5d6153da87d1ae176ea6c9b9298c650
This commits updates rust-selectors to use the generic parser, and as
such it moves the element state into the style crate.
Source-Repo: https://github.com/servo/servo
Source-Revision: ae20f2556bc7807b39b6649ac1f738644abcc26a
This code dates back to the time when absolutely positioned flows were
ignored by all of their ancestors up to the containing block. This
hasn't been true for at least a year.
Closes#9306.
Closes#9309.
Is a partial fix for #9308.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 4755cc5c6211e845fc8081cb3c8a67b4bdbea5cc
The wrapper stuff is partially-complete, modulo some unimplemented methods. The glue code is just a toy for now. Regardless, I think it's worth getting some of this stuff in-tree to minimize breakage.
Source-Repo: https://github.com/servo/servo
Source-Revision: 77d3fbcca3c6f7e8b4068f89e25b090977fe5672
This is part of slimming down the dependencies of geckolib.
Source-Repo: https://github.com/servo/servo
Source-Revision: 3680e82cab766a412a969a21c0cdff0c7f97d7bc
- Currently the cursor sticks around if you click elsewhere. Now the text inputs are relayout-ed on blur.
- Currently whitespace gets collapsed in text input (https://github.com/servo/servo/issues/8772). Not anymore.
Source-Repo: https://github.com/servo/servo
Source-Revision: 099beee85c02d391b854dc5e06da34f89df8b760
Resolves#9222. Moved Epoch from components/msg/compositor_msg to
components/gfx_traits/lib. Updated use statements to reflect the move.
Source-Repo: https://github.com/servo/servo
Source-Revision: e89dd05a169aa16267bdb2dbfe5bca01ad6cfe84
The LayerType enum is only used in gfx_traits and layout, so it
shouldn't be defined in msg. Move the definition to gfx_traits
instead.
Fixes#9220
Source-Repo: https://github.com/servo/servo
Source-Revision: d3889b4be43eb4d637f2d1ac5d021603653601eb
Now clean up damage on all fragments that belong to a Flow. This ensures
that damage does not re-propagate up to the parent Flow from the
Fragments. It also means that the flow tree dump should show a more
accurate picture of the state of the flow tree.
Source-Repo: https://github.com/servo/servo
Source-Revision: 1436ee5afab4ede68ab834c7d6368a7d45ede7ac
DisplayListSection, StackingLevel, and BackgroundAndBorderLevel all
represent pretty much the same thing, a particular section of the
display list. Instead of maintaining three enums which do the same
thing, just use DisplayListSection everywhere. It's a superset of the
other two and this change will make it easier to flatten the DisplayList
in the future for WebRender.
Source-Repo: https://github.com/servo/servo
Source-Revision: be555a9409c949bea7287b0e21df009bce3cb328
This helps WebRender look for useless clips and optimize them out.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 58111a6420d3edded1cb66efa7c9863f1b3cdd8e
See the commit messages for details.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: a0d26445c0df6361e1e8655581a09f0e0faf0818
This should be the last major hoisting necessary to use the style system standalone. \o/
Source-Repo: https://github.com/servo/servo
Source-Revision: ddc3b7942eea8328e9eb22d864d34fce572d5535
This fixes about 130 clippy lints. Let me know if i should split up the commit.
I wasn't sure about some of the changes, especially map_or instead of map(...).unwrap_or(...) and if let instead of single arm match were not always a strict improvement in my opinion, but i'll leave that decision to the reviewer :)
There are about 150 lints left which i thought were clippy bugs or i didn't know how to fix.
cc @Manishearth
Source-Repo: https://github.com/servo/servo
Source-Revision: 9da739acefc7d1776bf727c8bf782eb79f241028
This is a step towards removing the dependency of stylo on layout/.
This PR depends on #9004.
Source-Repo: https://github.com/servo/servo
Source-Revision: 0f5c614609fd8867a9e7c27b8a398ea7d877c714
Separated layout-specific messages to the constellation out from the `ScriptMsg` enum into a `LayoutMsg` enum within `script_traits/script_msg.rs`, addresses [#8843](https://github.com/servo/servo/issues/8843).
I initially tried to move `LayoutMsg` into `layout_traits/lib.rs`, but this introduced a cyclic dependency: `layout_traits` depends on `script_traits` for the `LayoutTaskFactory` implementation, and `script_traits/script_task.rs` now depends on `LayoutMsg` for new layout channels in `InitialScriptState` and `ScriptTask`.
Source-Repo: https://github.com/servo/servo
Source-Revision: 941653da653a1925ade35597e97f61a6a8a0018d