зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1509664 - Change Text Rendering constants to enum classes in nsStyleConsts.h. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D12839 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
12299139d5
Коммит
b87c4f4c0c
|
@ -7567,10 +7567,10 @@ nsLayoutUtils::GetTextRunFlagsForStyle(ComputedStyle* aComputedStyle,
|
|||
result |= gfx::ShapedTextFlags::TEXT_HIDE_CONTROL_CHARACTERS;
|
||||
}
|
||||
switch (aComputedStyle->StyleText()->mTextRendering) {
|
||||
case NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED:
|
||||
case StyleTextRendering::Optimizespeed:
|
||||
result |= gfx::ShapedTextFlags::TEXT_OPTIMIZE_SPEED;
|
||||
break;
|
||||
case NS_STYLE_TEXT_RENDERING_AUTO:
|
||||
case StyleTextRendering::Auto:
|
||||
if (aStyleFont->mFont.size < aPresContext->GetAutoQualityMinFontSize()) {
|
||||
result |= gfx::ShapedTextFlags::TEXT_OPTIMIZE_SPEED;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ rusty-enums = [
|
|||
"mozilla::StyleOverscrollBehavior",
|
||||
"mozilla::StyleScrollbarWidth",
|
||||
"mozilla::StyleWhiteSpace",
|
||||
"mozilla::StyleTextRendering",
|
||||
"nsStyleImageType",
|
||||
"nsStyleSVGPaintType",
|
||||
"nsStyleSVGFallbackType",
|
||||
|
|
|
@ -976,10 +976,12 @@ enum class StyleWhiteSpace : uint8_t {
|
|||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_STRING 255
|
||||
|
||||
// text-rendering
|
||||
#define NS_STYLE_TEXT_RENDERING_AUTO 0
|
||||
#define NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED 1
|
||||
#define NS_STYLE_TEXT_RENDERING_OPTIMIZELEGIBILITY 2
|
||||
#define NS_STYLE_TEXT_RENDERING_GEOMETRICPRECISION 3
|
||||
enum class StyleTextRendering : uint8_t {
|
||||
Auto,
|
||||
Optimizespeed,
|
||||
Optimizelegibility,
|
||||
Geometricprecision,
|
||||
};
|
||||
|
||||
// color-adjust
|
||||
#define NS_STYLE_COLOR_ADJUST_ECONOMY 0
|
||||
|
|
|
@ -4260,7 +4260,7 @@ nsStyleText::nsStyleText(const nsPresContext* aContext)
|
|||
, mTextCombineUpright(NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE)
|
||||
, mControlCharacterVisibility(nsLayoutUtils::ControlCharVisibilityDefault())
|
||||
, mTextEmphasisStyle(NS_STYLE_TEXT_EMPHASIS_STYLE_NONE)
|
||||
, mTextRendering(NS_STYLE_TEXT_RENDERING_AUTO)
|
||||
, mTextRendering(StyleTextRendering::Auto)
|
||||
, mTextEmphasisColor(StyleComplexColor::CurrentColor())
|
||||
, mWebkitTextFillColor(StyleComplexColor::CurrentColor())
|
||||
, mWebkitTextStrokeColor(StyleComplexColor::CurrentColor())
|
||||
|
|
|
@ -1587,7 +1587,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
|
|||
uint8_t mControlCharacterVisibility; // NS_STYLE_CONTROL_CHARACTER_VISIBILITY_*
|
||||
uint8_t mTextEmphasisPosition; // NS_STYLE_TEXT_EMPHASIS_POSITION_*
|
||||
uint8_t mTextEmphasisStyle; // NS_STYLE_TEXT_EMPHASIS_STYLE_*
|
||||
uint8_t mTextRendering; // NS_STYLE_TEXT_RENDERING_*
|
||||
mozilla::StyleTextRendering mTextRendering;
|
||||
mozilla::StyleComplexColor mTextEmphasisColor;
|
||||
mozilla::StyleComplexColor mWebkitTextFillColor;
|
||||
mozilla::StyleComplexColor mWebkitTextStrokeColor;
|
||||
|
|
|
@ -2926,7 +2926,7 @@ SVGTextDrawPathCallbacks::SetupContext()
|
|||
// seem to do anything with the antialias mode. So we can perhaps remove it,
|
||||
// or make SetAntialiasMode set cairo text antialiasing too.
|
||||
switch (mFrame->StyleText()->mTextRendering) {
|
||||
case NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED:
|
||||
case StyleTextRendering::Optimizespeed:
|
||||
mContext.SetAntialiasMode(AntialiasMode::NONE);
|
||||
break;
|
||||
default:
|
||||
|
@ -5550,7 +5550,7 @@ SVGTextFrame::UpdateFontSizeScaleFactor()
|
|||
// Unfortunately we can't treat text-rendering:geometricPrecision
|
||||
// separately for each text frame.
|
||||
geometricPrecision = f->StyleText()->mTextRendering ==
|
||||
NS_STYLE_TEXT_RENDERING_GEOMETRICPRECISION;
|
||||
StyleTextRendering::Geometricprecision;
|
||||
}
|
||||
nscoord size = f->StyleFont()->mFont.size;
|
||||
if (size) {
|
||||
|
|
|
@ -550,8 +550,8 @@ public:
|
|||
FillRule::FILL_EVEN_ODD : FillRule::FILL_WINDING;
|
||||
}
|
||||
|
||||
static AntialiasMode ToAntialiasMode(uint8_t aTextRendering) {
|
||||
return aTextRendering == NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED ?
|
||||
static AntialiasMode ToAntialiasMode(mozilla::StyleTextRendering aTextRendering) {
|
||||
return aTextRendering == mozilla::StyleTextRendering::Optimizespeed ?
|
||||
AntialiasMode::NONE : AntialiasMode::SUBPIXEL;
|
||||
}
|
||||
|
||||
|
|
|
@ -337,6 +337,7 @@ ${helpers.single_keyword(
|
|||
${helpers.single_keyword(
|
||||
"text-rendering",
|
||||
"auto optimizespeed optimizelegibility geometricprecision",
|
||||
gecko_enum_prefix="StyleTextRendering",
|
||||
animation_value_type="discrete",
|
||||
spec="https://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty",
|
||||
servo_restyle_damage="rebuild_and_reflow",
|
||||
|
|
Загрузка…
Ссылка в новой задаче