mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Make ParsingMode bitflags.
assert_parsing_mode_match() is mostly the same as assert_restyle_hints_match().
This commit is contained in:
parent
fcc50ea421
commit
b6b3187efa
19 changed files with 88 additions and 58 deletions
|
@ -6,7 +6,7 @@ use cssparser::Parser;
|
|||
use media_queries::CSSErrorReporterTest;
|
||||
use parsing::parse;
|
||||
use style::context::QuirksMode;
|
||||
use style::parser::{ParsingMode, Parse, ParserContext};
|
||||
use style::parser::{PARSING_MODE_ALLOW_UNITLESS_LENGTH, Parse, ParserContext};
|
||||
use style::stylesheets::{CssRuleType, Origin};
|
||||
use style::values::Either;
|
||||
use style::values::specified::{LengthOrPercentageOrNumber, Number};
|
||||
|
@ -43,7 +43,7 @@ fn test_parsing_modes() {
|
|||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter,
|
||||
Some(CssRuleType::Style), ParsingMode::AllowUnitlessLength,
|
||||
Some(CssRuleType::Style), PARSING_MODE_ALLOW_UNITLESS_LENGTH,
|
||||
QuirksMode::NoQuirks);
|
||||
let mut parser = Parser::new("1");
|
||||
let result = Length::parse(&context, &mut parser);
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
use cssparser::Parser;
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use style::context::QuirksMode;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::stylesheets::{CssRuleType, Origin};
|
||||
|
||||
fn parse<T, F: Fn(&ParserContext, &mut Parser) -> Result<T, ()>>(f: F, s: &str) -> Result<T, ()> {
|
||||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
let mut parser = Parser::new(s);
|
||||
f(&context, &mut parser)
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
use cssparser::Parser;
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use style::context::QuirksMode;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::stylesheets::{CssRuleType, Origin};
|
||||
|
||||
fn parse<T, F: Fn(&ParserContext, &mut Parser) -> Result<T, ()>>(f: F, s: &str) -> Result<T, ()> {
|
||||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
let mut parser = Parser::new(s);
|
||||
f(&context, &mut parser)
|
||||
|
|
|
@ -9,7 +9,7 @@ use servo_config::prefs::{PREFS, PrefValue};
|
|||
use servo_url::ServoUrl;
|
||||
use style::context::QuirksMode;
|
||||
use style::media_queries::{Device, MediaList, MediaType};
|
||||
use style::parser::{ParsingMode, Parse, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, Parse, ParserContext};
|
||||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylearc::Arc;
|
||||
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
|
||||
|
@ -295,7 +295,7 @@ fn constrain_viewport() {
|
|||
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Viewport),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
|
||||
macro_rules! from_css {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue