style: Get rid of GetParentAllowServo in implementation of CSS 'justify-items' property.

Bug: 1384542
Reviewed-by: heycam
MozReview-Commit-ID: 4qydjqSoVXs
This commit is contained in:
Emilio Cobos Álvarez 2017-07-26 15:26:19 +02:00
parent 06e2997d28
commit 2d9255bff1
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 163 additions and 45 deletions

View file

@ -454,6 +454,36 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
}
}
/// Resolves "justify-items: auto" based on the inherited style if needed to
/// comply with:
///
/// https://drafts.csswg.org/css-align/#valdef-justify-items-legacy
///
/// (Note that "auto" is being renamed to "legacy")
#[cfg(feature = "gecko")]
fn adjust_for_justify_items(&mut self) {
use values::specified::align;
let justify_items = self.style.get_position().clone_justify_items();
if justify_items.specified.0 != align::ALIGN_AUTO {
return;
}
let parent_justify_items =
self.style.get_parent_position().clone_justify_items();
if !parent_justify_items.computed.0.contains(align::ALIGN_LEGACY) {
return;
}
if parent_justify_items.computed == justify_items.computed {
return;
}
self.style
.mutate_position()
.set_computed_justify_items(parent_justify_items.computed);
}
/// Adjusts the style to account for various fixups that don't fit naturally
/// into the cascade.
///
@ -478,6 +508,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
self.adjust_for_table_text_align();
self.adjust_for_contain();
self.adjust_for_mathvariant();
self.adjust_for_justify_items();
}
#[cfg(feature = "servo")]
{