mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 04:22:28 +00:00
LibWeb/CSS: Fix linear-gradient single color-stop usage
The Web::CSS::Parser's GradientParsing ignores color-stops if it is only a single one. This change allows to have color-stops with double positions against a single color. Further, also allows for `linear-gradient(black)` and similar other gradient functions
This commit is contained in:
parent
4fa372564d
commit
cfe6702767
Notes:
github-actions[bot]
2025-02-03 17:25:19 +00:00
Author: https://github.com/mehrankamal 🔰
Commit: cfe6702767
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3405
Reviewed-by: https://github.com/AtkinsSJ ✅
12 changed files with 459 additions and 7 deletions
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gradient with a single stop</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#color-stop-syntax">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#coloring-gradient-line">
|
||||
<meta name="assert" content="Tests that gradient with a single color stop renders the expected solid color">
|
||||
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-4500">
|
||||
<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#fail {
|
||||
background: red;
|
||||
}
|
||||
|
||||
#test {
|
||||
background-image: linear-gradient(green);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square.</p>
|
||||
<div id="fail"></div>
|
||||
<div id="test"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gradient with a single stop</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#color-stop-syntax">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#coloring-gradient-line">
|
||||
<meta name="assert" content="Tests that gradient with a single color stop renders the expected solid color">
|
||||
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-4500">
|
||||
<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#fail {
|
||||
background: red;
|
||||
}
|
||||
|
||||
#test {
|
||||
background-image: linear-gradient(to right, green 90%);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square.</p>
|
||||
<div id="fail"></div>
|
||||
<div id="test"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gradient with a single stop</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#color-stop-syntax">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#coloring-gradient-line">
|
||||
<meta name="assert" content="Tests that gradient with a single color stop renders the expected solid color">
|
||||
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-4500">
|
||||
<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#fail {
|
||||
background: red;
|
||||
}
|
||||
|
||||
#test {
|
||||
background-image: radial-gradient(green);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square.</p>
|
||||
<div id="fail"></div>
|
||||
<div id="test"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gradient with a single stop</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-4/#color-stop-syntax">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-4/#coloring-gradient-line">
|
||||
<meta name="assert" content="Tests that gradient with a single color stop renders the expected solid color">
|
||||
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-10000">
|
||||
<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#fail {
|
||||
background: red;
|
||||
}
|
||||
|
||||
#test {
|
||||
background-image: conic-gradient(green);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square.</p>
|
||||
<div id="fail"></div>
|
||||
<div id="test"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gradient with a single stop</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-4/#color-stop-syntax">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-images-4/#coloring-gradient-line">
|
||||
<meta name="assert" content="Tests that gradient with a single color stop renders the expected solid color">
|
||||
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-10000">
|
||||
<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#fail {
|
||||
background: red;
|
||||
}
|
||||
|
||||
#test {
|
||||
background-image: conic-gradient(from 0deg at center, green);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square.</p>
|
||||
<div id="fail"></div>
|
||||
<div id="test"></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue