mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Adjust display value for ::-moz-fieldset-content when parent is flex/grid.
This commit is contained in:
parent
d746abaa9e
commit
bae59d4520
4 changed files with 44 additions and 4 deletions
|
@ -83,6 +83,12 @@ impl PseudoElement {
|
||||||
*self == PseudoElement::FirstLetter
|
*self == PseudoElement::FirstLetter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether this pseudo-element is ::-moz-fieldset-content.
|
||||||
|
#[inline]
|
||||||
|
pub fn is_fieldset_content(&self) -> bool {
|
||||||
|
*self == PseudoElement::FieldsetContent
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether this pseudo-element is lazily-cascaded.
|
/// Whether this pseudo-element is lazily-cascaded.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_lazy(&self) -> bool {
|
pub fn is_lazy(&self) -> bool {
|
||||||
|
|
|
@ -2668,6 +2668,9 @@ bitflags! {
|
||||||
/// is used by Gecko to prevent display:contents on generated
|
/// is used by Gecko to prevent display:contents on generated
|
||||||
/// content.
|
/// content.
|
||||||
const PROHIBIT_DISPLAY_CONTENTS = 0x10,
|
const PROHIBIT_DISPLAY_CONTENTS = 0x10,
|
||||||
|
|
||||||
|
/// Whether we're styling the ::-moz-fieldset-content anonymous box.
|
||||||
|
const IS_FIELDSET_CONTENT = 0x20,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,6 +291,31 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
self.style.mutate_box().set_display(display::inline);
|
self.style.mutate_box().set_display(display::inline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// If a <fieldset> has grid/flex display type, we need to inherit
|
||||||
|
/// this type into its ::-moz-fieldset-content anonymous box.
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
fn adjust_for_fieldset_content(&mut self,
|
||||||
|
layout_parent_style: &ComputedValuesInner,
|
||||||
|
flags: CascadeFlags) {
|
||||||
|
use properties::IS_FIELDSET_CONTENT;
|
||||||
|
if !flags.contains(IS_FIELDSET_CONTENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
debug_assert_eq!(self.style.get_box().clone_display(), display::block);
|
||||||
|
// TODO We actually want style from parent rather than layout
|
||||||
|
// parent, so that this fixup doesn't happen incorrectly when
|
||||||
|
// when <fieldset> has "display: contents".
|
||||||
|
let parent_display = layout_parent_style.get_box().clone_display();
|
||||||
|
let new_display = match parent_display {
|
||||||
|
display::flex | display::inline_flex => Some(display::flex),
|
||||||
|
display::grid | display::inline_grid => Some(display::grid),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
if let Some(new_display) = new_display {
|
||||||
|
self.style.mutate_box().set_display(new_display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// -moz-center, -moz-left and -moz-right are used for HTML's alignment.
|
/// -moz-center, -moz-left and -moz-right are used for HTML's alignment.
|
||||||
///
|
///
|
||||||
/// This is covering the <div align="right"><table>...</table></div> case.
|
/// This is covering the <div align="right"><table>...</table></div> case.
|
||||||
|
@ -412,6 +437,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_top_layer();
|
self.adjust_for_top_layer();
|
||||||
self.blockify_if_necessary(layout_parent_style, flags);
|
self.blockify_if_necessary(layout_parent_style, flags);
|
||||||
|
|
|
@ -91,9 +91,11 @@ use style::invalidation::element::restyle_hints::{self, RestyleHint};
|
||||||
use style::media_queries::{MediaList, parse_media_query_list};
|
use style::media_queries::{MediaList, parse_media_query_list};
|
||||||
use style::parallel;
|
use style::parallel;
|
||||||
use style::parser::ParserContext;
|
use style::parser::ParserContext;
|
||||||
use style::properties::{ComputedValues, ComputedValuesInner, Importance, SourcePropertyDeclaration};
|
use style::properties::{ComputedValues, ComputedValuesInner, Importance};
|
||||||
use style::properties::{LonghandIdSet, PropertyDeclaration, PropertyDeclarationBlock, PropertyId, StyleBuilder};
|
use style::properties::{IS_FIELDSET_CONTENT, LonghandIdSet};
|
||||||
use style::properties::{SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, PseudoInfo, ParentStyleContextInfo};
|
use style::properties::{ParentStyleContextInfo, PseudoInfo};
|
||||||
|
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
|
||||||
|
use style::properties::{SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, SourcePropertyDeclaration, StyleBuilder};
|
||||||
use style::properties::animated_properties::{Animatable, AnimatableLonghand, AnimationValue};
|
use style::properties::animated_properties::{Animatable, AnimatableLonghand, AnimationValue};
|
||||||
use style::properties::parse_one_declaration_into;
|
use style::properties::parse_one_declaration_into;
|
||||||
use style::rule_tree::StyleSource;
|
use style::rule_tree::StyleSource;
|
||||||
|
@ -1514,7 +1516,10 @@ 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 cascade_flags = SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
let mut cascade_flags = SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||||
|
if pseudo.is_fieldset_content() {
|
||||||
|
cascade_flags.insert(IS_FIELDSET_CONTENT);
|
||||||
|
}
|
||||||
let metrics = get_metrics_provider_for_product();
|
let metrics = get_metrics_provider_for_product();
|
||||||
data.stylist.precomputed_values_for_pseudo(&guards, &pseudo, parent_style_or_null.map(|x| &**x),
|
data.stylist.precomputed_values_for_pseudo(&guards, &pseudo, parent_style_or_null.map(|x| &**x),
|
||||||
cascade_flags, &metrics,
|
cascade_flags, &metrics,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue