style: Reduce the amount of code generated by UnparsedValues::substitute_variables.

This reduces the amount of assembly instructions generated by this
function from 18k+ to ~800.

This should make reasoning about its stack space usage sane, and should
fix the ASAN stack overflows, but also we should take this regardless,
because it's saner and makes reading it simpler.

I also think that the writing_mode shenanigans is fixing a bug (I think
before this, we'd pick the first physical value which mapped to any of
the properties, which is wrong), but I haven't bothered looking for a
test-case that fails before my patch. The relevant WPTs
(css/css-logical/animation*) still pass.

Differential Revision: https://phabricator.services.mozilla.com/D105342
This commit is contained in:
Emilio Cobos Álvarez 2021-02-17 00:21:36 +00:00
parent b0d05d1a5d
commit 490db1e2bd
5 changed files with 57 additions and 59 deletions

View file

@ -829,11 +829,12 @@ impl PropertyDeclarationBlock {
// getKeyframes() implementation for CSS animations, if
// |computed_values| is supplied, we use it to expand such variable
// declarations. This will be fixed properly in Gecko bug 1391537.
(&PropertyDeclaration::WithVariables(ref declaration), Some(ref _computed_values)) => {
(&PropertyDeclaration::WithVariables(ref declaration), Some(ref computed_values)) => {
declaration
.value
.substitute_variables(
declaration.id,
computed_values.writing_mode,
custom_properties.as_ref(),
QuirksMode::NoQuirks,
device,