mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Use unified list for TextDecorationLine and implement its SpecifiedValueInfo.
Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: 2sCnK1AecFk
This commit is contained in:
parent
5437c96402
commit
20398491cc
2 changed files with 112 additions and 122 deletions
|
@ -15,8 +15,7 @@ use values::generics::text::InitialLetter as GenericInitialLetter;
|
|||
use values::generics::text::LineHeight as GenericLineHeight;
|
||||
use values::generics::text::MozTabSize as GenericMozTabSize;
|
||||
use values::generics::text::Spacing;
|
||||
use values::specified::text::{TextDecorationLine, TextEmphasisFillMode};
|
||||
use values::specified::text::{TextEmphasisShapeKeyword, TextOverflowSide};
|
||||
use values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword, TextOverflowSide};
|
||||
|
||||
pub use values::specified::TextAlignKeyword as TextAlign;
|
||||
pub use values::specified::TextEmphasisPosition;
|
||||
|
@ -79,36 +78,6 @@ impl ToCss for TextOverflow {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for TextDecorationLine {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
let mut has_any = false;
|
||||
|
||||
macro_rules! write_value {
|
||||
($line:path => $css:expr) => {
|
||||
if self.contains($line) {
|
||||
if has_any {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
dest.write_str($css)?;
|
||||
has_any = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
write_value!(TextDecorationLine::UNDERLINE => "underline");
|
||||
write_value!(TextDecorationLine::OVERLINE => "overline");
|
||||
write_value!(TextDecorationLine::LINE_THROUGH => "line-through");
|
||||
write_value!(TextDecorationLine::BLINK => "blink");
|
||||
if !has_any {
|
||||
dest.write_str("none")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// A struct that represents the _used_ value of the text-decoration property.
|
||||
///
|
||||
/// FIXME(emilio): This is done at style resolution time, though probably should
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue