From 693806b853de24b5113bb9b0cae1bd202dea5ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 25 May 2023 20:07:53 +0200 Subject: [PATCH] style: Implement image-rendering: smooth and image-rendering: pixelated Also, more directly go from StyleImageRendering to wr::ImageRendering. * image-rendering: smooth the non-deprecated version of OptimizeQuality, which maps to SamplingFilter::LINEAR / wr::ImageRendering::Auto (which uses gl::LINEAR). * image-rendering: pixelated maps to wr::ImageRendering::Pixelated / SamplingFilter::POINT which is the same crisp-edges does. Note that this uncovers that we were mapping image-rendering: crisp-edges to wr::ImageRendering::Pixelated. I'm going to preserve behavior on this patch but we should consider switching that to map to wr::ImageRendering::CrispEdges on a follow-up (filed bug 1728831 for this). Differential Revision: https://phabricator.services.mozilla.com/D124378 --- components/style/values/specified/image.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index 984cc9b28a4..f5c5c80ef96 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -1247,8 +1247,10 @@ impl MozImageRect { #[repr(u8)] pub enum ImageRendering { Auto, + Smooth, #[parse(aliases = "-moz-crisp-edges")] CrispEdges, + Pixelated, // From the spec: // // This property previously accepted the values optimizeSpeed and @@ -1256,10 +1258,9 @@ pub enum ImageRendering { // them as valid values but must treat them as having the same behavior // as crisp-edges and smooth respectively, and authors must not use // them. + // #[cfg(feature = "gecko")] Optimizespeed, #[cfg(feature = "gecko")] Optimizequality, - #[cfg(feature = "servo")] - Pixelated, }