mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
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:
parent
ebff37b807
commit
e464f5b020
7 changed files with 29 additions and 49 deletions
|
@ -2019,12 +2019,11 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
|||
page_decls,
|
||||
);
|
||||
|
||||
let cascade_flags = CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
data.stylist.precomputed_values_for_pseudo_with_rule_node(
|
||||
&guards,
|
||||
&pseudo,
|
||||
parent_style_or_null.map(|x| &*x),
|
||||
cascade_flags,
|
||||
CascadeFlags::empty(),
|
||||
&metrics,
|
||||
rule_node
|
||||
).into()
|
||||
|
@ -3620,10 +3619,17 @@ pub extern "C" fn Servo_ReparentStyle(
|
|||
let element = element.map(GeckoElement);
|
||||
|
||||
let mut cascade_flags = CascadeFlags::empty();
|
||||
if style_to_reparent.is_anon_box() {
|
||||
cascade_flags.insert(CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP);
|
||||
}
|
||||
if let Some(element) = element {
|
||||
// NOTE(emilio): This relies on element.is_some() => pseudo.is_none(),
|
||||
// which the caller guarantees, fortunately. But this doesn't handle the
|
||||
// IS_ROOT_ELEMENT flag correctly!
|
||||
//
|
||||
// I think it's not possible to wrap a root element in a first-line
|
||||
// frame (and reparenting only happens for ::first-line and its
|
||||
// descendants), so this may be fine...
|
||||
//
|
||||
// We should just get rid of all these flags which pass element / pseudo
|
||||
// state.
|
||||
if element.is_link() {
|
||||
cascade_flags.insert(CascadeFlags::IS_LINK);
|
||||
if element.is_visited_link() && doc_data.visited_styles_enabled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue