Commit graph

152 commits

Author SHA1 Message Date
Ms2ger
992391d6ad Move the user agent and user stylesheets to layout_thread. 2016-08-23 15:33:47 +02:00
Christian Sonne
908b9627a2 Track only the number of important declarations in a declaration block 2016-08-22 14:05:09 +02:00
Simon Sapin
f9150af936 Keep track of the number of important and normal declarations in a block
… instead of the presence (`bool` flags) of each.

This allows removing `recalc_any` which iterated over the `Vec`.
2016-08-21 10:41:26 +02:00
Simon Sapin
5e4bdac2bd Import SelectorMap unit tests from the selectors crate. 2016-08-21 03:40:39 +02:00
Simon Sapin
dec28a13ea Use FNV hash in SelectorMap 2016-08-21 03:40:38 +02:00
Simon Sapin
a175c9981e Only cascade at a priority level rules that have declarations of that priority. 2016-08-21 03:40:37 +02:00
Simon Sapin
16bbc2f26e Merge normal and important declarations in style rules.
Have a single Vec instead of two. Fix #3426
2016-08-21 03:40:35 +02:00
Simon Sapin
577d2dc3fa Make SelectorMap and friends concrete 2016-08-21 03:40:31 +02:00
Simon Sapin
35b01cd324 Sort rules by key in selector matching 2016-08-21 03:40:30 +02:00
Simon Sapin
4062899fd8 Import SelectorMap back from the selectors crate.
Nobody else uses it, and I want to make breaking changes to it.
2016-08-21 03:40:30 +02:00
Simon Sapin
bc71e8b65b Add some fmt::Debug implementations 2016-08-21 03:40:28 +02:00
Simon Sapin
31864954ed Typo fixes 2016-08-21 03:40:26 +02:00
Anthony Ramine
1c4cc6c703 Update selectors to 0.11
This brings :not() with proper list of complex selectors as argument.
2016-08-20 11:24:17 +02:00
Emilio Cobos Álvarez
3af774bd75
Rewrite the style sharing candidate cache.
The style candidate cache had regressed a few times (see #12534), and my
intuition is that being able to disable all style sharing with a single rule in
the page is really unfortunate.

This commit redesigns the style sharing cache in order to be a optimistic cache,
but then reject candidates if they match different sibling-affecting selectors
in the page, for example.

So far the numbers have improved, but not so much as I'd wanted (~10%/20% of
non-incremental restyling time in general). The current implementation is really
dumb though (we recompute and re-match a lot of stuff), so we should be able to
optimise it quite a bit.

I have different ideas for improving it (that may or may not work), apart of the
low-hanging fruit like don't re-matching candidates all the time but I have to
measure the real impact.

Also, I need to verify it against try.
2016-08-17 14:16:16 -07:00
Emilio Cobos Álvarez
9e88a495c8
style: Introduce a generic way of gathering information from the cascade, and use it for viewport units. 2016-08-16 10:58:16 -07:00
Simon Sapin
fdb2071b2d Update to selectors 0.8.2 2016-08-09 18:18:38 +02:00
Simon Sapin
f419db834c Replace the SelectorImplExt trait with inherent methods. 2016-08-09 18:17:13 +02:00
Emilio Cobos Álvarez
611e611215
style: Rewrite the restyle hints code to allow different kinds of element snapshots, and use it for Gecko.
This is a rewrite for how style interfaces with its consumers in order to allow
different representations for an element snapshot.

