mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Propagate quirks mode all the way to ParserContext
The quirks mode is still not properly propagated in geckolib.
This commit is contained in:
parent
10fb8e61c7
commit
f68e2fded9
39 changed files with 225 additions and 100 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use context::QuirksMode;
|
||||
use cssparser::{DeclarationListParser, parse_important};
|
||||
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
|
@ -641,13 +642,15 @@ pub fn append_serialization<'a, W, I, N>(dest: &mut W,
|
|||
/// shared between Servo and Gecko.
|
||||
pub fn parse_style_attribute(input: &str,
|
||||
url_data: &UrlExtraData,
|
||||
error_reporter: &ParseErrorReporter)
|
||||
error_reporter: &ParseErrorReporter,
|
||||
quirks_mode: QuirksMode)
|
||||
-> PropertyDeclarationBlock {
|
||||
let context = ParserContext::new(Origin::Author,
|
||||
url_data,
|
||||
error_reporter,
|
||||
Some(CssRuleType::Style),
|
||||
LengthParsingMode::Default);
|
||||
LengthParsingMode::Default,
|
||||
quirks_mode);
|
||||
parse_property_declaration_list(&context, &mut Parser::new(input))
|
||||
}
|
||||
|
||||
|
@ -660,13 +663,15 @@ pub fn parse_one_declaration(id: PropertyId,
|
|||
input: &str,
|
||||
url_data: &UrlExtraData,
|
||||
error_reporter: &ParseErrorReporter,
|
||||
length_parsing_mode: LengthParsingMode)
|
||||
length_parsing_mode: LengthParsingMode,
|
||||
quirks_mode: QuirksMode)
|
||||
-> Result<ParsedDeclaration, ()> {
|
||||
let context = ParserContext::new(Origin::Author,
|
||||
url_data,
|
||||
error_reporter,
|
||||
Some(CssRuleType::Style),
|
||||
length_parsing_mode);
|
||||
length_parsing_mode,
|
||||
quirks_mode);
|
||||
Parser::new(input).parse_entirely(|parser| {
|
||||
ParsedDeclaration::parse(id, &context, parser)
|
||||
.map_err(|_| ())
|
||||
|
|
|
@ -277,6 +277,7 @@
|
|||
% if not property.derived_from:
|
||||
{
|
||||
let custom_props = context.style().custom_properties();
|
||||
let quirks_mode = context.quirks_mode;
|
||||
::properties::substitute_variables_${property.ident}(
|
||||
&declared_value, &custom_props,
|
||||
|value| {
|
||||
|
@ -349,7 +350,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}, error_reporter);
|
||||
}, error_reporter, quirks_mode);
|
||||
}
|
||||
|
||||
% if property.custom_cascade:
|
||||
|
|
|
@ -515,6 +515,7 @@ impl AnimationValue {
|
|||
% if prop.animatable:
|
||||
LonghandId::${prop.camel_case} => {
|
||||
let mut result = None;
|
||||
let quirks_mode = context.quirks_mode;
|
||||
::properties::substitute_variables_${prop.ident}_slow(
|
||||
&variables.css,
|
||||
variables.first_token_type,
|
||||
|
@ -533,7 +534,8 @@ impl AnimationValue {
|
|||
};
|
||||
result = AnimationValue::from_declaration(&declaration, context, initial);
|
||||
},
|
||||
&reporter);
|
||||
&reporter,
|
||||
quirks_mode);
|
||||
result
|
||||
},
|
||||
% else:
|
||||
|
|
|
@ -21,6 +21,7 @@ use cssparser::{Parser, TokenSerializationType};
|
|||
use error_reporting::ParseErrorReporter;
|
||||
#[cfg(feature = "servo")] use euclid::side_offsets::SideOffsets2D;
|
||||
use computed_values;
|
||||
use context::QuirksMode;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::bindings;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::structs::{self, nsCSSPropertyID};
|
||||
|
@ -327,7 +328,8 @@ impl PropertyDeclarationIdSet {
|
|||
% endif
|
||||
custom_properties: &Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||
f: F,
|
||||
error_reporter: &ParseErrorReporter)
|
||||
error_reporter: &ParseErrorReporter,
|
||||
quirks_mode: QuirksMode)
|
||||
% if property.boxed:
|
||||
where F: FnOnce(&DeclaredValue<Box<longhands::${property.ident}::SpecifiedValue>>)
|
||||
% else:
|
||||
|
@ -341,7 +343,8 @@ impl PropertyDeclarationIdSet {
|
|||
with_variables.from_shorthand,
|
||||
custom_properties,
|
||||
f,
|
||||
error_reporter);
|
||||
error_reporter,
|
||||
quirks_mode);
|
||||
} else {
|
||||
f(value);
|
||||
}
|
||||
|
@ -356,7 +359,8 @@ impl PropertyDeclarationIdSet {
|
|||
from_shorthand: Option<ShorthandId>,
|
||||
custom_properties: &Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||
f: F,
|
||||
error_reporter: &ParseErrorReporter)
|
||||
error_reporter: &ParseErrorReporter,
|
||||
quirks_mode: QuirksMode)
|
||||
% if property.boxed:
|
||||
where F: FnOnce(&DeclaredValue<Box<longhands::${property.ident}::SpecifiedValue>>)
|
||||
% else:
|
||||
|
@ -374,7 +378,8 @@ impl PropertyDeclarationIdSet {
|
|||
url_data,
|
||||
error_reporter,
|
||||
None,
|
||||
LengthParsingMode::Default);
|
||||
LengthParsingMode::Default,
|
||||
quirks_mode);
|
||||
Parser::new(&css).parse_entirely(|input| {
|
||||
match from_shorthand {
|
||||
None => {
|
||||
|
@ -2114,7 +2119,8 @@ pub fn cascade(device: &Device,
|
|||
cascade_info: Option<<&mut CascadeInfo>,
|
||||
error_reporter: &ParseErrorReporter,
|
||||
font_metrics_provider: &FontMetricsProvider,
|
||||
flags: CascadeFlags)
|
||||
flags: CascadeFlags,
|
||||
quirks_mode: QuirksMode)
|
||||
-> ComputedValues {
|
||||
debug_assert_eq!(parent_style.is_some(), layout_parent_style.is_some());
|
||||
let (is_root_element, inherited_style, layout_parent_style) = match parent_style {
|
||||
|
@ -2159,7 +2165,8 @@ pub fn cascade(device: &Device,
|
|||
cascade_info,
|
||||
error_reporter,
|
||||
font_metrics_provider,
|
||||
flags)
|
||||
flags,
|
||||
quirks_mode)
|
||||
}
|
||||
|
||||
/// NOTE: This function expects the declaration with more priority to appear
|
||||
|
@ -2173,7 +2180,8 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
mut cascade_info: Option<<&mut CascadeInfo>,
|
||||
error_reporter: &ParseErrorReporter,
|
||||
font_metrics_provider: &FontMetricsProvider,
|
||||
flags: CascadeFlags)
|
||||
flags: CascadeFlags,
|
||||
quirks_mode: QuirksMode)
|
||||
-> ComputedValues
|
||||
where F: Fn() -> I,
|
||||
I: Iterator<Item = &'a PropertyDeclaration>,
|
||||
|
@ -2226,6 +2234,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
style: starting_style,
|
||||
font_metrics_provider: font_metrics_provider,
|
||||
in_media_query: false,
|
||||
quirks_mode: quirks_mode,
|
||||
};
|
||||
|
||||
// Set computed values, overwriting earlier declarations for the same
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue