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
@pcwalton indicated his approval for landing stuff for the servo/gecko layout integration into the tree, which will improve maintainability for that effort. Here's an initial batch.
Source-Repo: https://github.com/servo/servo
Source-Revision: 9412e71460990f40ea7f9706fd79fbcd4eb0670a
Issue #2009 has already been fixed and closed so we can remove this TODO
entirely.
Source-Repo: https://github.com/servo/servo
Source-Revision: 48388ad0369368f2d8a631a3fb1cf46892434130
Now that euclid is up-to-date this workaround is no longer necessary.
Source-Repo: https://github.com/servo/servo
Source-Revision: 1ddcf9463a58a2c4d9b1495cd6b0113af6a5c071
Review of documentation that was missing needed.
Fixes#8833.
Source-Repo: https://github.com/servo/servo
Source-Revision: 7438bc0425749989b8aab084a34ff3fff2ea6679
This is a proposed in servo/servo#8792 clean up.
Fixes#8792.
Source-Repo: https://github.com/servo/servo
Source-Revision: 2dbc314e2dec39b8798d4e922dd5220d32083b56
This makes the initial download for skia go from a 300 MB git repository to a 5 MB tarball. This should help with issues like #6132 and #7687.
Fix https://github.com/servo/skia/issues/70
This builds, but the at the moment causes a number of tidy errors for duplicated crates.
Source-Repo: https://github.com/servo/servo
Source-Revision: 8b95d7b8d860ec4c0834192083361a9fb78ddbeb
This gets us to where we need to be in order to write a Gecko implementation of the layout wrapper and have things Just Work.
Note that this is somewhat more than we need for just running the style system. But there wasn't a clean place to cut, and I thought it was a good idea to just do a complete job on it now, which may save us effort and mismatches in the long run.
Source-Repo: https://github.com/servo/servo
Source-Revision: 1f732cfbb404bfd96c3ed3f71c4b9900b7ffbba2
The RECONSTRUCT_FLOW restyle damage bit shouldn't apply to newly
constructed flow tree elements. It is explicitly removed for Flows, but
not for Fragments. This causes RECONSTRUCT_FLOW to bubble up to Flows
that contain any Fragments at all. Instead explicitly remove the
RECONSTRUCT_FLOW bit when creating a new Fragment.
There isn't a good way to test this currently, but all tests should
continue to pass.
Source-Repo: https://github.com/servo/servo
Source-Revision: d50b87edeca45fdca1cf491e6a9a18011fe0c120
Updated string_cache to 0.2, and updated the dependencies that depend on string_cache.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
r? @SimonSapin
Source-Repo: https://github.com/servo/servo
Source-Revision: 188fa9378c103093f1f8dac24bff0d9d237fd2bc
This adds a new pair of reader-writer locks. I measured the performance
of style recalculation on Wikipedia and the overhead of the locks was
not measurable.
Closes#7816.
cc @paulrouget
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 4f625d3ab67bc14b1563f90c48cf97ca59dc1a28
Use the PrintTree utility to improve the readability of flow tree
dumps. Blocks and fragments are now split over two dump levels, because
otherwise they are impenetrable. Also start printing the restyle damage of
fragments.
Source-Repo: https://github.com/servo/servo
Source-Revision: a2330f494316926dca9f64431d8357a093143d7d
BUBBLE_ISIZES and REPAINT can become "stuck" on in the default Servo
configuration once they are activated. This is solved by removing these
damage bits after they no longer apply. There isn't a good way to test
this, other than noting that it doesn't break any existing CSS tests.
This will become more important in the future as the REPAINT bit is used
to implement display list patching.
Source-Repo: https://github.com/servo/servo
Source-Revision: 8b6bfb615a8a04177c321c4940f79f090b0a7971
Also ensure that 3d translations get layers.
Fixes#8329.
Source-Repo: https://github.com/servo/servo
Source-Revision: c19b01c2f4acdccf140e65145c8915acc6fbe59c
This means we only deal with TrustedNodeAddress in LayoutTask::handle_reflow,
which is where the safety of this usage is guaranteed (by the ScriptReflow
destructor).
Source-Repo: https://github.com/servo/servo
Source-Revision: fc54534898c9ce4cc443e6155e0004ec4edfbb1f
Multiprocess mode is enabled with the `-M` switch, and sandboxing is
enabled with the `-S` switch.
Rebase of #6884.
Source-Repo: https://github.com/servo/servo
Source-Revision: 8b39b9afed6ef8a3d7d3e6609fd301a37825d3e1
There's still more refactoring to do, but this is the core stuff that's most likely to bitrot.
Source-Repo: https://github.com/servo/servo
Source-Revision: a5babb89a02b9b84a8cd62554a5ceef9efb0d481
I don't think this code is called when there is no document element, but I
added assertions to make sure we notice in case I was wrong.
Source-Repo: https://github.com/servo/servo
Source-Revision: 20d26853e145e275695463662b6cee334cd27085
I don't believe there is a case where it would make sense to drop the
ScriptReflow struct without joining the script thread. This approach should
be somewhat more robust, and avoids the code smell of a RAII guard in an
otherwise unused variable.
Source-Repo: https://github.com/servo/servo
Source-Revision: db94fda10e3351c96a0df61099d2fdfa481cc62b
This patch makes DOMString an opaque wrapper round String (currently it's a transparent wrapper).
The changes are:
* Replacing DOMString(foo) by DOMString::from(foo).
* Replacing foo.0 by String::from(foo).
* Adding functions clear, push_str and extend for in-place mutation of DOMStrings.
* Replacing DOMString by String in other threads (devtools, storage and filereader).
* Making DOMString implement !Send.
* Removing the pub attribute from the contents of DOMString.
This enables experimenting with other string representations in the DOM.
Source-Repo: https://github.com/servo/servo
Source-Revision: 62acdd303b78951885c2c90747b31f318907d6c9
Instead of making a stacking context out of inline fragments parent
flow, make the inline fragment itself the stacking context. This fixes
positioning and rendering of these sort of fragments and prevents
over-layerization.
Fixes#7424.
Fixes#5812.
Source-Repo: https://github.com/servo/servo
Source-Revision: efc31e619d0d4024faafbfecbd01aa4cff523904
Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">).
Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents.
This all has various nice consequences:
- Stylesheet loading becomes a non-blocking operation.
- Stylesheets are removed when the element they're associated with is removed from the document.
- It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them).
- Various subtle correctness issues are fixed.
One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state.
Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content.
Source-Repo: https://github.com/servo/servo
Source-Revision: 7ff3a17524e0e703e3ac279441729c185444be24
Always produce a DisplayList when processing nodes for display list
construction. StackingContexts are now added to the positioned content
section of DisplayLists. This makes the code a bit simpler and opens up
the possibility of producing a StackingContext in another section of
the DisplayList. This doesn't change behavior, but is a cleanup
prerequisite for proper inline stacking context support.
Source-Repo: https://github.com/servo/servo
Source-Revision: da25b8c848886d2fc875008de5adcaf13d7c9e99
This flag is no longer necessary, because stacking contexts can now
create layers lazily for content that needs to be stacked above a
layer. This should reduce the number of layers on pages, hopefully
reducing overdraw.
Source-Repo: https://github.com/servo/servo
Source-Revision: acc0bf68736d6e4aee2e370bf91fc2465415aa6e
This was causing a bunch of tests in tests/wpt/web-platform-tests/html/semantics/embedded-content/the-canvas-element/size.attributes* to fail. They were returning "auto" instead of the correct size. They still fail because the returned size is off by a few pixels, not sure why yet. But this is more correct and may fix other failing tests.
Source-Repo: https://github.com/servo/servo
Source-Revision: b6850853da5fc677ecfa15d273159371a909ac6c
Also include absolutely positioned elements in the overflow rect calculation.
Fixes#7797.
Source-Repo: https://github.com/servo/servo
Source-Revision: ca56ebbb09f3c258d10e7a7fa276d42fe258d893
Sometimes positioned content needs to be layered on top of stacking
contexts. The layer synthesis code can do this, but the current design
prevents it because stacking contexts are stored in a separate struct
member. In order to preserve tree order, mix stacking contexts into the
positioned content list, by adding a new StackingContextClass
DisplayItem. Such items do not have a base DisplayItem.
In some ways this simplifies the code, because we no longer have to
have a separate code path in the StackingContextLayerCreator.
Source-Repo: https://github.com/servo/servo
Source-Revision: 86e3add8fdc35fc6980bb63695781925607437b8
After all these changes are applied, Hacker News and GitHub only repaint and reflow nodes that actually have hover styles applied when the mouse moves over them.
r? @mbrubeck
cc @bholley
Source-Repo: https://github.com/servo/servo
Source-Revision: 36c5dd4c8c543ed6767fe9dd367281b292d68dba
This resolves#8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.
Source-Repo: https://github.com/servo/servo
Source-Revision: e91169c0e2cfe37b1a2d0feb3aab50b72c816ffc
As per #8238 I changed `layout_interface::Msg::Reflow` to store `ScriptReflow` rather than `Box<ScriptReflow>`
I ran the tests and believe everything passed but this is my first commit to the project so sorry if I messed up the protocol!
Source-Repo: https://github.com/servo/servo
Source-Revision: 601169c0e5b0207805bb316b21e556f5ab67df9b
Given the comments above the match statement, it seems that fixed-pos check should match only block elements in this case. Doing this change seems to partially resolve the issue where list items with `position:fixed;` styling are not displaying their bullet points. This change only resolves the issue for list items with `list-style-position: inside`, outside positioning is still not functioning correctly.
https://github.com/servo/servo/issues/8001#issuecomment-149781613
Source-Repo: https://github.com/servo/servo
Source-Revision: 381317f658bbfd66674cc1e92b27c86503ca7d31
Previously, this was most noticeable with 45deg gradients, where the gradient would end too early, and the remainder was filled with a solid color.
(This also fixes gradients on webrender, which relies on the start and stop points being correct).
Source-Repo: https://github.com/servo/servo
Source-Revision: b8f196f858dea3b6c275eafa57d14679f9be7066
This reduces some unnecessarily tight coupling, makes it clearer what these functions do, and may help avoid bugs where we would return from such a function without updating the relevant field.
It is also a precondition for some future experimentation I'm thinking of doing with this querying design.
Source-Repo: https://github.com/servo/servo
Source-Revision: 3a254b7e20c37e4ce7b614abea9ebd4687c65f98
Canvas is currently given a layer at the stacking context level.
Instead it's DisplayItem should be given a layer directly. This fixes
painting order issues where canvases are painted on top of other
positioned content that is later in tree order. It always simplifies
the code a bit.
Source-Repo: https://github.com/servo/servo
Source-Revision: 22a6884a671da0434fe2b3bf30f50b9133d4c70b
This adds the input caret for textareas. Although, it does not handle multiline textareas correctly. The caret gets displayed for each line.
I'll look into that but that will take more time. Some feedback on this small patch would be appreciated though.
Source-Repo: https://github.com/servo/servo
Source-Revision: af6a64e176ec66a9c066e9e7bf40b6ce3ac77b2e
This isn't doing anything right now, and we're not even setting it properly
in dirty_impl the |dirty_subtree(self)| was causing us to hit the skip case
for step 3.
Source-Repo: https://github.com/servo/servo
Source-Revision: 50ec2353845bf2a3971d5b01db37d2c3741d3912
Removes all those messy FooCast structures in InheritTypes.rs.
Source-Repo: https://github.com/servo/servo
Source-Revision: 674589c370d978f543e71f995d58c5b28e6e9842
Instead of always promoting iframes to StackingContexts, integrate them
into the display list. This prevents stacking bugs when
non-stacking-context elements should be drawn on top of iframes.
To accomplish this, we add another step to ordering layer creation,
where LayeredItems in the DisplayList are added to layers described by
the LayerInfo structures collected at the end of the DisplayList.
Unlayered items that follow these layered items are added to
synthesized layers.
Another result of this change is that iframe layers can be positioned
directly at the location of the iframe fragment, eliminating the need
for the SubpageLayerInfo struct entirely.
Iframes are the first type of content treated this way, but this change
opens up the possibility to properly order canvas and all other layered
content that does not create a stacking context.
Source-Repo: https://github.com/servo/servo
Source-Revision: 11d23a41b31c2b2846d1e9c6b40e87ba7e2a095f
This is mostly straightforward. I had to modify a couple of places
which were accidentally discarding whitespace.
Fixes#1513.
This fixes some relevant tests from the CSS testsuite... but a lot of
them are either manual, or don't pass because of unrelated issues. (For
example, white-space-mixed-002 renders correctly, but
white-space-mixed-002-ref doesn't because of a float bug.)
I'd appreciate any suggestions for how to go about adding tests for this.
Source-Repo: https://github.com/servo/servo
Source-Revision: c3ab71109ee2ffcc31b40890f4c6739d8f5b1333
`get_input_size ` and `get_input_value ` aren't used in the codebase.
Ref.-Issue: #8063
Source-Repo: https://github.com/servo/servo
Source-Revision: 50ad1b064d6e85e84707d83ca8f4b5b541b6b8da
Just getting my feet wet with Rust here. Please feel free to nit the hell out of it stylistically and idiomatically. :-)
Source-Repo: https://github.com/servo/servo
Source-Revision: ff2151b8bbc62fa29c90a429b7a4f12520420b6e
When a stacking-context is not positioned, its z-index should be
ignored. This is per CSS 2 9.9.1. The only exception to this is when
the z-index is applied to an element with display: flex | inline-flex.
inline-flex does not appear to be implemented at this time so we only
do this for flex.
Source-Repo: https://github.com/servo/servo
Source-Revision: 90dd3cdc095d7bf54435f0fcb8a6fe134b00fc24
This frees us forever from caring about maintaining these enums. The last commit removes their use from the initialisation of interface objects derived from Node.
Source-Repo: https://github.com/servo/servo
Source-Revision: 32daa17d5cbcad02db0713e21e52410cdc60480e