gecko-dev/testing/web-platform/tests/css/css-backgrounds/background-position-three-four-values.html
George Steel 748aad0ef7 Bug 1625667 [wpt PR 22509] - fix background-position-xy serialization for right/bottom offsets, a=testonly
Automatic update from web-platform-tests
fix background-position-xy serialization for right/bottom offsets

Make the implementations of CSSValueFromComputedStyle for
background-position-x/y return correct values when three/four-value
syntax is used with background-position. Since these properties only
support single-value syntax, positions from the right or bottom will
use calc() values if they result in mixed lengths and percentages when
converted to be from the left/top. This is not the canonical form in
the css-backgrounds-4 spec proposal, but does not require changes to
the parser.

Add a reftest (passes without patch) for three/four-value
background-position syntax (there is currently only a manual test).
Add another version of the reftest (fails without patch) which takes
the above and attempts to write back the computed values of
background-position-x/y.

This is done in preparation to make transitions use normal keyframes
which require round-trip serialization of all transition properties.

Change-Id: I50e714746cc15fd0591bcd0a41cf9ecd56f55c44
Bug: 610627
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2121415
Reviewed-by: Robert Flack <flackr@chromium.org>
Commit-Queue: George Steel <gtsteel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755462}

--

wpt-commits: e8d4020b565b63adfde507cb7ab112d76aeaf603
wpt-pr: 22509
2020-04-06 12:43:57 +00:00

41 lines
No EOL
1.1 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: 'Background-position' with three and four values</title>
<link rel="help" href="http://www.w3.org/TR/css3-background/#background-position" />
<meta name="assert" content="If three or four values are given to 'background-position', then each percentage or length value represents an offset from the edge specified by the preceeding keyword." />
<link rel="match" href="reference/background-position-three-four-values-ref.html">
<style type="text/css">
div {
width: 200px;
height: 200px;
border: 2px solid black;
background-image: url("support/blue_color.png");
background-repeat: no-repeat;
display: inline-block;
}
.test1 {
background-position: left 50px center;
}
.test2 {
background-position: right 25px top 75%;
}
.test3 {
background-position: left 25px bottom 75%;
}
.test4 {
background-position: right 25px bottom 25%;
}
</style>
</head>
<body>
<div class="test1"></div>
<div class="test2"></div>
<div class="test3"></div>
<div class="test4"></div>
</body>
</html>