Adjust display value for ;-moz-fieldset-content when parent is flex\grid. r?emilio
draft
Adjust display value for ;-moz-fieldset-content when parent is flex\grid. r?emilio
MozReview-Commit-ID: 7r2OaUZbQdg
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -8,17 +8,17 @@
<% data.new_style_struct("Box",
inherited=False,
gecko_name="Display") %>
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
<%helpers:longhand name="display"
need_clone="True"
animation_value_type="discrete"
- custom_cascade="${product == 'servo'}"
+ custom_cascade="True"
spec="https://drafts.csswg.org/css-display/#propdef-display">
<%
values = """inline block inline-block
table inline-table table-row-group table-header-group table-footer-group
table-row table-column-group table-column table-cell table-caption
list-item none
""".split()
webkit_prefixed_values = "flex inline-flex".split()
@@ -136,16 +136,40 @@
fn cascade_property_custom(_declaration: &PropertyDeclaration,
_inherited_style: &ComputedValues,
context: &mut computed::Context,
_cacheable: &mut bool) {
longhands::_servo_display_for_hypothetical_box::derive_from_display(context);
longhands::_servo_text_decorations_in_effect::derive_from_display(context);
longhands::_servo_under_display_none::derive_from_display(context);
}
+ % else:
+ fn cascade_property_custom(_declaration: &PropertyDeclaration,
+ inherited_style: &ComputedValues,
+ context: &mut computed::Context,
+ cacheable: &mut bool) {
+ use self::computed_value::T;
+ if let Some(pseudo) = context.pseudo {
+ use selector_parser::PseudoElement;
+ // Inherit a <fieldset> grid/flex display type into its
+ // anonymous content box.
+ if *pseudo == PseudoElement::FieldsetContent {
+ let parent_display = inherited_style.get_box().clone_display();
+ let new_display = match parent_display {
+ T::grid | T::inline_grid => Some(T::grid),
+ T::flex | T::inline_flex => Some(T::flex),
+ _ => None,
+ };
+ if let Some(new_display) = new_display {
+ context.mutate_style().mutate_box().set_display(new_display);
+ *cacheable = false;
+ }
+ }
+ }
+ }
% endif
${helpers.gecko_keyword_conversion(Keyword('display', ' '.join(values),
gecko_enum_prefix='StyleDisplay',
gecko_strip_moz_prefix=False))}
</%helpers:longhand>