mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Move the from-font value from text-underline-offset to text-underline-position, as per recent spec changes, and fix interaction between position and offset.
Differential Revision: https://phabricator.services.mozilla.com/D59778
This commit is contained in:
parent
2910ca6197
commit
df01cec675
4 changed files with 22 additions and 14 deletions
|
@ -1029,7 +1029,7 @@ pub enum TextDecorationSkipInk {
|
|||
None,
|
||||
}
|
||||
|
||||
/// Implements type for `text-underline-offset` and `text-decoration-thickness` properties
|
||||
/// Implements type for `text-decoration-thickness` property
|
||||
pub type TextDecorationLength = GenericTextDecorationLength<LengthPercentage>;
|
||||
|
||||
impl TextDecorationLength {
|
||||
|
@ -1048,21 +1048,23 @@ impl TextDecorationLength {
|
|||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[value_info(other_values = "auto,under,left,right")]
|
||||
#[value_info(other_values = "auto,from-font,under,left,right")]
|
||||
#[repr(C)]
|
||||
/// Specified keyword values for the text-underline-position property.
|
||||
/// (Non-exclusive, but not all combinations are allowed: only `under` may occur
|
||||
/// together with either `left` or `right`.)
|
||||
/// https://drafts.csswg.org/css-text-decor-3/#text-underline-position-property
|
||||
/// (Non-exclusive, but not all combinations are allowed: the spec grammar gives
|
||||
/// `auto | [ from-font | under ] || [ left | right ]`.)
|
||||
/// https://drafts.csswg.org/css-text-decor-4/#text-underline-position-property
|
||||
pub struct TextUnderlinePosition: u8 {
|
||||
/// Use automatic positioning below the alphabetic baseline.
|
||||
const AUTO = 0;
|
||||
/// Use underline position from the first available font.
|
||||
const FROM_FONT = 1 << 0;
|
||||
/// Below the glyph box.
|
||||
const UNDER = 1 << 0;
|
||||
const UNDER = 1 << 1;
|
||||
/// In vertical mode, place to the left of the text.
|
||||
const LEFT = 1 << 1;
|
||||
const LEFT = 1 << 2;
|
||||
/// In vertical mode, place to the right of the text.
|
||||
const RIGHT = 1 << 2;
|
||||
const RIGHT = 1 << 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1087,12 @@ impl Parse for TextUnderlinePosition {
|
|||
"auto" if result.is_empty() => {
|
||||
return Ok(result);
|
||||
},
|
||||
"under" if !result.intersects(TextUnderlinePosition::UNDER) => {
|
||||
"from-font" if !result.intersects(TextUnderlinePosition::FROM_FONT |
|
||||
TextUnderlinePosition::UNDER) => {
|
||||
result.insert(TextUnderlinePosition::FROM_FONT);
|
||||
},
|
||||
"under" if !result.intersects(TextUnderlinePosition::FROM_FONT |
|
||||
TextUnderlinePosition::UNDER) => {
|
||||
result.insert(TextUnderlinePosition::UNDER);
|
||||
},
|
||||
"left" if !result.intersects(TextUnderlinePosition::LEFT |
|
||||
|
@ -1131,6 +1138,7 @@ impl ToCss for TextUnderlinePosition {
|
|||
};
|
||||
}
|
||||
|
||||
maybe_write!(FROM_FONT => "from-font");
|
||||
maybe_write!(UNDER => "under");
|
||||
maybe_write!(LEFT => "left");
|
||||
maybe_write!(RIGHT => "right");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue