mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #15613 - Varentsov:master, r=upsuper
fix {transform,perspective}-origin accepts (and ignores) anything for… … their second part of value <!-- Please describe your changes on the following line: --> --- <!-- 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 #15487. <!-- Either: --> - [X] There are tests for these changes OR <!-- 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/15613) <!-- Reviewable:end -->
This commit is contained in:
commit
b2539090fa
2 changed files with 31 additions and 1 deletions
|
@ -487,7 +487,7 @@ pub fn parse_origin(context: &ParserContext, input: &mut Parser) -> Result<Origi
|
|||
}
|
||||
Ok(())
|
||||
}) {
|
||||
match LengthOrPercentage::parse(context, input) {
|
||||
match input.try(|input| LengthOrPercentage::parse(context, input)) {
|
||||
Ok(value) => {
|
||||
if horizontal.is_none() {
|
||||
horizontal = Some(value);
|
||||
|
|
|
@ -6,6 +6,7 @@ use cssparser::Parser;
|
|||
use media_queries::CSSErrorReporterTest;
|
||||
use servo_url::ServoUrl;
|
||||
use style::parser::ParserContext;
|
||||
use style::properties::longhands::{self, perspective_origin, transform_origin};
|
||||
use style::stylesheets::Origin;
|
||||
use style_traits::ToCss;
|
||||
|
||||
|
@ -33,3 +34,32 @@ fn test_clip() {
|
|||
"rect(auto, auto, auto, auto)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_longhands_parse_origin() {
|
||||
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||
|
||||
let mut parser = Parser::new("1px some-rubbish");
|
||||
let parsed = longhands::parse_origin(&context, &mut parser);
|
||||
assert!(parsed.is_ok());
|
||||
assert_eq!(parser.is_exhausted(), false);
|
||||
|
||||
let mut parser = Parser::new("1px 2px");
|
||||
let parsed = longhands::parse_origin(&context, &mut parser);
|
||||
assert!(parsed.is_ok());
|
||||
assert_eq!(parser.is_exhausted(), true);
|
||||
|
||||
let mut parser = Parser::new("1px");
|
||||
let parsed = longhands::parse_origin(&context, &mut parser);
|
||||
assert!(parsed.is_ok());
|
||||
assert_eq!(parser.is_exhausted(), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_effects_parser_exhaustion() {
|
||||
assert_parser_exhausted!(perspective_origin, "1px 1px", true);
|
||||
assert_parser_exhausted!(transform_origin, "1px 1px", true);
|
||||
|
||||
assert_parser_exhausted!(perspective_origin, "1px some-rubbish", false);
|
||||
assert_parser_exhausted!(transform_origin, "1px some-rubbish", false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue