mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -10,7 +10,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use style::context::QuirksMode;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::stylesheets::CssRuleType;
|
||||
use style::supports::{Declaration, parse_condition_or_declaration};
|
||||
|
||||
|
@ -32,7 +32,7 @@ impl CSS {
|
|||
let decl = Declaration { prop: property.into(), val: value.into() };
|
||||
let url = win.Document().url();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Supports),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
decl.eval(&context)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ impl CSS {
|
|||
if let Ok(cond) = cond {
|
||||
let url = win.Document().url();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Supports),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
cond.eval(&context)
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@ use dom::medialist::MediaList;
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use style::media_queries::parse_media_query_list;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
use style::stylearc::Arc;
|
||||
use style::stylesheets::{CssRuleType, MediaRule};
|
||||
|
@ -75,7 +75,7 @@ impl CSSMediaRule {
|
|||
let url = win.get_url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let new_medialist = parse_media_query_list(&context, &mut input);
|
||||
let mut guard = self.cssconditionrule.shared_lock().write();
|
||||
|
|
|
@ -17,7 +17,7 @@ use dom_struct::dom_struct;
|
|||
use servo_url::ServoUrl;
|
||||
use std::ascii::AsciiExt;
|
||||
use style::attr::AttrValue;
|
||||
use style::parser::ParsingMode;
|
||||
use style::parser::PARSING_MODE_DEFAULT;
|
||||
use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId};
|
||||
use style::properties::{parse_one_declaration, parse_style_attribute};
|
||||
use style::selector_parser::PseudoElement;
|
||||
|
@ -260,7 +260,7 @@ impl CSSStyleDeclaration {
|
|||
let result =
|
||||
parse_one_declaration(id, &value, &self.owner.base_url(),
|
||||
window.css_error_reporter(),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
|
||||
// Step 7
|
||||
|
|
|
@ -13,7 +13,7 @@ use dom::cssrule::SpecificCSSRule;
|
|||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
use style::stylearc::Arc;
|
||||
use style::stylesheets::{CssRuleType, SupportsRule};
|
||||
|
@ -63,7 +63,7 @@ impl CSSSupportsRule {
|
|||
let url = win.Document().url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Supports),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let enabled = cond.eval(&context);
|
||||
let mut guard = self.cssconditionrule.shared_lock().write();
|
||||
|
|
|
@ -32,7 +32,7 @@ use std::cell::Cell;
|
|||
use std::default::Default;
|
||||
use style::attr::AttrValue;
|
||||
use style::media_queries::parse_media_query_list;
|
||||
use style::parser::{ParsingMode, ParserContext as CssParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext as CssParserContext};
|
||||
use style::str::HTML_SPACE_CHARACTERS;
|
||||
use style::stylearc::Arc;
|
||||
use style::stylesheets::{CssRuleType, Stylesheet};
|
||||
|
@ -282,7 +282,7 @@ impl HTMLLinkElement {
|
|||
let win = document.window();
|
||||
let doc_url = document.url();
|
||||
let context = CssParserContext::new_for_cssom(&doc_url, win.css_error_reporter(), Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
document.quirks_mode());
|
||||
let media = parse_media_query_list(&context, &mut css_parser);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ use net_traits::ReferrerPolicy;
|
|||
use script_layout_interface::message::Msg;
|
||||
use std::cell::Cell;
|
||||
use style::media_queries::parse_media_query_list;
|
||||
use style::parser::{ParsingMode, ParserContext as CssParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext as CssParserContext};
|
||||
use style::stylearc::Arc;
|
||||
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
|
||||
use stylesheet_loader::{StylesheetLoader, StylesheetOwner};
|
||||
|
@ -88,7 +88,7 @@ impl HTMLStyleElement {
|
|||
let context = CssParserContext::new_for_cssom(&url,
|
||||
win.css_error_reporter(),
|
||||
Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
doc.quirks_mode());
|
||||
let shared_lock = node.owner_doc().style_shared_lock().clone();
|
||||
let mq = Arc::new(shared_lock.wrap(
|
||||
|
|
|
@ -14,7 +14,7 @@ use dom::window::Window;
|
|||
use dom_struct::dom_struct;
|
||||
use style::media_queries::{MediaQuery, parse_media_query_list};
|
||||
use style::media_queries::MediaList as StyleMediaList;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::shared_lock::{SharedRwLock, Locked};
|
||||
use style::stylearc::Arc;
|
||||
use style::stylesheets::CssRuleType;
|
||||
|
@ -77,7 +77,7 @@ impl MediaListMethods for MediaList {
|
|||
let url = win.get_url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
*media_queries = parse_media_query_list(&context, &mut parser);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ impl MediaListMethods for MediaList {
|
|||
let url = win.get_url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let m = MediaQuery::parse(&context, &mut parser);
|
||||
// Step 2
|
||||
|
@ -141,7 +141,7 @@ impl MediaListMethods for MediaList {
|
|||
let url = win.get_url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let m = MediaQuery::parse(&context, &mut parser);
|
||||
// Step 2
|
||||
|
|
|
@ -104,7 +104,7 @@ use std::sync::mpsc::TryRecvError::{Disconnected, Empty};
|
|||
use style::context::ReflowGoal;
|
||||
use style::error_reporting::ParseErrorReporter;
|
||||
use style::media_queries;
|
||||
use style::parser::{ParsingMode, ParserContext as CssParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext as CssParserContext};
|
||||
use style::properties::PropertyId;
|
||||
use style::properties::longhands::overflow_x;
|
||||
use style::selector_parser::PseudoElement;
|
||||
|
@ -978,7 +978,7 @@ impl WindowMethods for Window {
|
|||
let url = self.get_url();
|
||||
let quirks_mode = self.Document().quirks_mode();
|
||||
let context = CssParserContext::new_for_cssom(&url, self.css_error_reporter(), Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let media_query_list = media_queries::parse_media_query_list(&context, &mut parser);
|
||||
let document = self.Document();
|
||||
|
|
|
@ -334,6 +334,7 @@ mod bindings {
|
|||
.bitfield_enum("nsChangeHint")
|
||||
.bitfield_enum("nsRestyleHint")
|
||||
.constified_enum("UpdateAnimationsTasks")
|
||||
.constified_enum("ParsingMode")
|
||||
.parse_callbacks(Box::new(Callbacks));
|
||||
let whitelist_vars = [
|
||||
"NS_AUTHOR_SPECIFIED_.*",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{DeclarationListParser, DeclarationParser, parse_one_rule};
|
||||
use error_reporting::NullReporter;
|
||||
use parser::{ParsingMode, ParserContext, log_css_error};
|
||||
use parser::{PARSING_MODE_DEFAULT, ParserContext, log_css_error};
|
||||
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
|
||||
use properties::{PropertyDeclarationId, LonghandId, ParsedDeclaration};
|
||||
use properties::LonghandIdSet;
|
||||
|
@ -131,7 +131,7 @@ impl Keyframe {
|
|||
&parent_stylesheet.url_data,
|
||||
&error_reporter,
|
||||
Some(CssRuleType::Keyframe),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
parent_stylesheet.quirks_mode);
|
||||
let mut input = Parser::new(css);
|
||||
|
||||
|
|
|
@ -10,21 +10,48 @@ use error_reporting::ParseErrorReporter;
|
|||
use style_traits::OneOrMoreCommaSeparated;
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
|
||||
/// The mode to use when parsing lengths.
|
||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||
pub enum ParsingMode {
|
||||
/// In CSS, lengths must have units, except for zero values, where the unit can be omitted.
|
||||
/// https://www.w3.org/TR/css3-values/#lengths
|
||||
Default,
|
||||
/// In SVG, a coordinate or length value without a unit identifier (e.g., "25") is assumed to be in user units (px).
|
||||
/// https://www.w3.org/TR/SVG/coords.html#Units
|
||||
AllowUnitlessLength,
|
||||
bitflags! {
|
||||
/// The mode to use when parsing values.
|
||||
pub flags ParsingMode: u8 {
|
||||
/// In CSS, lengths must have units, except for zero values, where the unit can be omitted.
|
||||
/// https://www.w3.org/TR/css3-values/#lengths
|
||||
const PARSING_MODE_DEFAULT = 0x00,
|
||||
/// In SVG, a coordinate or length value without a unit identifier (e.g., "25") is assumed
|
||||
/// to be in user units (px).
|
||||
/// https://www.w3.org/TR/SVG/coords.html#Units
|
||||
const PARSING_MODE_ALLOW_UNITLESS_LENGTH = 0x01,
|
||||
}
|
||||
}
|
||||
|
||||
impl ParsingMode {
|
||||
/// Whether the parsing mode allows unitless lengths for non-zero values to be intpreted as px.
|
||||
pub fn allows_unitless_lengths(&self) -> bool {
|
||||
*self == ParsingMode::AllowUnitlessLength
|
||||
self.intersects(PARSING_MODE_ALLOW_UNITLESS_LENGTH)
|
||||
}
|
||||
}
|
||||
|
||||
/// Asserts that all ParsingMode flags have a matching ParsingMode value in gecko.
|
||||
#[cfg(feature = "gecko")]
|
||||
#[inline]
|
||||
pub fn assert_parsing_mode_match() {
|
||||
use gecko_bindings::structs;
|
||||
|
||||
macro_rules! check_parsing_modes {
|
||||
( $( $a:ident => $b:ident ),*, ) => {
|
||||
if cfg!(debug_assertions) {
|
||||
let mut hints = ParsingMode::all();
|
||||
$(
|
||||
assert_eq!(structs::$a as usize, $b.bits() as usize, stringify!($b));
|
||||
hints.remove($b);
|
||||
)*
|
||||
assert_eq!(hints, ParsingMode::empty(), "all ParsingMode bits should have an assertion");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check_parsing_modes! {
|
||||
ParsingMode_Default => PARSING_MODE_DEFAULT,
|
||||
ParsingMode_AllowUnitlessLength => PARSING_MODE_ALLOW_UNITLESS_LENGTH,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use context::QuirksMode;
|
|||
use cssparser::{DeclarationListParser, parse_important};
|
||||
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use parser::{ParsingMode, ParserContext, log_css_error};
|
||||
use parser::{PARSING_MODE_DEFAULT, ParsingMode, ParserContext, log_css_error};
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
|
@ -649,7 +649,7 @@ pub fn parse_style_attribute(input: &str,
|
|||
url_data,
|
||||
error_reporter,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
parse_property_declaration_list(&context, &mut Parser::new(input))
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use font_metrics::FontMetricsProvider;
|
|||
#[cfg(feature = "servo")] use logical_geometry::{LogicalMargin, PhysicalSide};
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use parser::{ParsingMode, Parse, ParserContext};
|
||||
use parser::{PARSING_MODE_DEFAULT, Parse, ParserContext};
|
||||
use properties::animated_properties::TransitionProperty;
|
||||
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
|
||||
use shared_lock::StylesheetGuards;
|
||||
|
@ -387,7 +387,7 @@ impl PropertyDeclarationIdSet {
|
|||
url_data,
|
||||
error_reporter,
|
||||
None,
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
Parser::new(&css).parse_entirely(|input| {
|
||||
match from_shorthand {
|
||||
|
|
|
@ -26,7 +26,7 @@ use gecko_bindings::sugar::refptr::RefPtr;
|
|||
use keyframes::{Keyframe, parse_keyframe_list};
|
||||
use media_queries::{Device, MediaList, parse_media_query_list};
|
||||
use parking_lot::RwLock;
|
||||
use parser::{ParsingMode, Parse, ParserContext, log_css_error};
|
||||
use parser::{PARSING_MODE_DEFAULT, Parse, ParserContext, log_css_error};
|
||||
use properties::{PropertyDeclarationBlock, parse_property_declaration_list};
|
||||
use selector_parser::{SelectorImpl, SelectorParser};
|
||||
use selectors::parser::SelectorList;
|
||||
|
@ -442,7 +442,7 @@ impl CssRule {
|
|||
&parent_stylesheet.url_data,
|
||||
&error_reporter,
|
||||
None,
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
parent_stylesheet.quirks_mode);
|
||||
let mut input = Parser::new(css);
|
||||
|
||||
|
@ -744,7 +744,7 @@ impl Stylesheet {
|
|||
shared_lock: shared_lock,
|
||||
loader: stylesheet_loader,
|
||||
context: ParserContext::new_with_line_number_offset(origin, url_data, error_reporter,
|
||||
line_number_offset, ParsingMode::Default,
|
||||
line_number_offset, PARSING_MODE_DEFAULT,
|
||||
quirks_mode),
|
||||
state: Cell::new(State::Start),
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ use style::gecko_properties::{self, style_structs};
|
|||
use style::keyframes::KeyframesStepValue;
|
||||
use style::media_queries::{MediaList, parse_media_query_list};
|
||||
use style::parallel;
|
||||
use style::parser::{ParsingMode, ParserContext};
|
||||
use style::parser::{PARSING_MODE_DEFAULT, ParserContext};
|
||||
use style::properties::{CascadeFlags, ComputedValues, Importance, ParsedDeclaration, StyleBuilder};
|
||||
use style::properties::{LonghandIdSet, PropertyDeclarationBlock, PropertyId};
|
||||
use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
|
@ -115,6 +115,8 @@ static mut DUMMY_URL_DATA: *mut URLExtraData = 0 as *mut URLExtraData;
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
|
||||
use style::parser::assert_parsing_mode_match;
|
||||
|
||||
// Initialize logging.
|
||||
let mut builder = LogBuilder::new();
|
||||
let default_level = if cfg!(debug_assertions) { "warn" } else { "error" };
|
||||
|
@ -128,6 +130,7 @@ pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
|
|||
|
||||
// Perform some debug-only runtime assertions.
|
||||
restyle_hints::assert_restyle_hints_match();
|
||||
assert_parsing_mode_match();
|
||||
|
||||
// Initialize some static data.
|
||||
gecko_properties::initialize();
|
||||
|
@ -1134,12 +1137,11 @@ fn parse_property(property_id: PropertyId,
|
|||
value: *const nsACString,
|
||||
data: *mut URLExtraData,
|
||||
parsing_mode: structs::ParsingMode) -> Result<ParsedDeclaration, ()> {
|
||||
use style::parser::ParsingMode;
|
||||
|
||||
let value = unsafe { value.as_ref().unwrap().as_str_unchecked() };
|
||||
let url_data = unsafe { RefPtr::from_ptr_ref(&data) };
|
||||
let parsing_mode = match parsing_mode {
|
||||
structs::ParsingMode::Default => ParsingMode::Default,
|
||||
structs::ParsingMode::AllowUnitlessLength => ParsingMode::AllowUnitlessLength,
|
||||
};
|
||||
let parsing_mode = ParsingMode::from_bits_truncate(parsing_mode);
|
||||
|
||||
parse_one_declaration(property_id,
|
||||
value,
|
||||
|
@ -1180,7 +1182,7 @@ pub extern "C" fn Servo_ParseEasing(easing: *const nsAString,
|
|||
url_data,
|
||||
&reporter,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
let easing = unsafe { (*easing).to_string() };
|
||||
match transition_timing_function::single_value::parse(&context, &mut Parser::new(&easing)) {
|
||||
|
@ -1410,7 +1412,7 @@ pub extern "C" fn Servo_MediaList_SetText(list: RawServoMediaListBorrowed, text:
|
|||
let url_data = unsafe { dummy_url_data() };
|
||||
let reporter = RustLogReporter;
|
||||
let context = ParserContext::new_for_cssom(url_data, &reporter, Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| {
|
||||
*list = parse_media_query_list(&context, &mut parser);
|
||||
|
@ -1442,7 +1444,7 @@ pub extern "C" fn Servo_MediaList_AppendMedium(list: RawServoMediaListBorrowed,
|
|||
let url_data = unsafe { dummy_url_data() };
|
||||
let reporter = RustLogReporter;
|
||||
let context = ParserContext::new_for_cssom(url_data, &reporter, Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| {
|
||||
list.append_medium(&context, new_medium);
|
||||
|
@ -1456,7 +1458,7 @@ pub extern "C" fn Servo_MediaList_DeleteMedium(list: RawServoMediaListBorrowed,
|
|||
let url_data = unsafe { dummy_url_data() };
|
||||
let reporter = RustLogReporter;
|
||||
let context = ParserContext::new_for_cssom(url_data, &reporter, Some(CssRuleType::Media),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| list.delete_medium(&context, old_medium))
|
||||
}
|
||||
|
@ -1810,7 +1812,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(declarations:
|
|||
let string = unsafe { (*value).to_string() };
|
||||
let error_reporter = RustLogReporter;
|
||||
let context = ParserContext::new(Origin::Author, url_data, &error_reporter,
|
||||
Some(CssRuleType::Style), ParsingMode::Default,
|
||||
Some(CssRuleType::Style), PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
if let Ok(url) = SpecifiedUrl::parse_from_string(string.into(), &context) {
|
||||
let decl = PropertyDeclaration::BackgroundImage(BackgroundImage(
|
||||
|
@ -1842,7 +1844,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(declarat
|
|||
pub extern "C" fn Servo_CSSSupports2(property: *const nsACString, value: *const nsACString) -> bool {
|
||||
let id = get_property_id_from_property!(property, false);
|
||||
|
||||
parse_property(id, value, unsafe { DUMMY_URL_DATA }, structs::ParsingMode::Default).is_ok()
|
||||
parse_property(id, value, unsafe { DUMMY_URL_DATA }, structs::ParsingMode_Default).is_ok()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -1854,7 +1856,7 @@ pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
|
|||
let url_data = unsafe { dummy_url_data() };
|
||||
let reporter = RustLogReporter;
|
||||
let context = ParserContext::new_for_cssom(url_data, &reporter, Some(CssRuleType::Style),
|
||||
ParsingMode::Default,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
cond.eval(&context)
|
||||
} else {
|
||||
|
|
|
@ -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