style: Simplify the skip item based display fixup adjustment.

In practice the only NAC that possibly inherits from a grid or flex container
are pseudos.

In Gecko, if the root element is an item container, custom anon content would
also sometimes incorrectly inherit from that (see bug 1405635), but that's fixed
in Stylo.

We remove the IS_ROOT_ELEMENT blockification from the "skip display fixup"
check, since the root element is never NAC or anything like that, so there's no
need for the check.

This also fixes some reparenting fishiness related to pseudo-elements. We were
only skipping the fixup when reparenting anon boxes, not when reparenting normal
element styles, nor when reparenting other pseudo styles which are not anon
boxes.
This commit is contained in:
Emilio Cobos Álvarez 2017-12-31 12:53:21 +01:00
parent ebff37b807
commit e464f5b020
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 29 additions and 49 deletions

View file

@ -3060,14 +3060,10 @@ bitflags! {
pub struct CascadeFlags: u8 {
/// Whether to inherit all styles from the parent. If this flag is not
/// present, non-inherited styles are reset to their initial values.
const INHERIT_ALL = 1;
/// Whether to skip any display style fixup for root element, flex/grid
/// item, and ruby descendants.
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 1 << 1;
const INHERIT_ALL = 1 << 0;
/// Whether to only cascade properties that are visited dependent.
const VISITED_DEPENDENT_ONLY = 1 << 2;
const VISITED_DEPENDENT_ONLY = 1 << 1;
/// Whether the given element we're styling is the document element,
/// that is, matches :root.
@ -3077,15 +3073,15 @@ bitflags! {
///
/// This affects some style adjustments, like blockification, and means
/// that it may affect global state, like the Device's root font-size.
const IS_ROOT_ELEMENT = 1 << 3;
const IS_ROOT_ELEMENT = 1 << 2;
/// Whether we're computing the style of a link, either visited or
/// unvisited.
const IS_LINK = 1 << 4;
const IS_LINK = 1 << 3;
/// Whether we're computing the style of a link element that happens to
/// be visited.
const IS_VISITED_LINK = 1 << 5;
const IS_VISITED_LINK = 1 << 4;
}
}