Skip to content
Permalink
Browse files
StylePropertyMap should return CSS values exactly as they were set
https://bugs.webkit.org/show_bug.cgi?id=249019

Reviewed by Antti Koivisto.

StylePropertyMap should return CSS values exactly as they were set. However,
our implementation passes the input to the CSS parser which may result in a
slightly different representation (sometimes simplified, sometimes converted).
Feeding the input through the CSS parser is useful because it validates that
the value is valid for the property in question. Also, our StyleBuilder makes a
lot of assumptions about the type / format of the value for a given CSS
property so we cannot let the JS set CSS property values that do not match the
expected type / format.

To address the issue, we now check if setting the property value as a string
through the CSS parser succeeded or not. If it succeeded then we set the CSS
value from the JavaScript as-is. To support this I had to make some fixes to
our StyleBuilder to be more permissive in terms of what types of CSSValues it
supports for each property.

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/accent-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/alignment-baseline-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-delay-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-duration-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-fill-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-name-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-play-state-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-timing-function-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/backface-visibility-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-attachment-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-blend-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-clip-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-image-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-origin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/baseline-shift-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/block-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-collapse-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-outset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-repeat-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-slice-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-source-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-radius-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/bottom-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/box-shadow-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/box-sizing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/break-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/caption-side-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/caret-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/center-coordinate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/clear-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/clip-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/clip-path-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/clip-rule-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/color-interpolation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-count-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-rule-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-rule-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-rule-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-span-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/contain-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/container-name-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/container-type-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/coordinate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/counter-increment-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/counter-reset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/cursor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/display-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/dominant-baseline-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/empty-cells-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/fill-opacity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/fill-rule-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/filter-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flex-basis-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flex-direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flex-grow-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flex-shrink-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flex-wrap-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/float-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flood-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/flood-opacity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-feature-settings-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-kerning-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-optical-sizing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-palette-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-stretch-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-synthesis-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-alternates-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-caps-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-east-asian-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-ligatures-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-numeric-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variation-settings-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-weight-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/gap-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-auto-columns-rows-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-auto-flow-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-start-end-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-areas-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/height-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/image-rendering-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/inline-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/isolation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/left-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/letter-spacing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/lighting-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/line-break-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/line-height-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/list-style-image-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/list-style-position-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/list-style-type-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/logical-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/margin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/marker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/mask-image-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/mask-type-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/mix-blend-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/object-fit-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/object-position-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/offset-anchor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/offset-distance-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/offset-path-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/offset-position-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/offset-rotate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/opacity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/order-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/orphans-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/outline-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/outline-offset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/outline-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/outline-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/overflow-anchor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/overflow-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/overflow-wrap-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/overscroll-behavior-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/padding-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/page-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/paint-order-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/perspective-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/pointer-events-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/position-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/quotes-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/radius-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/resize-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/right-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-behavior-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-margin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-padding-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-align-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-stop-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-type-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/shape-image-threshold-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/shape-margin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/shape-outside-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/shape-rendering-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stop-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stop-opacity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-dashoffset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-linecap-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-linejoin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-opacity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/tab-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/table-layout-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-align-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-align-last-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-anchor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-combine-upright-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-decoration-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-decoration-line-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-decoration-skip-ink-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-decoration-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-decoration-thickness-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-emphasis-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-indent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-justify-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-orientation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-overflow-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-rendering-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-shadow-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-transform-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-underline-offset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/text-underline-position-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/top-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/touch-action-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transform-box-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transform-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transform-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transition-delay-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transition-duration-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transition-property-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transition-timing-function-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/unicode-bidi-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/vector-effect-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/vertical-align-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/visibility-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/white-space-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/widows-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/will-change-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/word-break-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/word-spacing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/word-wrap-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/writing-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/z-index-expected.txt:
* Source/WebCore/css/CSSValue.h:
* Source/WebCore/css/typedom/CSSUnitValue.cpp:
(WebCore::CSSUnitValue::toCSSValueWithProperty const):
* Source/WebCore/css/typedom/InlineStylePropertyMap.cpp:
(WebCore::InlineStylePropertyMap::setProperty):
* Source/WebCore/css/typedom/numeric/CSSMathValue.h:

Canonical link: https://commits.webkit.org/257815@main
  • Loading branch information