This also changes the requirements of an element snapshot, requiring them to
only implement MatchAttr, instead of MatchAttrGeneric. This is important for
stylo since implementing MatchAttrGeneric is way more difficult for us given the
atom limitations. This also allows for more performant implementations in the
Gecko side of things.
2016-07-21 14:24:04 -07:00
Simon Sapin
5c70dfab01 Have a concrete SelectorImpl type everywhere in the style crate.
It is conditionally compiled to one implementation or the other
(Gecko or Servo) with `#[cfg(…)]`.
2016-07-20 08:42:46 +02:00
Simon Sapin
4b7060554b Rename ComputedValuesStruct to ComputedValues.
Doing this in a separate commit avoids mixups
with the ComputedValues trait that the previous commit removed.
2016-07-20 08:42:45 +02:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Simon Sapin
b2a7e44373 Move ServoSelectorImpl to a dedicated module. 2016-07-20 08:40:53 +02:00
Bobby Holley
1d8d1cb9d9 Upgrade rust-selectors. 2016-07-05 18:03:40 -07:00
Anthony Ramine
a5b524d559 Move util::vec::ForgetfulSink to style::sink and simplify it 2016-07-04 16:48:14 +02:00
Emilio Cobos Álvarez
392f243ca7
style: Shadow declarations of no-op animations
Although we don't generate a "computed" keyframe animation, we're required to
shadow others.
2016-06-28 15:28:01 +00:00
Emilio Cobos Álvarez
9cf2e52d36
tidy: Clean up warnings and tidy lints. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
5b27e46d04
style: Atomize animation names. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
058bfb39ae
style: Refactor the @keyframes parsing and add adequate computation for it. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
6a362ae8e8
style: Refactor all the animated properties to use the style system properly 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
60192bb830
style: Refactor to pass animations cleanly, land animation-name parsing as experimental 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
c1fd7432e9
style: Add @keyframe rule parsing. 2016-06-28 15:09:53 +00:00
Ms2ger
79e0d18a1d Add some documentation to the style crate. 2016-06-27 17:33:14 +02:00
Simon Sapin
00b6210519 Make the style crate almost build on stable Rust.
`discriminant_value` will need to be replaced with something else later.
2016-06-22 15:44:13 +02:00
Ms2ger
1c65ce8f36 Deny unsafe code in some more modules. 2016-06-04 18:07:16 +02:00
Josh Matthews
3cb8af20c2 Remove empty lines following braces. 2016-05-27 13:32:05 -04:00
Cameron McCormack
bb85f5faf0 Add an extra data field to ParserContext.
This will be used for passing Gecko-specific information through
the CSS parser in stylo.
2016-05-24 12:12:10 +10:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
Emilio Cobos Álvarez
028f9b6cd2
style: layout: Allow a lazy pseudo-element implementation in Servo. 2016-05-04 00:33:58 +02:00
Emilio Cobos Álvarez
9caaa6004e
style: Support lazy pseudo-elements
These can't be supported in Servo as of right now, because I'm not
totally sure the accesses that should be done in layout would be
thread-safe.

It can be revisited later though.
2016-05-03 19:01:54 +02:00
Emilio Cobos Álvarez
227e39d558
style: Reset the per-pseudo-element maps when update() is called
This was causing panics in stylo.
2016-04-29 22:54:53 +02:00
Emilio Cobos Álvarez
2a499d5a0b
layout: Stop storing PrecomputedStyleData in LayoutNode
Use the SharedStyleContext instead.
2016-04-29 22:54:48 +02:00
Emilio Cobos Álvarez
5a43c7e3cd
style: Allow inheritance when computing anonymous box styles
This is used a lot by Gecko, not still for servo though.
2016-04-29 22:54:46 +02:00
Emilio Cobos Álvarez
3563ecb770
style: Use precomputation for the -servo-details-content pseudo-element 2016-04-29 22:54:45 +02:00
Emilio Cobos Álvarez
b6402a81d0
style: Add infrastructure for non-eagerly-cascaded pseudo-elements
This commit also removes StylistWrapper and uses Arc::get_mut instead.
2016-04-29 22:54:45 +02:00
Simon Sapin
374679852c Make chrome: URLs have a "host". 2016-04-23 20:28:02 +02:00
Corey Farwell
c37ab1facd Make read_resource_file param simpler and more idiomatic.
`<P: AsRef<Path>>` is also what `File::open` uses as a generic type for
the parameter.
2016-04-16 23:06:59 -04:00
Simon Sapin
6889f37d9e Remove the url! plugin.
In rust-url 1.0 the `Url` struct is going to have private fields, and there
is no way to to create an aribitrary one without going through the parser.

The plugin never had a clear demonstrated performance benefit,
it was made mostly because it was possible and relatively easy at the time.
2016-04-14 15:35:28 +02:00
Emilio Cobos Álvarez
41708d753e style: Improve style::selector_matching documentation 2016-04-02 16:43:41 +02:00
Michael Howell
0a82d68f3e Use the new device viewport size for constaints.
Fixes #8443
2016-03-29 09:11:12 -07:00
Emilio Cobos Álvarez
5ed93a5c4a Change old references of ecoal95 2016-03-23 18:12:40 +01:00