servo/components/style
Emilio Cobos Álvarez db5db13559
style: Implement the non-functional :host selector.
Kinda tricky because :host only matches rules on the shadow root where the rules
come from. So we need to be careful during invalidation and style sharing.

I didn't use the non_ts_pseudo_class_list bits because as soon as we implement
the :host(..) bits we're going to need to special-case it anyway.

The general schema is the following:

 * Rightmost featureless :host selectors are handled inserting them in the
   host_rules hashmap. Note that we only insert featureless stuff there. We
   could insert all of them and just filter during matching, but that's slightly
   annoying.

 * The other selectors, like non-featureless :host or what not, are added to the
   normal cascade data. This is harmless, since the shadow host rules are never
   matched against the host, so we know they'll just never match, and avoids
   adding more special-cases.

 * Featureless :host selectors to the left of a combinator are handled during
   matching, in the special-case of next_element_for_combinator in selectors.
   This prevents this from being more invasive, and keeps the usual fast path
   slim, but it's a bit hard to match the spec and the implementation.

   We could keep a copy of the SelectorIter instead in the matching context to
   make the handling of featureless-ness explicit in match_non_ts_pseudo_class,
   but we'd still need the special-case anyway, so I'm not fond of it.

 * We take advantage of one thing that makes this sound. As you may have
   noticed, if you had `root` element which is a ShadowRoot, and you matched
   something like `div:host` against it, using a MatchingContext with
   current_host == root, we'd incorrectly report a match. But this is impossible
   due to the following constraints:

    * Shadow root rules aren't matched against the host during styling (except
      these featureless selectors).

    * DOM APIs' current_host needs to be the _containing_ host, not the element
      itself if you're a Shadow host.

Bug: 992245
Reviewed-by: xidorn
MozReview-Commit-ID: KayYNfTXb5h
2018-04-09 12:19:05 +02:00
..
counter_style Use Servo data to back @counter-style rule. 2018-04-05 09:33:45 +10:00
gecko style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
gecko_bindings Remove all color stuff from nsCSSValue. 2018-04-05 19:37:20 +10:00
gecko_string_cache Statically allocate static atoms. 2018-03-26 17:05:05 +11:00
invalidation style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
properties Auto merge of #20575 - Manishearth:filler-y, r=emilio 2018-04-09 01:47:58 -04:00
rule_tree style: Indent properly a couple more functions. 2018-02-24 23:23:16 +01:00
servo style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
sharing style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
stylesheets Stop using Gecko namespace ids in servo. 2018-04-06 11:32:00 -07:00
values style: Respect the -moz- gradient pref again. 2018-04-07 16:40:38 +02:00
animation.rs style: Only expose longhands to rust via iterators. 2018-02-28 00:19:31 +01:00
applicable_declarations.rs Replace all uses of the heapsize crate with malloc_size_of. 2017-10-18 22:20:37 +11:00
attr.rs style: remove unused AsciiExt imports. 2018-03-04 15:31:06 +01:00
author_styles.rs style: Make XBL / Shadow DOM use something more light-weight than a Stylist. 2018-02-16 13:42:36 +01:00
bezier.rs Don't use Point2D<f32> for cubic curves anymore 2017-07-19 10:19:41 +02:00
bloom.rs style: Remove get_ prefix from get_state and get_id. 2018-02-24 22:45:42 +01:00
build.rs Kill RUSTC_HAS_PR45225 🎉 2018-03-01 14:47:57 +01:00
build_gecko.rs Fix style/build_gecko.rs for log 0.4 2018-03-28 23:08:01 +02:00
Cargo.toml Bump walkdir 2018-03-31 12:22:36 +02:00
context.rs Split TraversalStatistics into two parts. 2018-03-15 11:57:48 +11:00
custom_properties.rs style: remove unused AsciiExt imports. 2018-03-04 15:31:06 +01:00
data.rs style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
dom.rs style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
dom_apis.rs style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
driver.rs Have servo report traversal statistics to gecko. 2018-03-15 11:57:52 +11:00
element_state.rs style: Remove :unsolved pseudo-class 2018-01-10 17:20:06 +08:00
encoding_support.rs Use encoding-rs instead of rust-encoding for CSS parsing 2017-10-31 19:08:43 +01:00
error_reporting.rs Bump env_logger to 0.5 and log to 0.4 in every servo crate 2018-03-28 19:50:58 +02:00
font_face.rs Use Servo data to back @font-face rule in Gecko. 2018-04-04 09:33:07 +10:00
font_metrics.rs Avoid debug serialization of PropertyDeclaration & co in release builds. 2018-01-15 17:24:27 -08:00
hash.rs style: Back out ordermap. 2018-02-12 12:20:46 +01:00
lib.rs Derive ToCss for MediaList 2018-03-05 12:02:31 +01:00
logical_geometry.rs Use specific assertion for style logical geometry 2018-01-26 01:30:31 +08:00
macros.rs Kill AnimatedValueAsComputed 2018-02-10 16:31:47 +01:00
matching.rs style: Remove useless dereferencing. 2018-02-24 23:26:55 +01:00
media_queries.rs Move #[css(iterable)] on fields rather than variants 2018-03-06 11:08:19 +01:00
parallel.rs style: Indent properly a couple more functions. 2018-02-24 23:23:16 +01:00
parser.rs style: Trivially cleanup length parsing. 2018-02-16 16:04:19 +01:00
README.md
rule_cache.rs Skip rule node which contains only inherited properties for rule cache. 2018-01-05 11:29:01 +11:00
scoped_tls.rs Reduce the size of top_down_dom stackframes. 2017-06-08 13:02:36 -04:00
selector_map.rs style: Make Element::id not clone the attribute. 2018-02-24 22:45:43 +01:00
selector_parser.rs Change ToCss to take a CssWriter<W> 2018-01-23 10:41:42 +01:00
shared_lock.rs Avoid the generic writer parameter for PropertyDeclaration serialization. 2018-01-22 14:58:05 -08:00
str.rs style: remove unused AsciiExt imports. 2018-03-04 15:31:06 +01:00
style_adjuster.rs style: Rename StyleContext to ComputedStyle. 2018-03-22 18:04:29 +01:00
style_resolver.rs Bump env_logger to 0.5 and log to 0.4 in every servo crate 2018-03-28 19:50:58 +02:00
stylesheet_set.rs style: Better Shadow DOM assertions. 2018-03-19 13:58:18 +01:00
stylist.rs style: Implement the non-functional :host selector. 2018-04-09 12:19:05 +02:00
thread_state.rs Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
timer.rs order derivable traits lists 2017-08-23 21:38:44 +02:00
traversal.rs style: Cleanup always-false argument to Servo_ResolveStyleLazily. 2018-02-20 12:59:21 +01:00
traversal_flags.rs style: Get rid of unstyled children only traversals. 2017-11-20 08:24:08 +01:00

servo-style

Style system for Servo, using rust-cssparser for parsing.