Bug 1611041 - Convert image-rendering #defines to an enum class. r=emilio

MANUAL PUSH: Contributor didn't use Phabricator and I don't want patch to rot
This commit is contained in:
Thomas Dolezal 2020-01-30 04:34:32 +01:00 коммит произвёл Emilio Cobos Álvarez
Родитель 4165a2e843
Коммит a63c10f0de
6 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -6550,11 +6550,11 @@ SamplingFilter nsLayoutUtils::GetSamplingFilterForFrame(nsIFrame* aForFrame) {
}
switch (sc->StyleVisibility()->mImageRendering) {
case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
case StyleImageRendering::Optimizespeed:
return SamplingFilter::POINT;
case NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY:
case StyleImageRendering::Optimizequality:
return SamplingFilter::LINEAR;
case NS_STYLE_IMAGE_RENDERING_CRISP_EDGES:
case StyleImageRendering::CrispEdges:
return SamplingFilter::POINT;
default:
return defaultFilter;

Просмотреть файл

@ -99,6 +99,7 @@ rusty-enums = [
"mozilla::StyleDirection",
"mozilla::StyleFloat",
"mozilla::StyleImageOrientation",
"mozilla::StyleImageRendering",
"mozilla::StyleUserModify",
"mozilla::StyleUserInput",
"mozilla::StyleBoxDirection",

Просмотреть файл

@ -745,10 +745,12 @@ enum class StyleDominantBaseline : uint8_t {
};
// image-rendering
#define NS_STYLE_IMAGE_RENDERING_AUTO 0
#define NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED 1
#define NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY 2
#define NS_STYLE_IMAGE_RENDERING_CRISP_EDGES 3
enum class StyleImageRendering : uint8_t {
Auto,
Optimizespeed,
Optimizequality,
CrispEdges,
};
// mask-type
enum class StyleMaskType : uint8_t {

Просмотреть файл

@ -3130,7 +3130,7 @@ nsStyleVisibility::nsStyleVisibility(const Document& aDocument)
? StyleDirection::Rtl
: StyleDirection::Ltr),
mVisible(StyleVisibility::Visible),
mImageRendering(NS_STYLE_IMAGE_RENDERING_AUTO),
mImageRendering(StyleImageRendering::Auto),
mWritingMode(NS_STYLE_WRITING_MODE_HORIZONTAL_TB),
mTextOrientation(StyleTextOrientation::Mixed),
mColorAdjust(StyleColorAdjust::Economy) {

Просмотреть файл

@ -1261,7 +1261,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
mozilla::StyleImageOrientation mImageOrientation;
mozilla::StyleDirection mDirection;
mozilla::StyleVisibility mVisible;
uint8_t mImageRendering; // NS_STYLE_IMAGE_RENDERING_*
mozilla::StyleImageRendering mImageRendering;
uint8_t mWritingMode; // NS_STYLE_WRITING_MODE_*
mozilla::StyleTextOrientation mTextOrientation;
mozilla::StyleColorAdjust mColorAdjust;

Просмотреть файл

@ -78,6 +78,7 @@ ${helpers.single_keyword(
extra_servo_2013_values="pixelated",
extra_servo_2020_values="pixelated",
gecko_aliases="-moz-crisp-edges=crisp-edges",
gecko_enum_prefix="StyleImageRendering",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-images/#propdef-image-rendering",
)}