mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #13804 - canaltinova:gradient-parsing, r=Manishearth
Fix radial gradient's <size>/<ending-shape> parsing <!-- Please describe your changes on the following line: --> Parsing now handles sizes and shapes in various order. I had to delete `EndingShape`'s parse implementation and mix it with `Position` in `parse_radial`. It became a bit complicated to read but I couldn't make it simpler. r? @Manishearth --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13664 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13804) <!-- Reviewable:end -->
This commit is contained in:
commit
9e3cf3189b
4 changed files with 170 additions and 54 deletions
|
@ -31,6 +31,27 @@ macro_rules! assert_roundtrip {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! assert_roundtrip_with_context {
|
||||
($fun:expr, $string:expr) => {
|
||||
assert_roundtrip_with_context!($fun, $string, $string);
|
||||
};
|
||||
($fun:expr,$input:expr, $output:expr) => {
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||
let mut parser = Parser::new($input);
|
||||
let parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
|
||||
assert_eq!(serialized, $output);
|
||||
|
||||
let mut parser = Parser::new(&serialized);
|
||||
let re_parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
|
||||
assert_eq!(serialized, re_serialized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
macro_rules! parse_longhand {
|
||||
($name:ident, $s:expr) => {{
|
||||
|
@ -41,6 +62,7 @@ macro_rules! parse_longhand {
|
|||
}
|
||||
|
||||
mod basic_shape;
|
||||
mod image;
|
||||
mod mask;
|
||||
mod position;
|
||||
mod selectors;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue