Skip root- and item-based display style fixup for Gecko NAC.

MozReview-Commit-ID: 6AV2UWyl6pl
This commit is contained in:
Cameron McCormack 2016-12-05 16:14:01 -10:00
parent be3f2579c4
commit 7a4a37870c
5 changed files with 31 additions and 4 deletions

View file

@ -1436,6 +1436,8 @@ bitflags! {
/// Whether to inherit all styles from the parent. If this flag is not present,
/// non-inherited styles are reset to their initial values.
const INHERIT_ALL = 0x02,
/// Whether to skip any root element and flex/grid item display style fixup.
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 0x04,
}
}
@ -1638,7 +1640,11 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
computed_values::display::T::grid |
% endif
computed_values::display::T::flex);
if positioned || floated || is_root_element || is_item {
let (blockify_root, blockify_item) = match flags.contains(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
false => (is_root_element, is_item),
true => (false, false),
};
if positioned || floated || blockify_root || blockify_item {
use computed_values::display::T;
let specified_display = style.get_box().clone_display();
@ -1653,7 +1659,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
// Special handling for contents and list-item on the root element for Gecko.
% if product == "gecko":
T::contents | T::list_item if is_root_element => Some(T::block),
T::contents | T::list_item if blockify_root => Some(T::block),
% endif
// Values that are not changed by blockification.
@ -1669,7 +1675,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
let box_ = style.mutate_box();
box_.set_display(computed_display);
% if product == "servo":
box_.set__servo_display_for_hypothetical_box(if is_root_element || is_item {
box_.set__servo_display_for_hypothetical_box(if blockify_root || blockify_item {
computed_display
} else {
specified_display