зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572805 - Use cbindgen for text-emphasis-style. r=boris
I sent https://github.com/eqrion/cbindgen/pull/377 since I got sick of copy-pasting the private default constructor stuff :) Differential Revision: https://phabricator.services.mozilla.com/D41419 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
60447df0e6
Коммит
6068035edc
|
@ -1672,7 +1672,7 @@ void nsLineLayout::AdjustLeadings(nsIFrame* spanFrame, PerSpanData* psd,
|
|||
requiredStartLeading += leadings.mStart;
|
||||
requiredEndLeading += leadings.mEnd;
|
||||
}
|
||||
if (aStyleText->HasTextEmphasis()) {
|
||||
if (aStyleText->HasEffectiveTextEmphasis()) {
|
||||
nscoord bsize = GetBSizeOfEmphasisMarks(spanFrame, aInflation);
|
||||
LogicalSide side = aStyleText->TextEmphasisSide(mRootSpan->mWritingMode);
|
||||
if (side == eLogicalSideBStart) {
|
||||
|
@ -2279,7 +2279,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
|
|||
fm, minimumLineBSize, lineWM.IsLineInverted());
|
||||
nscoord blockEnd = blockStart + minimumLineBSize;
|
||||
|
||||
if (mStyleText->HasTextEmphasis()) {
|
||||
if (mStyleText->HasEffectiveTextEmphasis()) {
|
||||
nscoord fontMaxHeight = fm->MaxHeight();
|
||||
nscoord emphasisHeight =
|
||||
GetBSizeOfEmphasisMarks(spanFrame, inflation);
|
||||
|
@ -3303,7 +3303,7 @@ void nsLineLayout::RelativePositionFrames(PerSpanData* psd,
|
|||
// (4) When there are text strokes
|
||||
if (pfd->mRecomputeOverflow ||
|
||||
frame->Style()->HasTextDecorationLines() ||
|
||||
frame->StyleText()->HasTextEmphasis() ||
|
||||
frame->StyleText()->HasEffectiveTextEmphasis() ||
|
||||
frame->StyleText()->HasWebkitTextStroke()) {
|
||||
nsTextFrame* f = static_cast<nsTextFrame*>(frame);
|
||||
r = f->RecomputeOverflow(mBlockReflowInput->mFrame);
|
||||
|
|
|
@ -2161,7 +2161,7 @@ already_AddRefed<gfxTextRun> BuildTextRunsScanner::BuildTextRunForFrames(
|
|||
lastComputedStyle->IsTextCombined()) {
|
||||
anyTextTransformStyle = true;
|
||||
}
|
||||
if (textStyle->HasTextEmphasis()) {
|
||||
if (textStyle->HasEffectiveTextEmphasis()) {
|
||||
anyTextEmphasis = true;
|
||||
}
|
||||
flags |= GetSpacingFlags(f);
|
||||
|
@ -5233,10 +5233,38 @@ struct EmphasisMarkInfo {
|
|||
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(EmphasisMarkProperty, EmphasisMarkInfo)
|
||||
|
||||
static void ComputeTextEmphasisStyleString(const StyleTextEmphasisStyle& aStyle,
|
||||
nsAString& aOut) {
|
||||
MOZ_ASSERT(!aStyle.IsNone());
|
||||
if (aStyle.IsString()) {
|
||||
nsDependentCSubstring string = aStyle.AsString().AsString();
|
||||
AppendUTF8toUTF16(string, aOut);
|
||||
return;
|
||||
}
|
||||
const auto& keyword = aStyle.AsKeyword();
|
||||
const bool fill = keyword.fill == StyleTextEmphasisFillMode::Filled;
|
||||
switch (keyword.shape) {
|
||||
case StyleTextEmphasisShapeKeyword::Dot:
|
||||
return aOut.AppendLiteral(fill ? u"\u2022" : u"\u25e6");
|
||||
case StyleTextEmphasisShapeKeyword::Circle:
|
||||
return aOut.AppendLiteral(fill ? u"\u25cf" : u"\u25cb");
|
||||
case StyleTextEmphasisShapeKeyword::DoubleCircle:
|
||||
return aOut.AppendLiteral(fill ? u"\u25c9" : u"\u25ce");
|
||||
case StyleTextEmphasisShapeKeyword::Triangle:
|
||||
return aOut.AppendLiteral(fill ? u"\u25b2" : u"\u25b3");
|
||||
case StyleTextEmphasisShapeKeyword::Sesame:
|
||||
return aOut.AppendLiteral(fill ? u"\ufe45" : u"\ufe46");
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown emphasis style shape");
|
||||
}
|
||||
}
|
||||
|
||||
static already_AddRefed<gfxTextRun> GenerateTextRunForEmphasisMarks(
|
||||
nsTextFrame* aFrame, gfxFontGroup* aFontGroup,
|
||||
ComputedStyle* aComputedStyle, const nsStyleText* aStyleText) {
|
||||
const nsString& emphasisString = aStyleText->mTextEmphasisStyleString;
|
||||
nsAutoString string;
|
||||
ComputeTextEmphasisStyleString(aStyleText->mTextEmphasisStyle, string);
|
||||
|
||||
RefPtr<DrawTarget> dt = CreateReferenceDrawTarget(aFrame);
|
||||
auto appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
gfx::ShapedTextFlags flags =
|
||||
|
@ -5245,9 +5273,9 @@ static already_AddRefed<gfxTextRun> GenerateTextRunForEmphasisMarks(
|
|||
// The emphasis marks should always be rendered upright per spec.
|
||||
flags = gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
}
|
||||
return aFontGroup->MakeTextRun<char16_t>(
|
||||
emphasisString.get(), emphasisString.Length(), dt, appUnitsPerDevUnit,
|
||||
flags, nsTextFrameUtils::Flags(), nullptr);
|
||||
return aFontGroup->MakeTextRun<char16_t>(string.get(), string.Length(), dt,
|
||||
appUnitsPerDevUnit, flags,
|
||||
nsTextFrameUtils::Flags(), nullptr);
|
||||
}
|
||||
|
||||
static nsRubyFrame* FindFurthestInlineRubyAncestor(nsTextFrame* aFrame) {
|
||||
|
@ -5265,7 +5293,7 @@ static nsRubyFrame* FindFurthestInlineRubyAncestor(nsTextFrame* aFrame) {
|
|||
nsRect nsTextFrame::UpdateTextEmphasis(WritingMode aWM,
|
||||
PropertyProvider& aProvider) {
|
||||
const nsStyleText* styleText = StyleText();
|
||||
if (!styleText->HasTextEmphasis()) {
|
||||
if (!styleText->HasEffectiveTextEmphasis()) {
|
||||
DeleteProperty(EmphasisMarkProperty());
|
||||
return nsRect();
|
||||
}
|
||||
|
@ -7117,7 +7145,8 @@ void nsTextFrame::DrawText(Range aRange, const gfx::Point& aTextBaselinePt,
|
|||
// Hide text decorations if we're currently hiding @font-face fallback text
|
||||
const bool drawDecorations =
|
||||
!aParams.provider->GetFontGroup()->ShouldSkipDrawing() &&
|
||||
(decorations.HasDecorationLines() || StyleText()->HasTextEmphasis());
|
||||
(decorations.HasDecorationLines() ||
|
||||
StyleText()->HasEffectiveTextEmphasis());
|
||||
if (drawDecorations) {
|
||||
DrawTextRunAndDecorations(aRange, aTextBaselinePt, aParams, decorations);
|
||||
} else {
|
||||
|
|
|
@ -519,6 +519,7 @@ cbindgen-types = [
|
|||
{ gecko = "StyleGenericTrackListValue", servo = "values::generics::grid::TrackListValue" },
|
||||
{ gecko = "StyleGenericTrackList", servo = "values::generics::grid::TrackList" },
|
||||
{ gecko = "StyleGenericGridTemplateComponent", servo = "values::generics::grid::GridTemplateComponent" },
|
||||
{ gecko = "StyleTextEmphasisStyle", servo = "values::computed::text::TextEmphasisStyle" },
|
||||
]
|
||||
|
||||
mapped-generic-types = [
|
||||
|
|
|
@ -730,24 +730,6 @@ enum class StyleWhiteSpace : uint8_t {
|
|||
(NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER | \
|
||||
NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT)
|
||||
|
||||
// text-emphasis-style
|
||||
// Note that filled and none here both have zero as their value. This is
|
||||
// not an problem because:
|
||||
// * In specified style, none is represented as eCSSUnit_None.
|
||||
// * In computed style, 'filled' always has its shape computed, and thus
|
||||
// the combined value is never zero.
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_NONE 0
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_FILL_MASK (1 << 3)
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_FILLED (0 << 3)
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN (1 << 3)
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_SHAPE_MASK 7
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_DOT 1
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE 2
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_DOUBLE_CIRCLE 3
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_TRIANGLE 4
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_SESAME 5
|
||||
#define NS_STYLE_TEXT_EMPHASIS_STYLE_STRING 255
|
||||
|
||||
// text-rendering
|
||||
enum class StyleTextRendering : uint8_t {
|
||||
Auto,
|
||||
|
|
|
@ -3371,7 +3371,6 @@ nsStyleText::nsStyleText(const Document& aDocument)
|
|||
mTextCombineUpright(NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE),
|
||||
mControlCharacterVisibility(
|
||||
nsLayoutUtils::ControlCharVisibilityDefault()),
|
||||
mTextEmphasisStyle(NS_STYLE_TEXT_EMPHASIS_STYLE_NONE),
|
||||
mTextRendering(StyleTextRendering::Auto),
|
||||
mTextEmphasisColor(StyleColor::CurrentColor()),
|
||||
mWebkitTextFillColor(StyleColor::CurrentColor()),
|
||||
|
@ -3384,7 +3383,8 @@ nsStyleText::nsStyleText(const Document& aDocument)
|
|||
mTextIndent(LengthPercentage::Zero()),
|
||||
mTextUnderlineOffset(LengthOrAuto::Auto()),
|
||||
mTextDecorationSkipInk(StyleTextDecorationSkipInk::Auto),
|
||||
mWebkitTextStrokeWidth(0) {
|
||||
mWebkitTextStrokeWidth(0),
|
||||
mTextEmphasisStyle(StyleTextEmphasisStyle::None()) {
|
||||
MOZ_COUNT_CTOR(nsStyleText);
|
||||
RefPtr<nsAtom> language = aDocument.GetContentLanguageAsAtomForStyle();
|
||||
mTextEmphasisPosition =
|
||||
|
@ -3410,7 +3410,6 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
|
|||
mTextCombineUpright(aSource.mTextCombineUpright),
|
||||
mControlCharacterVisibility(aSource.mControlCharacterVisibility),
|
||||
mTextEmphasisPosition(aSource.mTextEmphasisPosition),
|
||||
mTextEmphasisStyle(aSource.mTextEmphasisStyle),
|
||||
mTextRendering(aSource.mTextRendering),
|
||||
mTextEmphasisColor(aSource.mTextEmphasisColor),
|
||||
mWebkitTextFillColor(aSource.mWebkitTextFillColor),
|
||||
|
@ -3424,7 +3423,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
|
|||
mTextDecorationSkipInk(aSource.mTextDecorationSkipInk),
|
||||
mWebkitTextStrokeWidth(aSource.mWebkitTextStrokeWidth),
|
||||
mTextShadow(aSource.mTextShadow),
|
||||
mTextEmphasisStyleString(aSource.mTextEmphasisStyleString) {
|
||||
mTextEmphasisStyle(aSource.mTextEmphasisStyle) {
|
||||
MOZ_COUNT_CTOR(nsStyleText);
|
||||
}
|
||||
|
||||
|
@ -3463,8 +3462,8 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aNewData) const {
|
|||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
|
||||
if (HasTextEmphasis() != aNewData.HasTextEmphasis() ||
|
||||
(HasTextEmphasis() &&
|
||||
if (HasEffectiveTextEmphasis() != aNewData.HasEffectiveTextEmphasis() ||
|
||||
(HasEffectiveTextEmphasis() &&
|
||||
mTextEmphasisPosition != aNewData.mTextEmphasisPosition)) {
|
||||
// Text emphasis position change could affect line height calculation.
|
||||
return nsChangeHint_AllReflowHints | nsChangeHint_RepaintFrame;
|
||||
|
@ -3482,7 +3481,6 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aNewData) const {
|
|||
|
||||
if (mTextShadow != aNewData.mTextShadow ||
|
||||
mTextEmphasisStyle != aNewData.mTextEmphasisStyle ||
|
||||
mTextEmphasisStyleString != aNewData.mTextEmphasisStyleString ||
|
||||
mWebkitTextStrokeWidth != aNewData.mWebkitTextStrokeWidth) {
|
||||
hint |= nsChangeHint_UpdateSubtreeOverflow | nsChangeHint_SchedulePaint |
|
||||
nsChangeHint_RepaintFrame;
|
||||
|
|
|
@ -1146,7 +1146,6 @@ 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_*
|
||||
mozilla::StyleTextRendering mTextRendering;
|
||||
mozilla::StyleColor mTextEmphasisColor;
|
||||
mozilla::StyleColor mWebkitTextFillColor;
|
||||
|
@ -1164,8 +1163,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText {
|
|||
nscoord mWebkitTextStrokeWidth; // coord
|
||||
|
||||
mozilla::StyleArcSlice<mozilla::StyleSimpleShadow> mTextShadow;
|
||||
|
||||
nsString mTextEmphasisStyleString;
|
||||
mozilla::StyleTextEmphasisStyle mTextEmphasisStyle;
|
||||
|
||||
mozilla::StyleWordBreak EffectiveWordBreak() const {
|
||||
if (mWordBreak == mozilla::StyleWordBreak::BreakWord) {
|
||||
|
@ -1225,7 +1223,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText {
|
|||
owrap == mozilla::StyleOverflowWrap::Anywhere;
|
||||
}
|
||||
|
||||
bool HasTextEmphasis() const { return !mTextEmphasisStyleString.IsEmpty(); }
|
||||
bool HasEffectiveTextEmphasis() const {
|
||||
if (mTextEmphasisStyle.IsNone()) {
|
||||
return false;
|
||||
}
|
||||
if (mTextEmphasisStyle.IsString() &&
|
||||
mTextEmphasisStyle.AsString().AsString().IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HasWebkitTextStroke() const { return mWebkitTextStrokeWidth > 0; }
|
||||
|
||||
|
|
|
@ -2578,97 +2578,15 @@ fn static_assert() {
|
|||
|
||||
|
||||
<%self:impl_trait style_struct_name="InheritedText"
|
||||
skip_longhands="text-align text-emphasis-style
|
||||
-webkit-text-stroke-width text-emphasis-position">
|
||||
skip_longhands="text-align -webkit-text-stroke-width text-emphasis-position">
|
||||
|
||||
<% text_align_keyword = Keyword("text-align",
|
||||
"start end left right center justify -moz-center -moz-left -moz-right char",
|
||||
gecko_strip_moz_prefix=False) %>
|
||||
${impl_keyword('text_align', 'mTextAlign', text_align_keyword)}
|
||||
|
||||
fn clear_text_emphasis_style_if_string(&mut self) {
|
||||
if self.gecko.mTextEmphasisStyle == structs::NS_STYLE_TEXT_EMPHASIS_STYLE_STRING as u8 {
|
||||
self.gecko.mTextEmphasisStyleString.truncate();
|
||||
self.gecko.mTextEmphasisStyle = structs::NS_STYLE_TEXT_EMPHASIS_STYLE_NONE as u8;
|
||||
}
|
||||
}
|
||||
|
||||
${impl_simple_type_with_conversion("text_emphasis_position")}
|
||||
|
||||
pub fn set_text_emphasis_style(&mut self, v: values::computed::TextEmphasisStyle) {
|
||||
use crate::values::computed::TextEmphasisStyle;
|
||||
use crate::values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword};
|
||||
|
||||
self.clear_text_emphasis_style_if_string();
|
||||
let (te, s) = match v {
|
||||
TextEmphasisStyle::None => (structs::NS_STYLE_TEXT_EMPHASIS_STYLE_NONE, ""),
|
||||
TextEmphasisStyle::Keyword { fill, shape } => {
|
||||
let gecko_fill = match fill {
|
||||
TextEmphasisFillMode::Filled => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_FILLED,
|
||||
TextEmphasisFillMode::Open => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN,
|
||||
};
|
||||
|
||||
let gecko_shape = match shape {
|
||||
TextEmphasisShapeKeyword::Dot => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_DOT,
|
||||
TextEmphasisShapeKeyword::Circle => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE,
|
||||
TextEmphasisShapeKeyword::DoubleCircle => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_DOUBLE_CIRCLE,
|
||||
TextEmphasisShapeKeyword::Triangle => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_TRIANGLE,
|
||||
TextEmphasisShapeKeyword::Sesame => structs::NS_STYLE_TEXT_EMPHASIS_STYLE_SESAME,
|
||||
};
|
||||
|
||||
(gecko_shape | gecko_fill, shape.char(fill))
|
||||
},
|
||||
TextEmphasisStyle::String(ref s) => {
|
||||
(structs::NS_STYLE_TEXT_EMPHASIS_STYLE_STRING, &**s)
|
||||
},
|
||||
};
|
||||
self.gecko.mTextEmphasisStyleString.assign_str(s);
|
||||
self.gecko.mTextEmphasisStyle = te as u8;
|
||||
}
|
||||
|
||||
pub fn copy_text_emphasis_style_from(&mut self, other: &Self) {
|
||||
self.clear_text_emphasis_style_if_string();
|
||||
if other.gecko.mTextEmphasisStyle == structs::NS_STYLE_TEXT_EMPHASIS_STYLE_STRING as u8 {
|
||||
self.gecko.mTextEmphasisStyleString
|
||||
.assign(&*other.gecko.mTextEmphasisStyleString)
|
||||
}
|
||||
self.gecko.mTextEmphasisStyle = other.gecko.mTextEmphasisStyle;
|
||||
}
|
||||
|
||||
pub fn reset_text_emphasis_style(&mut self, other: &Self) {
|
||||
self.copy_text_emphasis_style_from(other)
|
||||
}
|
||||
|
||||
pub fn clone_text_emphasis_style(&self) -> values::computed::TextEmphasisStyle {
|
||||
use crate::values::computed::TextEmphasisStyle;
|
||||
use crate::values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword};
|
||||
|
||||
if self.gecko.mTextEmphasisStyle == structs::NS_STYLE_TEXT_EMPHASIS_STYLE_NONE as u8 {
|
||||
return TextEmphasisStyle::None;
|
||||
}
|
||||
|
||||
if self.gecko.mTextEmphasisStyle == structs::NS_STYLE_TEXT_EMPHASIS_STYLE_STRING as u8 {
|
||||
return TextEmphasisStyle::String(self.gecko.mTextEmphasisStyleString.to_string().into());
|
||||
}
|
||||
|
||||
let fill =
|
||||
self.gecko.mTextEmphasisStyle & structs::NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN as u8 == 0;
|
||||
|
||||
let fill = if fill { TextEmphasisFillMode::Filled } else { TextEmphasisFillMode::Open };
|
||||
|
||||
let shape =
|
||||
match self.gecko.mTextEmphasisStyle as u32 & !structs::NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN {
|
||||
structs::NS_STYLE_TEXT_EMPHASIS_STYLE_DOT => TextEmphasisShapeKeyword::Dot,
|
||||
structs::NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE => TextEmphasisShapeKeyword::Circle,
|
||||
structs::NS_STYLE_TEXT_EMPHASIS_STYLE_DOUBLE_CIRCLE => TextEmphasisShapeKeyword::DoubleCircle,
|
||||
structs::NS_STYLE_TEXT_EMPHASIS_STYLE_TRIANGLE => TextEmphasisShapeKeyword::Triangle,
|
||||
structs::NS_STYLE_TEXT_EMPHASIS_STYLE_SESAME => TextEmphasisShapeKeyword::Sesame,
|
||||
_ => panic!("Unexpected value in style struct for text-emphasis-style property")
|
||||
};
|
||||
|
||||
TextEmphasisStyle::Keyword { fill, shape }
|
||||
}
|
||||
|
||||
${impl_non_negative_length('_webkit_text_stroke_width',
|
||||
'mWebkitTextStrokeWidth')}
|
||||
|
||||
|
|
|
@ -195,8 +195,11 @@ impl TextDecorationsInEffect {
|
|||
}
|
||||
|
||||
/// Computed value for the text-emphasis-style property
|
||||
///
|
||||
/// cbindgen:derive-tagged-enum-copy-constructor=true
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[allow(missing_docs)]
|
||||
#[repr(C, u8)]
|
||||
pub enum TextEmphasisStyle {
|
||||
/// [ <fill> || <shape> ]
|
||||
Keyword {
|
||||
|
|
|
@ -671,6 +671,7 @@ pub enum TextEmphasisStyle {
|
|||
|
||||
/// Fill mode for the text-emphasis-style property
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
|
||||
#[repr(u8)]
|
||||
pub enum TextEmphasisFillMode {
|
||||
/// `filled`
|
||||
Filled,
|
||||
|
@ -690,6 +691,7 @@ impl TextEmphasisFillMode {
|
|||
#[derive(
|
||||
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum TextEmphasisShapeKeyword {
|
||||
/// `dot`
|
||||
Dot,
|
||||
|
@ -703,50 +705,6 @@ pub enum TextEmphasisShapeKeyword {
|
|||
Sesame,
|
||||
}
|
||||
|
||||
impl TextEmphasisShapeKeyword {
|
||||
/// converts fill mode to a unicode char
|
||||
pub fn char(&self, fill: TextEmphasisFillMode) -> &'static str {
|
||||
let fill = fill == TextEmphasisFillMode::Filled;
|
||||
match *self {
|
||||
TextEmphasisShapeKeyword::Dot => {
|
||||
if fill {
|
||||
"\u{2022}"
|
||||
} else {
|
||||
"\u{25e6}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::Circle => {
|
||||
if fill {
|
||||
"\u{25cf}"
|
||||
} else {
|
||||
"\u{25cb}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::DoubleCircle => {
|
||||
if fill {
|
||||
"\u{25c9}"
|
||||
} else {
|
||||
"\u{25ce}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::Triangle => {
|
||||
if fill {
|
||||
"\u{25b2}"
|
||||
} else {
|
||||
"\u{25b3}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::Sesame => {
|
||||
if fill {
|
||||
"\u{fe45}"
|
||||
} else {
|
||||
"\u{fe46}"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for TextEmphasisStyle {
|
||||
type ComputedValue = ComputedTextEmphasisStyle;
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ include = [
|
|||
"SVGPaint",
|
||||
"SVGPaintKind",
|
||||
"GridTemplateComponent",
|
||||
"TextEmphasisStyle",
|
||||
]
|
||||
item_types = ["enums", "structs", "typedefs", "functions", "constants"]
|
||||
renaming_overrides_prefixing = true
|
||||
|
@ -677,3 +678,12 @@ renaming_overrides_prefixing = true
|
|||
inline Span<const StyleOwnedSlice<StyleCustomIdent>> LineNameLists(bool aIsSubgrid) const;
|
||||
inline Span<const StyleGenericTrackListValue<L, I>> TrackListValues() const;
|
||||
"""
|
||||
|
||||
"TextEmphasisStyle" = """
|
||||
private:
|
||||
// Private default constructor without initialization so that the helper
|
||||
// constructor functions still work as expected. They take care of
|
||||
// initializing the fields properly.
|
||||
StyleTextEmphasisStyle() {}
|
||||
public:
|
||||
"""
|
||||
|
|
Загрузка…
Ссылка в новой задаче