cdumez committed Dec 13, 2022
1 parent a5111a2 commit bfd520b659e89b66f32b4863609a704e8c81357f
Show file tree
Hide file tree
Showing 211 changed files with 576 additions and 528 deletions.
@@ -3,6 +3,8 @@ Checks that calling StylePropertyMap.set() with a negative value wraps it into a
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS target.attributeStyleMap.set('background-size', new CSSUnitValue(-32, 'px')) did not throw exception.
PASS target.style.backgroundSize is "calc(-32px)"
PASS target.attributeStyleMap.set('border-block-start-width', new CSSUnitValue(-32, 'px')) did not throw exception.
PASS target.style.borderBlockStartWidth is "calc(-32px)"
PASS target.attributeStyleMap.set('border-block-end-width', new CSSUnitValue(-32, 'px')) did not throw exception.
@@ -63,6 +65,8 @@ PASS target.attributeStyleMap.set('scroll-padding-block-end', new CSSUnitValue(-
PASS target.style.scrollPaddingBlockEnd is "calc(-32px)"
PASS target.attributeStyleMap.set('width', new CSSUnitValue(-32, 'px')) did not throw exception.
PASS target.style.width is "calc(-32px)"
PASS target.attributeStyleMap.set('background-size', new CSSUnitValue(-32, 'percent')) did not throw exception.
PASS target.style.backgroundSize is "calc(-32%)"
PASS target.attributeStyleMap.set('border-top-left-radius', new CSSUnitValue(-32, 'percent')) did not throw exception.
PASS target.style.borderTopLeftRadius is "calc(-32%)"
PASS target.attributeStyleMap.set('border-top-right-radius', new CSSUnitValue(-32, 'percent')) did not throw exception.
@@ -115,18 +119,14 @@ PASS target.attributeStyleMap.set('stroke-miterlimit', new CSSUnitValue(-32, 'nu
PASS target.style.strokeMiterlimit is "calc(-32)"
PASS target.attributeStyleMap.set('animation-duration', new CSSUnitValue(-32, 's')) did not throw exception.
PASS target.style.animationDuration is "calc(-32s)"
PASS target.attributeStyleMap.set('background-size', new CSSUnitValue(-32, 'percent')) did not throw exception.
PASS target.style.backgroundSize is "calc(-32%) auto"
PASS target.attributeStyleMap.set('background-size', new CSSUnitValue(-32, 'px')) did not throw exception.
PASS target.style.backgroundSize is "calc(-32px) auto"
PASS target.attributeStyleMap.set('font-weight', new CSSUnitValue(0, 'number')) did not throw exception.
PASS target.style.fontWeight is "1"
PASS target.style.fontWeight is "calc(0)"
PASS target.attributeStyleMap.set('font-weight', new CSSUnitValue(-32, 'number')) did not throw exception.
PASS target.style.fontWeight is "1"
PASS target.style.fontWeight is "calc(-32)"
PASS target.attributeStyleMap.set('font-weight', new CSSUnitValue(100, 'number')) did not throw exception.
PASS target.style.fontWeight is "100"
PASS target.attributeStyleMap.set('font-weight', new CSSUnitValue(1001, 'number')) did not throw exception.
PASS target.style.fontWeight is "1000"
PASS target.style.fontWeight is "calc(1001)"
PASS successfullyParsed is true

TEST COMPLETE
@@ -16,6 +16,7 @@
target = document.getElementById("target");

negative_length_properties = [
'background-size', // https://w3c.github.io/csswg-drafts/css-backgrounds/#the-background-size
'border-block-start-width', 'border-block-end-width', 'border-inline-start-width', 'border-inline-end-width', // https://w3c.github.io/csswg-drafts/css-logical/#border-width
'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', // https://w3c.github.io/csswg-drafts/css-backgrounds/#border-radius
'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', // https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-width
@@ -34,6 +35,7 @@
'width', // https://w3c.github.io/csswg-drafts/css-sizing-3/#propdef-width
];
negative_percent_properties = [
'background-size', // https://w3c.github.io/csswg-drafts/css-backgrounds/#the-background-size
'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', // https://w3c.github.io/csswg-drafts/css-backgrounds/#border-radius
'border-image-slice', // https://w3c.github.io/csswg-drafts/css-backgrounds/#border-image-slice
'border-image-width', // https://w3c.github.io/csswg-drafts/css-backgrounds/#border-image-width
@@ -80,21 +82,15 @@

// Special cases.

// https://w3c.github.io/csswg-drafts/css-backgrounds/#the-background-size
shouldNotThrow("target.attributeStyleMap.set('background-size', new CSSUnitValue(-32, 'percent'))");
shouldBeEqualToString("target.style.backgroundSize", "calc(-32%) auto");
shouldNotThrow("target.attributeStyleMap.set('background-size', new CSSUnitValue(-32, 'px'))");
shouldBeEqualToString("target.style.backgroundSize", "calc(-32px) auto");

// https://w3c.github.io/csswg-drafts/css-fonts/#font-weight-prop
shouldNotThrow("target.attributeStyleMap.set('font-weight', new CSSUnitValue(0, 'number'))");
shouldBeEqualToString("target.style.fontWeight", "1");
shouldBeEqualToString("target.style.fontWeight", "calc(0)");
shouldNotThrow("target.attributeStyleMap.set('font-weight', new CSSUnitValue(-32, 'number'))");
shouldBeEqualToString("target.style.fontWeight", "1");
shouldBeEqualToString("target.style.fontWeight", "calc(-32)");
shouldNotThrow("target.attributeStyleMap.set('font-weight', new CSSUnitValue(100, 'number'))");
shouldBeEqualToString("target.style.fontWeight", "100");
shouldNotThrow("target.attributeStyleMap.set('font-weight', new CSSUnitValue(1001, 'number'))");
shouldBeEqualToString("target.style.fontWeight", "1000");
shouldBeEqualToString("target.style.fontWeight", "calc(1001)");
</script>
</body>
</html>
@@ -3,7 +3,7 @@ PASS Can set 'accent-color' to CSS-wide keywords: initial
PASS Can set 'accent-color' to CSS-wide keywords: inherit
PASS Can set 'accent-color' to CSS-wide keywords: unset
PASS Can set 'accent-color' to CSS-wide keywords: revert
FAIL Can set 'accent-color' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'accent-color' to var() references: var(--A)
PASS Can set 'accent-color' to the 'currentcolor' keyword: currentcolor
FAIL Can set 'accent-color' to the 'auto' keyword: auto assert_class_string: expected "[object CSSStyleValue]" but got "[object CSSKeywordValue]"
PASS Setting 'accent-color' to a length throws TypeError
@@ -3,7 +3,7 @@ PASS Can set 'alignment-baseline' to CSS-wide keywords: initial
PASS Can set 'alignment-baseline' to CSS-wide keywords: inherit
PASS Can set 'alignment-baseline' to CSS-wide keywords: unset
PASS Can set 'alignment-baseline' to CSS-wide keywords: revert
FAIL Can set 'alignment-baseline' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'alignment-baseline' to var() references: var(--A)
PASS Can set 'alignment-baseline' to the 'baseline' keyword: baseline
FAIL Can set 'alignment-baseline' to the 'text-bottom' keyword: text-bottom Invalid values
PASS Can set 'alignment-baseline' to the 'alphabetic' keyword: alphabetic
@@ -3,7 +3,7 @@ PASS Can set 'animation-delay' to CSS-wide keywords: initial
PASS Can set 'animation-delay' to CSS-wide keywords: inherit
PASS Can set 'animation-delay' to CSS-wide keywords: unset
PASS Can set 'animation-delay' to CSS-wide keywords: revert
FAIL Can set 'animation-delay' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-delay' to var() references: var(--A)
PASS Can set 'animation-delay' to a time: 0s
PASS Can set 'animation-delay' to a time: -3.14ms
PASS Can set 'animation-delay' to a time: 3.14s
@@ -3,7 +3,7 @@ PASS Can set 'animation-direction' to CSS-wide keywords: initial
PASS Can set 'animation-direction' to CSS-wide keywords: inherit
PASS Can set 'animation-direction' to CSS-wide keywords: unset
PASS Can set 'animation-direction' to CSS-wide keywords: revert
FAIL Can set 'animation-direction' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-direction' to var() references: var(--A)
PASS Can set 'animation-direction' to the 'normal' keyword: normal
PASS Can set 'animation-direction' to the 'reverse' keyword: reverse
PASS Can set 'animation-direction' to the 'alternate-reverse' keyword: alternate-reverse
@@ -3,7 +3,7 @@ PASS Can set 'animation-duration' to CSS-wide keywords: initial
PASS Can set 'animation-duration' to CSS-wide keywords: inherit
PASS Can set 'animation-duration' to CSS-wide keywords: unset
PASS Can set 'animation-duration' to CSS-wide keywords: revert
FAIL Can set 'animation-duration' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-duration' to var() references: var(--A)
PASS Can set 'animation-duration' to a time: 0s
FAIL Can set 'animation-duration' to a time: -3.14ms assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'animation-duration' to a time: 3.14s
@@ -3,7 +3,7 @@ PASS Can set 'animation-fill-mode' to CSS-wide keywords: initial
PASS Can set 'animation-fill-mode' to CSS-wide keywords: inherit
PASS Can set 'animation-fill-mode' to CSS-wide keywords: unset
PASS Can set 'animation-fill-mode' to CSS-wide keywords: revert
FAIL Can set 'animation-fill-mode' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-fill-mode' to var() references: var(--A)
PASS Can set 'animation-fill-mode' to the 'none' keyword: none
PASS Can set 'animation-fill-mode' to the 'forwards' keyword: forwards
PASS Can set 'animation-fill-mode' to the 'backwards' keyword: backwards
@@ -3,7 +3,7 @@ PASS Can set 'animation-iteration-count' to CSS-wide keywords: initial
PASS Can set 'animation-iteration-count' to CSS-wide keywords: inherit
PASS Can set 'animation-iteration-count' to CSS-wide keywords: unset
PASS Can set 'animation-iteration-count' to CSS-wide keywords: revert
FAIL Can set 'animation-iteration-count' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-iteration-count' to var() references: var(--A)
PASS Can set 'animation-iteration-count' to the 'infinite' keyword: infinite
PASS Can set 'animation-iteration-count' to a number: 0
FAIL Can set 'animation-iteration-count' to a number: -3.14 assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
@@ -3,7 +3,7 @@ PASS Can set 'animation-name' to CSS-wide keywords: initial
PASS Can set 'animation-name' to CSS-wide keywords: inherit
PASS Can set 'animation-name' to CSS-wide keywords: unset
PASS Can set 'animation-name' to CSS-wide keywords: revert
FAIL Can set 'animation-name' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-name' to var() references: var(--A)
PASS Can set 'animation-name' to the 'none' keyword: none
FAIL Can set 'animation-name' to the 'custom-ident' keyword: custom-ident Invalid values
PASS Setting 'animation-name' to a length throws TypeError
@@ -3,7 +3,7 @@ PASS Can set 'animation-play-state' to CSS-wide keywords: initial
PASS Can set 'animation-play-state' to CSS-wide keywords: inherit
PASS Can set 'animation-play-state' to CSS-wide keywords: unset
PASS Can set 'animation-play-state' to CSS-wide keywords: revert
FAIL Can set 'animation-play-state' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-play-state' to var() references: var(--A)
PASS Can set 'animation-play-state' to the 'running' keyword: running
PASS Can set 'animation-play-state' to the 'paused' keyword: paused
PASS Setting 'animation-play-state' to a length throws TypeError
@@ -3,14 +3,14 @@ PASS Can set 'animation-timing-function' to CSS-wide keywords: initial
PASS Can set 'animation-timing-function' to CSS-wide keywords: inherit
PASS Can set 'animation-timing-function' to CSS-wide keywords: unset
PASS Can set 'animation-timing-function' to CSS-wide keywords: revert
FAIL Can set 'animation-timing-function' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'animation-timing-function' to var() references: var(--A)
PASS Can set 'animation-timing-function' to the 'linear' keyword: linear
PASS Can set 'animation-timing-function' to the 'ease' keyword: ease
PASS Can set 'animation-timing-function' to the 'ease-in' keyword: ease-in
PASS Can set 'animation-timing-function' to the 'ease-out' keyword: ease-out
PASS Can set 'animation-timing-function' to the 'ease-in-out' keyword: ease-in-out
FAIL Can set 'animation-timing-function' to the 'step-start' keyword: step-start assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
FAIL Can set 'animation-timing-function' to the 'step-end' keyword: step-end assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
PASS Can set 'animation-timing-function' to the 'step-start' keyword: step-start
PASS Can set 'animation-timing-function' to the 'step-end' keyword: step-end
PASS Setting 'animation-timing-function' to a length throws TypeError
PASS Setting 'animation-timing-function' to a percent throws TypeError
PASS Setting 'animation-timing-function' to a time throws TypeError
@@ -3,7 +3,7 @@ PASS Can set 'backface-visibility' to CSS-wide keywords: initial
PASS Can set 'backface-visibility' to CSS-wide keywords: inherit
PASS Can set 'backface-visibility' to CSS-wide keywords: unset
PASS Can set 'backface-visibility' to CSS-wide keywords: revert
FAIL Can set 'backface-visibility' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'backface-visibility' to var() references: var(--A)
PASS Can set 'backface-visibility' to the 'visible' keyword: visible
PASS Can set 'backface-visibility' to the 'hidden' keyword: hidden
PASS Setting 'backface-visibility' to a length throws TypeError
@@ -3,7 +3,7 @@ PASS Can set 'background-attachment' to CSS-wide keywords: initial
PASS Can set 'background-attachment' to CSS-wide keywords: inherit
PASS Can set 'background-attachment' to CSS-wide keywords: unset
PASS Can set 'background-attachment' to CSS-wide keywords: revert
FAIL Can set 'background-attachment' to var() references: var(--A) assert_equals: expected 2 but got 1
PASS Can set 'background-attachment' to var() references: var(--A)