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
This commit is contained in:
Emilio Cobos Álvarez 2023-05-25 20:07:53 +02:00 committed by Oriol Brufau
parent 212733900e
commit 693806b853

View file

@ -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,
}