style: Fix the legacy value of justify-items propagation.

That property is pretty sad :(

MozReview-Commit-ID: GaKYvqR19M4
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-09-04 16:12:23 +02:00
parent 825f623b3c
commit 35504c1bb7
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -386,11 +386,6 @@ trait PrivateMatchMethods: TElement {
// We need to cascade the children in order to ensure the correct
// propagation of computed value flags.
//
// FIXME(emilio): If we start optimizing changes to reset-only
// properties that aren't explicitly inherited, we'd need to add a flag
// to handle justify-items: auto correctly when there's a legacy
// justify-items.
if old_values.flags != new_values.flags {
debug!(" > flags changed: {:?} != {:?}", old_values.flags, new_values.flags);
return ChildCascadeRequirement::MustCascadeChildren;
@ -400,6 +395,37 @@ trait PrivateMatchMethods: TElement {
StyleChange::Unchanged => ChildCascadeRequirement::CanSkipCascade,
StyleChange::Changed { reset_only } => {
if reset_only {
#[cfg(feature = "gecko")]
{
use values::specified::align;
// Children with justify-items: legacy may depend on our
// property value.
//
// TODO(emilio): We could special-case this even more
// creating a new `ChildCascadeRequirement` variant, but
// it's unclear it matters.
let old_justify_items =
old_values.get_position().clone_justify_items();
let new_justify_items =
new_values.get_position().clone_justify_items();
let was_legacy_justify_items =
old_justify_items.computed.0.contains(align::ALIGN_LEGACY);
let is_legacy_justify_items =
new_justify_items.computed.0.contains(align::ALIGN_LEGACY);
if is_legacy_justify_items != was_legacy_justify_items {
return ChildCascadeRequirement::MustCascadeChildren;
}
if was_legacy_justify_items &&
old_justify_items.computed != new_justify_items.computed {
return ChildCascadeRequirement::MustCascadeChildren;
}
}
ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle
} else {
ChildCascadeRequirement::MustCascadeChildren