haikuwebkit/LayoutTests/fast/shapes/shape-outside-floats
Antoine Quint e5ddace466 calc() should not contain 0 values other than percentages
https://bugs.webkit.org/show_bug.cgi?id=224611

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Fix expectation of existing WPT tests and make some modifications to existing WPT tests.

* web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt:
* web-platform-tests/css/css-shapes/parsing/shape-outside-computed-expected.txt:
* web-platform-tests/css/css-shapes/parsing/shape-outside-computed.html: Add a new assertion checking
that the computed style for shape-outside may not contain 0px values in calc() values.
* web-platform-tests/css/css-transitions/animations/vertical-align-interpolation-expected.txt:
* web-platform-tests/css/css-transitions/animations/vertical-align-interpolation.html: Use 40% rather than
calc(0px + 40%) as the expected value for the computed style at the 100% keyframe when blending from 40px
to 40%. The test would have passed with calc(0px + 40%) as well, since it would now compute to 40%, but
the test is clearer when the actual computed form is used.
* web-platform-tests/css/css-values/minmax-percentage-serialize-expected.txt:

Source/WebCore:

A calc() value containing a 0px value, such as calc(10% + 0px), was incorrectly serialized
as-is for the computed style, instead of the simplified form containing on the percentage.

For the correct behavior we need to make four changes in css/CSSCalculationValue.cpp:

1. in createCSS(const CalcExpressionNode&, const RenderStyle&), when dealing with a node
that is CalcExpressionNodeType::Length, we return nullptr in the case then node's Length
is a 0 value that's not a percentage,

2. additionally, in createCSS(const Vector<std::unique_ptr<CalcExpressionNode>>&, const RenderStyle&),
we no longer bail when a nullptr value is returned for a child and instead proceed with the
processing of further children, ensuring that a 0px value in, say, a Sum operation is removed
while retaining other non-zero values,

3. back in createCSS(const CalcExpressionNode&, const RenderStyle&), for CalcExpressionNodeType::Operation
nodes, when there is single parameter to a Sum operation we return that parameter rather than
a Sum operation, and do the same for a Negate operation, making sure we return negated node if
it is the second child,

4. finally, in CSSCalcOperationNode::buildCSSText(const CSSCalcExpressionNode&, StringBuilder&)
when we serialize a calculated value, we do not enclose the value in a `calc()` string if the
node is a CSSCalcPrimitiveValueNode.

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::buildCSSText):
(WebCore::createCSS):

LayoutTests:

Adjust a non-WPT test to not feature a 0px addition.

* fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt:
* fast/shapes/shape-outside-floats/shape-outside-animation.html:


Canonical link: https://commits.webkit.org/236585@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-15 19:39:30 +00:00
..
shape-outside-animation-expected.txt calc() should not contain 0 values other than percentages 2021-04-15 19:39:30 +00:00
shape-outside-animation.html calc() should not contain 0 values other than percentages 2021-04-15 19:39:30 +00:00
shape-outside-big-box-border-radius-001-expected.txt
shape-outside-big-box-border-radius-001.html
shape-outside-big-box-border-radius-002-expected.html
shape-outside-big-box-border-radius-002.html
shape-outside-boxes-001-expected.html
shape-outside-boxes-001.html
shape-outside-boxes-002-expected.html
shape-outside-boxes-002.html
shape-outside-boxes-003-expected.html
shape-outside-boxes-003.html
shape-outside-clip-path-selection-expected.txt
shape-outside-clip-path-selection.html
shape-outside-dynamic-shape-expected.html
shape-outside-dynamic-shape-image-threshold-expected.html
shape-outside-dynamic-shape-image-threshold.html
shape-outside-dynamic-shape-margin-expected.html
shape-outside-dynamic-shape-margin.html
shape-outside-dynamic-shape-overhang-expected.html
shape-outside-dynamic-shape-overhang.html
shape-outside-dynamic-shape.html
shape-outside-edge-case-expected.html
shape-outside-edge-case.html
shape-outside-floats-border-radius-border-box-000-expected.html
shape-outside-floats-border-radius-border-box-000.html
shape-outside-floats-border-radius-border-box-001-expected.html
shape-outside-floats-border-radius-border-box-001.html
shape-outside-floats-border-radius-border-box-002-expected.html
shape-outside-floats-border-radius-border-box-002.html
shape-outside-floats-border-radius-content-box-000-expected.html
shape-outside-floats-border-radius-content-box-000.html
shape-outside-floats-border-radius-content-box-001-expected.html
shape-outside-floats-border-radius-content-box-001.html
shape-outside-floats-border-radius-content-box-002-expected.html
shape-outside-floats-border-radius-content-box-002.html
shape-outside-floats-border-radius-content-box-003-expected.html
shape-outside-floats-border-radius-content-box-003.html
shape-outside-floats-border-radius-margin-box-000-expected.html
shape-outside-floats-border-radius-margin-box-000.html
shape-outside-floats-border-radius-margin-box-001-expected.html
shape-outside-floats-border-radius-margin-box-001.html
shape-outside-floats-border-radius-margin-box-002-expected.html
shape-outside-floats-border-radius-margin-box-002.html
shape-outside-floats-border-radius-margin-box-003-expected.html
shape-outside-floats-border-radius-margin-box-003.html
shape-outside-floats-border-radius-margin-box-004-expected.html
shape-outside-floats-border-radius-margin-box-004.html
shape-outside-floats-border-radius-padding-box-000-expected.html
shape-outside-floats-border-radius-padding-box-000.html
shape-outside-floats-border-radius-padding-box-001-expected.html
shape-outside-floats-border-radius-padding-box-001.html
shape-outside-floats-border-radius-padding-box-002-expected.html
shape-outside-floats-border-radius-padding-box-002.html
shape-outside-floats-border-radius-padding-box-003-expected.html
shape-outside-floats-border-radius-padding-box-003.html
shape-outside-floats-circle-000-expected.html
shape-outside-floats-circle-000.html
shape-outside-floats-circle-001-expected.html
shape-outside-floats-circle-001.html
shape-outside-floats-circle-002-expected.html
shape-outside-floats-circle-002.html
shape-outside-floats-circle-003-expected.html
shape-outside-floats-circle-003.html
shape-outside-floats-circle-004-expected.html
shape-outside-floats-circle-004.html
shape-outside-floats-circle-005-expected.html
shape-outside-floats-circle-005.html
shape-outside-floats-circle-negative-radius-crash-expected.txt
shape-outside-floats-circle-negative-radius-crash.html
shape-outside-floats-diamond-margin-polygon-expected.txt
shape-outside-floats-diamond-margin-polygon.html
shape-outside-floats-different-writing-direction-border-box-expected.html
shape-outside-floats-different-writing-direction-border-box.html
shape-outside-floats-different-writing-direction-content-box-expected.html
shape-outside-floats-different-writing-direction-content-box.html
shape-outside-floats-different-writing-direction-margin-box-expected.html
shape-outside-floats-different-writing-direction-margin-box.html
shape-outside-floats-different-writing-direction-padding-box-expected.html
shape-outside-floats-different-writing-direction-padding-box.html
shape-outside-floats-different-writing-modes-border-box-expected.html
shape-outside-floats-different-writing-modes-border-box.html
shape-outside-floats-different-writing-modes-content-box-expected.html
shape-outside-floats-different-writing-modes-content-box.html
shape-outside-floats-different-writing-modes-expected.html
shape-outside-floats-different-writing-modes-margin-box-expected.html
shape-outside-floats-different-writing-modes-margin-box.html
shape-outside-floats-different-writing-modes-padding-box-expected.html
shape-outside-floats-different-writing-modes-padding-box.html
shape-outside-floats-different-writing-modes.html
shape-outside-floats-ellipse-000-expected.html
shape-outside-floats-ellipse-000.html
shape-outside-floats-ellipse-margin-bottom-expected.html
shape-outside-floats-ellipse-margin-bottom.html
shape-outside-floats-ellipse-margin-left-expected.txt
shape-outside-floats-ellipse-margin-left.html
shape-outside-floats-ellipse-margin-right-expected.txt
shape-outside-floats-ellipse-margin-right.html
shape-outside-floats-ellipse-negative-width-crash-expected.txt
shape-outside-floats-ellipse-negative-width-crash.html
shape-outside-floats-empty-polygon-crash-expected.txt
shape-outside-floats-empty-polygon-crash.html
shape-outside-floats-image-001-expected.html
shape-outside-floats-image-001.html
shape-outside-floats-image-002-expected.html
shape-outside-floats-image-002.html
shape-outside-floats-image-margin-001-expected.txt
shape-outside-floats-image-margin-001.html
shape-outside-floats-image-margin-002-expected.txt
shape-outside-floats-image-margin-002.html
shape-outside-floats-image-margin-003-expected.html
shape-outside-floats-image-margin-003.html
shape-outside-floats-image-margin-004-expected.html
shape-outside-floats-image-margin-004.html
shape-outside-floats-image-margin-005-expected.html
shape-outside-floats-image-margin-005.html
shape-outside-floats-image-threshold-001-expected.html
shape-outside-floats-image-threshold-001.html
shape-outside-floats-image-threshold-002-expected.html
shape-outside-floats-image-threshold-002.html
shape-outside-floats-image-vgap-expected.html
shape-outside-floats-image-vgap.html
shape-outside-floats-img-inset-negative-width-crash-expected.txt
shape-outside-floats-img-inset-negative-width-crash.html
shape-outside-floats-inset-expected.html
shape-outside-floats-inset-rounded-bottom-left-expected.html
shape-outside-floats-inset-rounded-bottom-left.html
shape-outside-floats-inset-rounded-bottom-right-expected.html
shape-outside-floats-inset-rounded-bottom-right.html
shape-outside-floats-inset-rounded-different-writing-modes-left-expected.txt
shape-outside-floats-inset-rounded-different-writing-modes-left.html
shape-outside-floats-inset-rounded-different-writing-modes-right-expected.txt
shape-outside-floats-inset-rounded-different-writing-modes-right.html
shape-outside-floats-inset-rounded-large-radius-expected.html
shape-outside-floats-inset-rounded-large-radius.html
shape-outside-floats-inset-rounded-top-left-expected.html
shape-outside-floats-inset-rounded-top-left.html
shape-outside-floats-inset-rounded-top-right-expected.html
shape-outside-floats-inset-rounded-top-right.html
shape-outside-floats-inset.html
shape-outside-floats-linetop-adjusted-between-left-right-floats-expected.html
shape-outside-floats-linetop-adjusted-between-left-right-floats.html
shape-outside-floats-linetop-adjustment-expected.html
shape-outside-floats-linetop-adjustment.html
shape-outside-floats-margin-crash-expected.html
shape-outside-floats-margin-crash.html
shape-outside-floats-not-a-layer-expected.html
shape-outside-floats-not-a-layer.html
shape-outside-floats-outermost-expected.html
shape-outside-floats-outermost.html
shape-outside-floats-polygon-000-expected.html
shape-outside-floats-polygon-000.html
shape-outside-floats-polygon-001-expected.html
shape-outside-floats-polygon-001.html
shape-outside-floats-polygon-002-expected.html
shape-outside-floats-polygon-002.html
shape-outside-floats-shape-margin-crash-expected.txt
shape-outside-floats-shape-margin-crash.html
shape-outside-floats-shape-margin-percent-expected.html
shape-outside-floats-shape-margin-percent.html
shape-outside-floats-stacked-000-expected.html
shape-outside-floats-stacked-000.html
shape-outside-floats-stacked-001-expected.html
shape-outside-floats-stacked-001.html
shape-outside-floats-stacked-002-expected.html
shape-outside-floats-stacked-002.html
shape-outside-floats-viewport-units-expected.html
shape-outside-floats-viewport-units.html
shape-outside-image-fit-001-expected.html
shape-outside-image-fit-001.html
shape-outside-image-fit-002-expected.html
shape-outside-image-fit-002.html
shape-outside-image-fit-003-expected.html
shape-outside-image-fit-003.html
shape-outside-image-fit-004-expected.html
shape-outside-image-fit-004.html
shape-outside-image-fit-005-expected.html
shape-outside-image-fit-005.html
shape-outside-image-fit-006-expected.html
shape-outside-image-fit-006.html
shape-outside-image-set-expected.html
shape-outside-image-set.html
shape-outside-image-shape-margin-expected.html
shape-outside-image-shape-margin.html
shape-outside-imagedata-overflow-expected.txt
shape-outside-imagedata-overflow.html
shape-outside-insert-svg-shape-expected.html
shape-outside-insert-svg-shape.html
shape-outside-inset-round-calc-crash-expected.txt
shape-outside-inset-round-calc-crash.html
shape-outside-large-zoom-expected.txt Handle shapeMargin becoming NaN 2021-01-22 06:22:56 +00:00
shape-outside-large-zoom.html Handle shapeMargin becoming NaN 2021-01-22 06:22:56 +00:00
shape-outside-line-spans-box-corners-expected.html
shape-outside-line-spans-box-corners.html
shape-outside-linear-gradient-expected.html
shape-outside-linear-gradient.html
shape-outside-margin-boxes-001-expected.html
shape-outside-margin-boxes-001.html
shape-outside-margin-boxes-002-expected.html
shape-outside-margin-boxes-002.html
shape-outside-negative-height-crash-expected.txt
shape-outside-negative-height-crash.html
shape-outside-negative-line-height-crash-expected.txt
shape-outside-negative-line-height-crash.html
shape-outside-one-pixel-expected.html
shape-outside-one-pixel.html
shape-outside-polygon-zero-vertex-expected.html
shape-outside-polygon-zero-vertex.html
shape-outside-relative-size-svg-expected.html
shape-outside-relative-size-svg.html
shape-outside-rounded-boxes-001-expected.txt
shape-outside-rounded-boxes-001.html
shape-outside-rounded-boxes-002-expected.txt
shape-outside-rounded-boxes-002.html
shape-outside-rounded-inset-expected.html
shape-outside-rounded-inset.html
shape-outside-shape-boxes-001-expected.html
shape-outside-shape-boxes-001.html
shape-outside-shape-boxes-002-expected.html
shape-outside-shape-boxes-002.html
shape-outside-shape-boxes-003-expected.html
shape-outside-shape-boxes-003.html
shape-outside-shape-image-threshold-animation-expected.txt
shape-outside-shape-image-threshold-animation.html
shape-outside-shape-margin-animation-expected.txt
shape-outside-shape-margin-animation.html
shape-outside-text-overlap-float-expected.html
shape-outside-text-overlap-float.html
shape-outside-uncached-gradient-expected.txt
shape-outside-uncached-gradient.html
shape-overflow-hidden-expected.html
shape-overflow-hidden-left-margin-expected.html
shape-overflow-hidden-left-margin-vertical-expected.html
shape-overflow-hidden-left-margin-vertical.html
shape-overflow-hidden-left-margin.html
shape-overflow-hidden-right-margin-expected.html
shape-overflow-hidden-right-margin-vertical-expected.html
shape-overflow-hidden-right-margin-vertical.html
shape-overflow-hidden-right-margin.html
shape-overflow-hidden-vertical-expected.html
shape-overflow-hidden-vertical.html
shape-overflow-hidden.html