style: In css 'display' blockification codepath, leave -moz-box alone and promote -moz-inline-box to -moz-box (if a new pref is set).

This is in the interests of allowing the frontend team to experiment with
switching from XUL grid to CSS grid, without inadvertently changing the
display values for the grid items via css-grid-item blockification.

This patch's new pref is not expected to remain in the codebase for long.
We're just adding it so that the behavior remains the same by default, because
we do currently have some XUL code that inadvertently depends on -moz-box
display values being blockified to 'block'.  The plan is for folks to remove
that dependency e.g. by adding explicit 'display:block' styling to frontend
code as-needed. After we've done that, we can tentatively flip the pref to true
by default, and then remove the pref entirely.

Differential Revision: https://phabricator.services.mozilla.com/D45258
This commit is contained in:
Daniel Holbert 2019-09-19 03:58:53 +00:00 committed by Emilio Cobos Álvarez
parent 0138fc3707
commit fee0f2cd23

View file

@ -393,6 +393,20 @@ impl Display {
};
Display::from3(DisplayOutside::Block, inside, self.is_list_item())
},
// If this pref is true, then we'll blockify "-moz-inline-box" to
// "-moz-box", and blockify "-moz-box" to itself. Otherwise, we
// blockify both to "block".
#[cfg(feature = "gecko")]
DisplayOutside::XUL => {
if static_prefs::pref!("layout.css.xul-box-display-values.survive-blockification.enabled") {
match self.inside() {
DisplayInside::MozInlineBox | DisplayInside::MozBox => Display::MozBox,
_ => Display::Block,
}
} else {
Display::Block
}
},
DisplayOutside::Block | DisplayOutside::None => *self,
#[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
_ => Display::Block,