mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Deindent some code in matching.rs
This commit is contained in:
parent
3e1ae65e43
commit
3bfe529728
1 changed files with 66 additions and 64 deletions
|
@ -352,78 +352,80 @@ trait PrivateMatchMethods: TElement {
|
|||
}
|
||||
|
||||
match difference.change {
|
||||
StyleChange::Unchanged => ChildCascadeRequirement::CanSkipCascade,
|
||||
StyleChange::Unchanged => {
|
||||
return ChildCascadeRequirement::CanSkipCascade
|
||||
},
|
||||
StyleChange::Changed { reset_only } => {
|
||||
// If inherited properties changed, the best we can do is
|
||||
// cascade the children.
|
||||
if !reset_only {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
|
||||
let old_display = old_values.get_box().clone_display();
|
||||
let new_display = new_values.get_box().clone_display();
|
||||
|
||||
// If we used to be a display: none element, and no longer are,
|
||||
// our children need to be restyled because they're unstyled.
|
||||
//
|
||||
// NOTE(emilio): Gecko has the special-case of -moz-binding, but
|
||||
// that gets handled on the frame constructor when processing
|
||||
// the reframe, so no need to handle that here.
|
||||
if old_display == display::T::none && old_display != new_display {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
|
||||
// Blockification of children may depend on our display value,
|
||||
// so we need to actually do the recascade. We could potentially
|
||||
// do better, but it doesn't seem worth it.
|
||||
if old_display.is_item_container() != new_display.is_item_container() {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
|
||||
// Line break suppression may also be affected if the display
|
||||
// type changes from ruby to non-ruby.
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
if old_display.is_ruby_type() != new_display.is_ruby_type() {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
}
|
||||
|
||||
// Children with justify-items: auto may depend on our
|
||||
// justify-items property value.
|
||||
//
|
||||
// Similarly, we could potentially do better, but this really
|
||||
// seems not common enough to care about.
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
use values::specified::align::AlignFlags;
|
||||
|
||||
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(AlignFlags::LEGACY);
|
||||
|
||||
let is_legacy_justify_items =
|
||||
new_justify_items.computed.0.contains(AlignFlags::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;
|
||||
}
|
||||
}
|
||||
|
||||
// We could prove that, if our children don't inherit reset
|
||||
// properties, we can stop the cascade.
|
||||
ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle
|
||||
}
|
||||
}
|
||||
|
||||
let old_display = old_values.get_box().clone_display();
|
||||
let new_display = new_values.get_box().clone_display();
|
||||
|
||||
// If we used to be a display: none element, and no longer are,
|
||||
// our children need to be restyled because they're unstyled.
|
||||
//
|
||||
// NOTE(emilio): Gecko has the special-case of -moz-binding, but
|
||||
// that gets handled on the frame constructor when processing
|
||||
// the reframe, so no need to handle that here.
|
||||
if old_display == display::T::none && old_display != new_display {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
|
||||
// Blockification of children may depend on our display value,
|
||||
// so we need to actually do the recascade. We could potentially
|
||||
// do better, but it doesn't seem worth it.
|
||||
if old_display.is_item_container() != new_display.is_item_container() {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
|
||||
// Line break suppression may also be affected if the display
|
||||
// type changes from ruby to non-ruby.
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
if old_display.is_ruby_type() != new_display.is_ruby_type() {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
}
|
||||
|
||||
// Children with justify-items: auto may depend on our
|
||||
// justify-items property value.
|
||||
//
|
||||
// Similarly, we could potentially do better, but this really
|
||||
// seems not common enough to care about.
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
use values::specified::align::AlignFlags;
|
||||
|
||||
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(AlignFlags::LEGACY);
|
||||
|
||||
let is_legacy_justify_items =
|
||||
new_justify_items.computed.0.contains(AlignFlags::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;
|
||||
}
|
||||
}
|
||||
|
||||
// We could prove that, if our children don't inherit reset
|
||||
// properties, we can stop the cascade.
|
||||
ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue