mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
06e2997d28
commit
2d9255bff1
7 changed files with 163 additions and 45 deletions
|
@ -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")]
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue