mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #19662 - emilio:simplify-prohibit-display-contents, r=upsuper
style: Simplify "prohibit display: contents" adjustment. On top of #19661. The NAC condition is pointless because NAC don't match author rules unless they are a pseudo-element too. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19662) <!-- Reviewable:end -->
This commit is contained in:
commit
ebff37b807
4 changed files with 13 additions and 24 deletions
|
@ -3079,18 +3079,13 @@ bitflags! {
|
||||||
/// that it may affect global state, like the Device's root font-size.
|
/// that it may affect global state, like the Device's root font-size.
|
||||||
const IS_ROOT_ELEMENT = 1 << 3;
|
const IS_ROOT_ELEMENT = 1 << 3;
|
||||||
|
|
||||||
/// Whether to convert display:contents into display:inline. This
|
|
||||||
/// is used by Gecko to prevent display:contents on generated
|
|
||||||
/// content.
|
|
||||||
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4;
|
|
||||||
|
|
||||||
/// 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 << 4;
|
||||||
|
|
||||||
/// Whether we're computing the style of a link element that happens to
|
/// Whether we're computing the style of a link element that happens to
|
||||||
/// be visited.
|
/// be visited.
|
||||||
const IS_VISITED_LINK = 1 << 7;
|
const IS_VISITED_LINK = 1 << 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,12 +320,13 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
|
|
||||||
/// Native anonymous content converts display:contents into display:inline.
|
/// Native anonymous content converts display:contents into display:inline.
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
fn adjust_for_prohibited_display_contents(&mut self, flags: CascadeFlags) {
|
fn adjust_for_prohibited_display_contents(&mut self) {
|
||||||
use properties::CascadeFlags;
|
|
||||||
|
|
||||||
// TODO: We should probably convert display:contents into display:none
|
// TODO: We should probably convert display:contents into display:none
|
||||||
// in some cases too: https://drafts.csswg.org/css-display/#unbox
|
// in some cases too: https://drafts.csswg.org/css-display/#unbox
|
||||||
if !flags.contains(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS) ||
|
//
|
||||||
|
// FIXME(emilio): ::before and ::after should support display: contents,
|
||||||
|
// see bug 1418138.
|
||||||
|
if self.style.pseudo.is_none() ||
|
||||||
self.style.get_box().clone_display() != Display::Contents {
|
self.style.get_box().clone_display() != Display::Contents {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +570,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
self.adjust_for_visited(flags);
|
self.adjust_for_visited(flags);
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
{
|
{
|
||||||
self.adjust_for_prohibited_display_contents(flags);
|
self.adjust_for_prohibited_display_contents();
|
||||||
self.adjust_for_fieldset_content(layout_parent_style);
|
self.adjust_for_fieldset_content(layout_parent_style);
|
||||||
}
|
}
|
||||||
self.adjust_for_top_layer();
|
self.adjust_for_top_layer();
|
||||||
|
|
|
@ -566,9 +566,10 @@ where
|
||||||
}
|
}
|
||||||
cascade_flags.insert(CascadeFlags::VISITED_DEPENDENT_ONLY);
|
cascade_flags.insert(CascadeFlags::VISITED_DEPENDENT_ONLY);
|
||||||
}
|
}
|
||||||
if self.element.is_native_anonymous() || pseudo.is_some() {
|
if !self.element.is_native_anonymous() &&
|
||||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
pseudo.is_none() &&
|
||||||
} else if self.element.is_root() {
|
self.element.is_root()
|
||||||
|
{
|
||||||
cascade_flags.insert(CascadeFlags::IS_ROOT_ELEMENT);
|
cascade_flags.insert(CascadeFlags::IS_ROOT_ELEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3626,18 +3626,10 @@ pub extern "C" fn Servo_ReparentStyle(
|
||||||
if let Some(element) = element {
|
if let Some(element) = element {
|
||||||
if element.is_link() {
|
if element.is_link() {
|
||||||
cascade_flags.insert(CascadeFlags::IS_LINK);
|
cascade_flags.insert(CascadeFlags::IS_LINK);
|
||||||
if element.is_visited_link() &&
|
if element.is_visited_link() && doc_data.visited_styles_enabled() {
|
||||||
doc_data.visited_styles_enabled() {
|
|
||||||
cascade_flags.insert(CascadeFlags::IS_VISITED_LINK);
|
cascade_flags.insert(CascadeFlags::IS_VISITED_LINK);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if element.is_native_anonymous() {
|
|
||||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if pseudo.is_some() {
|
|
||||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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