style: Don't optimize ::before/::after away if content/display have been specified via custom properties.

We need to treat them the same way as we treat content: inherit.

Differential Revision: https://phabricator.services.mozilla.com/D90222
This commit is contained in:
Emilio Cobos Álvarez 2020-09-21 11:05:51 +00:00
parent 60d89cfbc0
commit 74a46d96eb
4 changed files with 27 additions and 8 deletions

View file

@ -478,6 +478,25 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
.rule_cache_conditions
.borrow_mut()
.set_uncacheable();
// NOTE(emilio): We only really need to add the `display` /
// `content` flag if the CSS variable has not been specified on our
// declarations, but we don't have that information at this point,
// and it doesn't seem like an important enough optimization to
// warrant it.
match declaration.id {
LonghandId::Display => {
self.context
.builder
.add_flags(ComputedValueFlags::DISPLAY_DEPENDS_ON_INHERITED_STYLE);
},
LonghandId::Content => {
self.context
.builder
.add_flags(ComputedValueFlags::CONTENT_DEPENDS_ON_INHERITED_STYLE);
},
_ => {},
}
}
Cow::Owned(declaration.value.substitute_variables(