mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Simplify ::-moz-fieldset-content special-casing.
The style adjuster knows about the pseudo, so there's no reason to thread that info down. There are more simplifications that can be done in followups, cleaning a bit the cascade flags too, those will come later.
This commit is contained in:
parent
446536b9c3
commit
563da3a19c
3 changed files with 7 additions and 16 deletions
|
@ -3084,9 +3084,6 @@ bitflags! {
|
||||||
/// content.
|
/// content.
|
||||||
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4;
|
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4;
|
||||||
|
|
||||||
/// Whether we're styling the ::-moz-fieldset-content anonymous box.
|
|
||||||
const IS_FIELDSET_CONTENT = 1 << 5;
|
|
||||||
|
|
||||||
/// Whether we're computing the style of a link, either visited or
|
/// Whether we're computing the style of a link, either visited or
|
||||||
/// unvisited.
|
/// unvisited.
|
||||||
const IS_LINK = 1 << 6;
|
const IS_LINK = 1 << 6;
|
||||||
|
|
|
@ -343,12 +343,12 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
fn adjust_for_fieldset_content(
|
fn adjust_for_fieldset_content(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout_parent_style: &ComputedValues,
|
layout_parent_style: &ComputedValues,
|
||||||
flags: CascadeFlags,
|
|
||||||
) {
|
) {
|
||||||
use properties::CascadeFlags;
|
match self.style.pseudo {
|
||||||
if !flags.contains(CascadeFlags::IS_FIELDSET_CONTENT) {
|
Some(ref p) if p.is_fieldset_content() => {},
|
||||||
return;
|
_ => return,
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_assert_eq!(self.style.get_box().clone_display(), Display::Block);
|
debug_assert_eq!(self.style.get_box().clone_display(), Display::Block);
|
||||||
// TODO We actually want style from parent rather than layout
|
// TODO We actually want style from parent rather than layout
|
||||||
// parent, so that this fixup doesn't happen incorrectly when
|
// parent, so that this fixup doesn't happen incorrectly when
|
||||||
|
@ -570,7 +570,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
{
|
{
|
||||||
self.adjust_for_prohibited_display_contents(flags);
|
self.adjust_for_prohibited_display_contents(flags);
|
||||||
self.adjust_for_fieldset_content(layout_parent_style, flags);
|
self.adjust_for_fieldset_content(layout_parent_style);
|
||||||
}
|
}
|
||||||
self.adjust_for_top_layer();
|
self.adjust_for_top_layer();
|
||||||
self.blockify_if_necessary(layout_parent_style, flags);
|
self.blockify_if_necessary(layout_parent_style, flags);
|
||||||
|
|
|
@ -1987,10 +1987,6 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||||
let pseudo = PseudoElement::from_anon_box_atom(&atom)
|
let pseudo = PseudoElement::from_anon_box_atom(&atom)
|
||||||
.expect("Not an anon box pseudo?");
|
.expect("Not an anon box pseudo?");
|
||||||
|
|
||||||
let mut cascade_flags = CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
|
||||||
if pseudo.is_fieldset_content() {
|
|
||||||
cascade_flags.insert(CascadeFlags::IS_FIELDSET_CONTENT);
|
|
||||||
}
|
|
||||||
let metrics = get_metrics_provider_for_product();
|
let metrics = get_metrics_provider_for_product();
|
||||||
|
|
||||||
// If the pseudo element is PageContent, we should append the precomputed
|
// If the pseudo element is PageContent, we should append the precomputed
|
||||||
|
@ -2023,6 +2019,7 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||||
page_decls,
|
page_decls,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let cascade_flags = CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||||
data.stylist.precomputed_values_for_pseudo_with_rule_node(
|
data.stylist.precomputed_values_for_pseudo_with_rule_node(
|
||||||
&guards,
|
&guards,
|
||||||
&pseudo,
|
&pseudo,
|
||||||
|
@ -3639,11 +3636,8 @@ pub extern "C" fn Servo_ReparentStyle(
|
||||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(pseudo) = pseudo.as_ref() {
|
if pseudo.is_some() {
|
||||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
||||||
if pseudo.is_fieldset_content() {
|
|
||||||
cascade_flags.insert(CascadeFlags::IS_FIELDSET_CONTENT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_data.stylist.compute_style_with_inputs(
|
doc_data.stylist.compute_style_with_inputs(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue