Skip to content

Commit 0017e21

Browse files
enable text-overflow property for Servo
Signed-off-by: Richard Tjokroutomo <[email protected]> Co-authored-by: Oriol Brufau <[email protected]>
1 parent 92a4473 commit 0017e21

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

style/properties/longhands/text.mako.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ${helpers.predefined_type(
99
"TextOverflow",
1010
"computed::TextOverflow::get_initial_value()",
1111
engines="gecko servo",
12-
servo_pref="layout.unimplemented",
1312
animation_type="discrete",
1413
boxed=True,
1514
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow",

style/values/specified/text.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl Parse for InitialLetter {
182182
ToResolvedValue,
183183
ToShmem,
184184
)]
185-
#[repr(C, u8)]
185+
#[repr(C)]
186186
pub enum TextOverflowSide {
187187
/// Clip inline content.
188188
Clip,
@@ -228,21 +228,23 @@ impl Parse for TextOverflow {
228228
input: &mut Parser<'i, 't>,
229229
) -> Result<TextOverflow, ParseError<'i>> {
230230
let first = TextOverflowSide::parse(context, input)?;
231-
Ok(
232-
if let Ok(second) = input.try_parse(|input| TextOverflowSide::parse(context, input)) {
233-
Self {
234-
first,
235-
second,
236-
sides_are_logical: false,
237-
}
238-
} else {
239-
Self {
240-
first: TextOverflowSide::Clip,
241-
second: first,
242-
sides_are_logical: true,
243-
}
244-
},
245-
)
231+
#[cfg(feature = "servo")]
232+
if matches!(first, TextOverflowSide::String(_)) {
233+
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
234+
}
235+
#[cfg(feature = "gecko")]
236+
if let Ok(second) = input.try_parse(|input| TextOverflowSide::parse(context, input)) {
237+
return Ok(Self {
238+
first,
239+
second,
240+
sides_are_logical: false,
241+
});
242+
}
243+
Ok(Self {
244+
first: TextOverflowSide::Clip,
245+
second: first,
246+
sides_are_logical: true,
247+
})
246248
}
247249
}
248250

0 commit comments

Comments
 (0)