style: Cleanup StyleBuilder.

This is in preparation of a cascade optimization for custom properties.

This fixes various fishiness around our StyleBuilder stuff. In particular,
StyleBuilder::for_derived_style (renamed to for_animation) is only used to
compute specified values, and thus doesn't need to know about rules, visited
style, or other things like that.

The flag propagation that was done in StyleAdjuster is now done in StyleBuilder,
since we know beforehand which ones are always inherited, and it simplified the
callers and the StyleAdjuster code. It also fixed some fishiness wrt which flags
were propagated to anon boxes and text.

The text-decoration-lines bit is interesting, because the way it was implemented
in #17722 meant that display: contents elements did get HAS_DECORATION_LINES
flags only if its parent also had it, so in practice the Contents check
preserves behavior, but it's only an optimization looking at Gecko's call-sites,
so we can remove it too.

MozReview-Commit-ID: 6BHCyEO2U8c
This commit is contained in:
Emilio Cobos Álvarez 2018-02-02 16:13:33 +01:00
parent 7fb470c373
commit 349d6e7167
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 104 additions and 132 deletions

View file

@ -336,7 +336,7 @@ trait PrivateMatchMethods: TElement {
// We need to cascade the children in order to ensure the correct
// propagation of inherited computed value flags.
if old_values.flags.inherited() != new_values.flags.inherited() {
if old_values.flags.maybe_inherited() != new_values.flags.maybe_inherited() {
debug!(" > flags changed: {:?} != {:?}", old_values.flags, new_values.flags);
return ChildCascadeRequirement::MustCascadeChildren;
}