forked from mirrors/gecko-dev
Bug 1898468 - When converting legacy rgb(..) to color(srgb ..), ensure the flags are set accordingly r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211341
This commit is contained in:
parent
8f2a74a416
commit
d1fc08d7c5
3 changed files with 11 additions and 6 deletions
|
|
@ -425,9 +425,13 @@ fn parse_color_with_color_space<'i, 't>(
|
||||||
let color_space = PredefinedColorSpace::parse(arguments)?;
|
let color_space = PredefinedColorSpace::parse(arguments)?;
|
||||||
let component_parser = ComponentParser {
|
let component_parser = ComponentParser {
|
||||||
context: component_parser.context,
|
context: component_parser.context,
|
||||||
origin_color: component_parser
|
origin_color: component_parser.origin_color.map(|c| {
|
||||||
.origin_color
|
// If the origin color was in legacy srgb, converting it won't
|
||||||
.map(|c| c.to_color_space(ColorSpace::from(color_space))),
|
// change it to modern syntax. So make sure it's in modern syntax.
|
||||||
|
let mut c = c.to_color_space(ColorSpace::from(color_space));
|
||||||
|
c.flags.remove(ColorFlags::IS_LEGACY_SRGB);
|
||||||
|
c
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
let c1 = component_parser.parse_number_or_percentage(arguments, true)?;
|
let c1 = component_parser.parse_number_or_percentage(arguments, true)?;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
[registered-property-computation.html]
|
|
||||||
[<color> values are computed correctly [color(from lime srgb g g g)\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
@ -763,6 +763,10 @@
|
||||||
fuzzy_test_valid_color(`lch(from var(--mycolor) l 0 h)`);
|
fuzzy_test_valid_color(`lch(from var(--mycolor) l 0 h)`);
|
||||||
fuzzy_test_valid_color(`var(--mygray)`);
|
fuzzy_test_valid_color(`var(--mygray)`);
|
||||||
fuzzy_test_valid_color(`lch(from var(--mygray) l 30 h)`);
|
fuzzy_test_valid_color(`lch(from var(--mygray) l 30 h)`);
|
||||||
|
|
||||||
|
// Ensure that converting between legacy and modern sRGB color spaces work as expected.
|
||||||
|
fuzzy_test_valid_color(`color(from rebeccapurple srgb r g b)`, `color(srgb 0.4 0.2 0.6)`, 0.01);
|
||||||
|
fuzzy_test_valid_color(`rgb(from color(srgb 0.4 0.2 0.6) r g b)`, `color(srgb 0.4 0.2 0.6)`, 0.01);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue