зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1598528 : convert NS_STYLE_TEXT_ORIENTATION_* to an enum class in nsStyleConsts.h r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D54252 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3de96f05de
Коммит
e9711f487b
|
@ -58,13 +58,13 @@ class AutoTextRun {
|
|||
}
|
||||
if (aMetrics->GetVertical()) {
|
||||
switch (aMetrics->GetTextOrientation()) {
|
||||
case NS_STYLE_TEXT_ORIENTATION_MIXED:
|
||||
case StyleTextOrientation::Mixed:
|
||||
flags |= gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED;
|
||||
break;
|
||||
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
||||
case StyleTextOrientation::Upright:
|
||||
flags |= gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
break;
|
||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
|
||||
case StyleTextOrientation::Sideways:
|
||||
flags |= gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ nsFontMetrics::nsFontMetrics(const nsFont& aFont, const Params& aParams,
|
|||
mOrientation(aParams.orientation),
|
||||
mTextRunRTL(false),
|
||||
mVertical(false),
|
||||
mTextOrientation(0) {
|
||||
mTextOrientation(mozilla::StyleTextOrientation::Mixed) {
|
||||
gfxFontStyle style(
|
||||
aFont.style, aFont.weight, aFont.stretch, gfxFloat(aFont.size) / mP2A,
|
||||
aParams.language, aParams.explicitLanguage, aFont.sizeAdjust,
|
||||
|
@ -251,10 +251,10 @@ nscoord nsFontMetrics::SpaceWidth() {
|
|||
// width of a horizontal space (even if we're using vertical line-spacing
|
||||
// metrics, as with "writing-mode:vertical-*;text-orientation:mixed").
|
||||
return CEIL_TO_TWIPS(
|
||||
GetMetrics(this, mVertical && mTextOrientation ==
|
||||
NS_STYLE_TEXT_ORIENTATION_UPRIGHT
|
||||
? eVertical
|
||||
: eHorizontal)
|
||||
GetMetrics(this,
|
||||
mVertical && mTextOrientation == StyleTextOrientation::Upright
|
||||
? eVertical
|
||||
: eHorizontal)
|
||||
.spaceWidth);
|
||||
}
|
||||
|
||||
|
|
|
@ -226,10 +226,12 @@ class nsFontMetrics final {
|
|||
void SetVertical(bool aVertical) { mVertical = aVertical; }
|
||||
bool GetVertical() const { return mVertical; }
|
||||
|
||||
void SetTextOrientation(uint8_t aTextOrientation) {
|
||||
void SetTextOrientation(mozilla::StyleTextOrientation aTextOrientation) {
|
||||
mTextOrientation = aTextOrientation;
|
||||
}
|
||||
uint8_t GetTextOrientation() const { return mTextOrientation; }
|
||||
mozilla::StyleTextOrientation GetTextOrientation() const {
|
||||
return mTextOrientation;
|
||||
}
|
||||
|
||||
gfxFontGroup* GetThebesFontGroup() const { return mFontGroup; }
|
||||
gfxUserFontSet* GetUserFontSet() const;
|
||||
|
@ -258,7 +260,7 @@ class nsFontMetrics final {
|
|||
// and text-orientation desired.
|
||||
bool mTextRunRTL;
|
||||
bool mVertical;
|
||||
uint8_t mTextOrientation;
|
||||
mozilla::StyleTextOrientation mTextOrientation;
|
||||
};
|
||||
|
||||
#endif /* NSFONTMETRICS__H__ */
|
||||
|
|
|
@ -78,7 +78,7 @@ static char16_t GetBidiOverride(ComputedStyle* aComputedStyle) {
|
|||
const nsStyleVisibility* vis = aComputedStyle->StyleVisibility();
|
||||
if ((vis->mWritingMode == NS_STYLE_WRITING_MODE_VERTICAL_RL ||
|
||||
vis->mWritingMode == NS_STYLE_WRITING_MODE_VERTICAL_LR) &&
|
||||
vis->mTextOrientation == NS_STYLE_TEXT_ORIENTATION_UPRIGHT) {
|
||||
vis->mTextOrientation == StyleTextOrientation::Upright) {
|
||||
return kLRO;
|
||||
}
|
||||
const nsStyleTextReset* text = aComputedStyle->StyleTextReset();
|
||||
|
|
|
@ -7361,11 +7361,11 @@ nsIFrame* nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame) {
|
|||
case NS_STYLE_WRITING_MODE_VERTICAL_LR:
|
||||
case NS_STYLE_WRITING_MODE_VERTICAL_RL:
|
||||
switch (aComputedStyle->StyleVisibility()->mTextOrientation) {
|
||||
case NS_STYLE_TEXT_ORIENTATION_MIXED:
|
||||
case StyleTextOrientation::Mixed:
|
||||
return gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED;
|
||||
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
||||
case StyleTextOrientation::Upright:
|
||||
return gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
|
||||
case StyleTextOrientation::Sideways:
|
||||
return gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unknown text-orientation");
|
||||
|
|
|
@ -134,6 +134,7 @@ rusty-enums = [
|
|||
"mozilla::StyleShapeRendering",
|
||||
"mozilla::StyleTextAnchor",
|
||||
"mozilla::StyleObjectFit",
|
||||
"mozilla::StyleTextOrientation",
|
||||
"nsStyleImageType",
|
||||
"nsINode_BooleanFlag",
|
||||
"mozilla::PseudoStyleType",
|
||||
|
|
|
@ -667,9 +667,11 @@ enum class StyleWhiteSpace : uint8_t {
|
|||
#define NS_STYLE_TEXT_SIZE_ADJUST_AUTO 1
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_TEXT_ORIENTATION_MIXED 0
|
||||
#define NS_STYLE_TEXT_ORIENTATION_UPRIGHT 1
|
||||
#define NS_STYLE_TEXT_ORIENTATION_SIDEWAYS 2
|
||||
enum class StyleTextOrientation : uint8_t {
|
||||
Mixed,
|
||||
Upright,
|
||||
Sideways,
|
||||
};
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE 0
|
||||
|
|
|
@ -3132,7 +3132,7 @@ nsStyleVisibility::nsStyleVisibility(const Document& aDocument)
|
|||
mVisible(NS_STYLE_VISIBILITY_VISIBLE),
|
||||
mImageRendering(NS_STYLE_IMAGE_RENDERING_AUTO),
|
||||
mWritingMode(NS_STYLE_WRITING_MODE_HORIZONTAL_TB),
|
||||
mTextOrientation(NS_STYLE_TEXT_ORIENTATION_MIXED),
|
||||
mTextOrientation(StyleTextOrientation::Mixed),
|
||||
mColorAdjust(StyleColorAdjust::Economy) {
|
||||
MOZ_COUNT_CTOR(nsStyleVisibility);
|
||||
}
|
||||
|
|
|
@ -1266,11 +1266,11 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
|
|||
nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
|
||||
|
||||
mozilla::StyleImageOrientation mImageOrientation;
|
||||
uint8_t mDirection; // NS_STYLE_DIRECTION_*
|
||||
uint8_t mVisible; // NS_STYLE_VISIBILITY_VISIBLE_*
|
||||
uint8_t mImageRendering; // NS_STYLE_IMAGE_RENDERING_*
|
||||
uint8_t mWritingMode; // NS_STYLE_WRITING_MODE_*
|
||||
uint8_t mTextOrientation; // NS_STYLE_TEXT_ORIENTATION_MIXED_*
|
||||
uint8_t mDirection; // NS_STYLE_DIRECTION_*
|
||||
uint8_t mVisible; // NS_STYLE_VISIBILITY_VISIBLE_*
|
||||
uint8_t mImageRendering; // NS_STYLE_IMAGE_RENDERING_*
|
||||
uint8_t mWritingMode; // NS_STYLE_WRITING_MODE_*
|
||||
mozilla::StyleTextOrientation mTextOrientation;
|
||||
mozilla::StyleColorAdjust mColorAdjust;
|
||||
|
||||
bool IsVisible() const { return (mVisible == NS_STYLE_VISIBILITY_VISIBLE); }
|
||||
|
|
|
@ -51,6 +51,7 @@ ${helpers.single_keyword(
|
|||
"mixed upright sideways",
|
||||
engines="gecko",
|
||||
gecko_aliases="sideways-right=sideways",
|
||||
gecko_enum_prefix="StyleTextOrientation",
|
||||
animation_value_type="none",
|
||||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-text-orientation",
|
||||
)}
|
||||
|
|
Загрузка…
Ссылка в новой задаче