/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Generic types for text properties.
usecrate::derives::*; usecrate::Zero; use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss};
/// A generic value that is either a number or `auto`. #[derive(
Animate,
Clone,
ComputeSquaredDistance,
Copy,
Debug,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)] #[repr(C, u8)] pubenum NumberOrAuto<N> { /// `auto`
Auto, /// `<number>`
Number(N),
}
/// A generic value for the `hyphenate-limit-chars` property. #[derive(
Animate,
Clone,
ComputeSquaredDistance,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToResolvedValue,
ToShmem,
ToTyped,
)] #[repr(C)] #[typed(todo_derive_fields)] pubstruct GenericHyphenateLimitChars<Integer> { /// Required minimum number of characters in a hyphenated word. pub total_word_length: NumberOrAuto<Integer>, /// Required minumum number of characters before the hyphen. pub pre_hyphen_length: NumberOrAuto<Integer>, /// Required minumum number of characters after the hyphen. pub post_hyphen_length: NumberOrAuto<Integer>,
}
impl<Integer: ToCss + PartialEq> ToCss for GenericHyphenateLimitChars<Integer> { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where
W: Write,
{ self.total_word_length.to_css(dest)?;
impl<L: ToCss + PartialEq> ToCss for GenericTextDecorationInset<L> { fn to_css<W>(&self, dst: &mut CssWriter<W>) -> fmt::Result where
W: Write,
{ matchself {
GenericTextDecorationInset::Auto => dst.write_str("auto"),
GenericTextDecorationInset::Length { start, end } => {
start.to_css(dst)?; if start != end {
dst.write_char(' ')?;
end.to_css(dst)?;
}
Ok(())
},
}
}
}
/// Implements type for text-indent /// which takes the grammar of [<length-percentage>] && hanging? && each-line? /// /// https://drafts.csswg.org/css-text/#propdef-text-indent #[repr(C)] #[derive(
Animate,
Clone,
ComputeSquaredDistance,
Debug,
Eq,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
ToTyped,
)] pubstruct GenericTextIndent<LengthPercentage> { /// The amount of indent to be applied to the inline-start of the first line. pub length: LengthPercentage, /// Apply indent to non-first lines instead of first. #[animation(constant)] #[css(represents_keyword)] pub hanging: bool, /// Apply to each line after a hard break, not only first in block. #[animation(constant)] #[css(represents_keyword)] pub each_line: bool,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.