Update interpolation between calc-size() values to better preserve percentageness.
This updates the code for interpolation of calc-size() values to match
recent spec changes that correspond to the latest discussions in
w3c/csswg-drafts#10220 .
The idea of these changes is that, before we interpolate values with
different basis, we do stronger canonicalization of the basis (rather
than just un-nesting a basis that is a nested calc-size()). This means
that all bases with percentages have their canonical basis be
100% and all other bases have their canonical basis be any.
This means that a canonical basis is either a sizing keyword, 100%, or
any.
This stronger canonicalization code means we can remove a separate
substitution pass, since all of the necessary substitution was already
done during canonicalization.
This change also removes some extra checks in
InterpolableLength::CanMergeValues() since
CSSMathExpressionOperation::CreateArithmeticOperationAndSimplifyCalcSize()
also has those checks, and CanMergeValues already needs to call it.
The overall result of these changes should be:
-
better (but still imperfect) preservation of percentageness
-
a small set of cases that no longer interpolate (a calc-size() whose
basis is a sizing keyword with another whose basis is a
containing percentages) -
following the spec's rules on always canonicalizing before
interpolating rather than optimizing it away in some cases, given that
it is observable (see
wpt/css/css-values/calc-size/animation/calc-size-interpolation-expansion.html)
Bug: 313072
Change-Id: Ie302c0440b5645afe2b458cdb672d544a836b946
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5792344
Reviewed-by: Anders Hartvoll Ruud andruud@chromium.org
Reviewed-by: Daniil Sakhapov sakhapov@chromium.org
Commit-Queue: David Baron dbaron@chromium.org
Cr-Commit-Position: refs/heads/main@{#1342798}