mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
SVG length parsing mode
SVG allows non-zero lengths to be accepted and assumes they are in px. This adds this length parsing mode to Servo. MozReview-Commit-ID: Kxd3x64r9Ye
This commit is contained in:
parent
0936dd24d0
commit
6069e44f02
18 changed files with 130 additions and 53 deletions
|
@ -9,7 +9,7 @@
|
|||
use cssparser::{DeclarationListParser, parse_important};
|
||||
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use parser::{ParserContext, log_css_error};
|
||||
use parser::{LengthParsingMode, ParserContext, log_css_error};
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
|
@ -617,7 +617,11 @@ pub fn parse_style_attribute(input: &str,
|
|||
url_data: &UrlExtraData,
|
||||
error_reporter: &ParseErrorReporter)
|
||||
-> PropertyDeclarationBlock {
|
||||
let context = ParserContext::new(Origin::Author, url_data, error_reporter, Some(CssRuleType::Style));
|
||||
let context = ParserContext::new(Origin::Author,
|
||||
url_data,
|
||||
error_reporter,
|
||||
Some(CssRuleType::Style),
|
||||
LengthParsingMode::Default);
|
||||
parse_property_declaration_list(&context, &mut Parser::new(input))
|
||||
}
|
||||
|
||||
|
@ -631,7 +635,11 @@ pub fn parse_one_declaration(id: PropertyId,
|
|||
url_data: &UrlExtraData,
|
||||
error_reporter: &ParseErrorReporter)
|
||||
-> Result<ParsedDeclaration, ()> {
|
||||
let context = ParserContext::new(Origin::Author, url_data, error_reporter, Some(CssRuleType::Style));
|
||||
let context = ParserContext::new(Origin::Author,
|
||||
url_data,
|
||||
error_reporter,
|
||||
Some(CssRuleType::Style),
|
||||
LengthParsingMode::Default);
|
||||
Parser::new(input).parse_entirely(|parser| {
|
||||
ParsedDeclaration::parse(id, &context, parser)
|
||||
.map_err(|_| ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue