style: Make the author styles disabled stuff actually disable style attribute, animations, and XBL rules.

This also removes one of my FIXMEs from when I was looking at this code.

We don't seem to have a pre-existing test for this feature, sigh. I'll try to
write one if I have cycles for it...

Note that it not applying XBL rules is a feature, given the current state of
affairs. Video controls and such are right now unusable with no styles enabled.

Differential Revision: https://phabricator.services.mozilla.com/D4795
This commit is contained in:
Emilio Cobos Álvarez 2018-09-03 07:31:29 +00:00
parent 0c0018e4d6
commit 3f08d2cc02
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -1129,8 +1129,6 @@ impl Stylist {
let rule_hash_target = element.rule_hash_target();
let matches_user_rules = rule_hash_target.matches_user_and_author_rules();
let matches_author_rules =
matches_user_rules && self.author_styles_enabled == AuthorStylesEnabled::Yes;
// Normal user-agent rules.
if let Some(map) = self.cascade_data
@ -1195,7 +1193,11 @@ impl Stylist {
}
}
let mut match_document_author_rules = matches_author_rules;
if self.author_styles_enabled == AuthorStylesEnabled::No {
return;
}
let mut match_document_author_rules = matches_user_rules;
let mut shadow_cascade_order = 0;
// XBL / Shadow DOM rules, which are author rules too.
@ -1204,7 +1206,6 @@ impl Stylist {
// particular, normally document rules override ::slotted() rules, but
// for !important it should be the other way around. So probably we need
// to add some sort of AuthorScoped cascade level or something.
if matches_author_rules {
if let Some(shadow) = rule_hash_target.shadow_root() {
if let Some(map) = shadow.style_data().and_then(|data| data.host_rules(pseudo_element)) {
context.with_shadow_host(Some(rule_hash_target), |context| {
@ -1300,10 +1301,7 @@ impl Stylist {
current_containing_shadow = host.containing_shadow();
match_document_author_rules = current_containing_shadow.is_none();
}
}
// FIXME(emilio): This doesn't account for the author_styles_enabled
// stuff...
let cut_xbl_binding_inheritance =
element.each_xbl_cascade_data(|cascade_data, quirks_mode| {
if let Some(map) = cascade_data.normal_rules(pseudo_element) {