enable text-overflow property for Servo#270
enable text-overflow property for Servo#270RichardTjokroutomo wants to merge 2 commits intoservo:mainfrom
Conversation
Loirooriol
left a comment
There was a problem hiding this comment.
As said in the Servo review, since it's not handling strings or 2 values, this should alter the parser to reject these cases for Servo.
Alternatively, you can put this property behind a flag, and then in Servo make it an experimental web platform feature flag. Then it won't be enabled by default, but it will be used in tests.
ebdcfa5 to
1f40f82
Compare
| input: &mut Parser<'i, 't>, | ||
| ) -> Result<TextOverflow, ParseError<'i>> { | ||
| let first = TextOverflowSide::parse(context, input)?; | ||
| let first = <TextOverflowSide as Parse>::parse(context, input)?; |
There was a problem hiding this comment.
So for some reason, stylo now can't correctly decide which Parse to use (or rather, for some reason in the past, it can choose the right one), and so if you don't specify, it will result in a compilation error:
error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> style\values\specified\text.rs:231:21
|
231 | let first = TextOverflowSide::parse(context, input)?;
| ^^^^^^^^^^^^^^^^^^^^^^^ ------- unexpected argument #1 of type `&ParserContext<'_>`
|
note: associated function defined here
--> style\values\specified\text.rs:178:5
|
178 | Parse,
| ^^^^^
= note: this error originates in the derive macro `Parse` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove the extra argument
|
231 - let first = TextOverflowSide::parse(context, input)?;
231 + let first = TextOverflowSide::parse(input)?;
There was a problem hiding this comment.
Undo it, no longer needed
| first, | ||
| second, | ||
| sides_are_logical: false, | ||
| if let Ok(second) = input.try_parse(|input| <TextOverflowSide as Parse>::parse(context, input)) { |
There was a problem hiding this comment.
As with the other case, the compiler now can't resolve to the correct Parse.
error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> style\values\specified\text.rs:231:21
|
231 | let first = TextOverflowSide::parse(context, input)?;
| ^^^^^^^^^^^^^^^^^^^^^^^ ------- unexpected argument #1 of type `&ParserContext<'_>`
|
note: associated function defined here
--> style\values\specified\text.rs:178:5
|
178 | Parse,
| ^^^^^
= note: this error originates in the derive macro `Parse` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove the extra argument
|
231 - let first = TextOverflowSide::parse(context, input)?;
231 + let first = TextOverflowSide::parse(input)?;
|
@Loirooriol I noticed earlier today that a PR on Stylo has been merged (#271), so I tried to rebase. However, I got some compilation errors. |
Loirooriol
left a comment
There was a problem hiding this comment.
Since changing the struct affects things more than what I expected, maybe just do something like
#[cfg(feature = "servo")]
if matches!(first, TextOverflowSide::String(_)) {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
#[cfg(feature = "gecko")]
if let Ok(second) = input.try_parse(|input| TextOverflowSide::parse(context, input)) {
return Ok(Self {
first,
second,
sides_are_logical: false,
});
}
Ok(Self {
first: TextOverflowSide::Clip,
second: first,
sides_are_logical: true,
})Or add support for strings as Nico says in servo/servo#40526 (comment)
cb461f6 to
5c4f381
Compare
5c4f381 to
61c9280
Compare
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
18765f5 to
f075d49
Compare
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Enable
text-overflowfor Servo. Companion PR: #40526