Auto merge of #16609 - nox:quirks, r=Manishearth,emilio

Implement unitless length quirk

The Gecko side doesn't propagate its quirks mode yet.

<!-- 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/16609)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-27 22:32:24 -05:00 committed by GitHub
commit d8bcc0db1a
70 changed files with 2321 additions and 194 deletions

View file

@ -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};
@ -328,7 +329,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:
@ -342,7 +344,8 @@ impl PropertyDeclarationIdSet {
with_variables.from_shorthand,
custom_properties,
f,
error_reporter);
error_reporter,
quirks_mode);
} else {
f(value);
}
@ -357,7 +360,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:
@ -375,7 +379,8 @@ impl PropertyDeclarationIdSet {
url_data,
error_reporter,
None,
LengthParsingMode::Default);
LengthParsingMode::Default,
quirks_mode);
Parser::new(&css).parse_entirely(|input| {
match from_shorthand {
None => {
@ -2116,7 +2121,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 {
@ -2162,7 +2168,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
@ -2177,7 +2184,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>,
@ -2230,6 +2238,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