style: Add a style flag for the root element style.

This is needed to make the root element not a containing block in presence of
filters or what not.

Differential Revision: https://phabricator.services.mozilla.com/D61167
This commit is contained in:
Emilio Cobos Álvarez 2020-01-31 14:51:06 +00:00
parent f426b644ca
commit 16fd7cad0c
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
13 changed files with 37 additions and 46 deletions

View file

@ -11,6 +11,7 @@ bitflags! {
/// anonymous boxes, see StyleBuilder::for_inheritance and its callsites.
/// If we ever want to add some flags that shouldn't inherit for them,
/// we might want to add a function to handle this.
#[repr(C)]
pub struct ComputedValueFlags: u16 {
/// Whether the style or any of the ancestors has a text-decoration-line
/// property that should get propagated to descendants.
@ -63,6 +64,9 @@ bitflags! {
///
/// Only used in Servo.
const CAN_BE_FRAGMENTED = 1 << 10;
/// Whether this style is the style of the document element.
const IS_ROOT_ELEMENT_STYLE = 1 << 11;
}
}
@ -97,22 +101,3 @@ impl ComputedValueFlags {
self & Self::maybe_inherited_flags()
}
}
/// Asserts that the relevant servo and Gecko representations match.
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_match() {
use crate::gecko_bindings::structs;
macro_rules! assert_bit {
($rust:ident, $cpp:ident) => {
debug_assert_eq!(ComputedValueFlags::$rust.bits, structs::$cpp);
}
}
assert_bit!(HAS_TEXT_DECORATION_LINES, ComputedStyleBit_HasTextDecorationLines);
assert_bit!(IS_IN_PSEUDO_ELEMENT_SUBTREE, ComputedStyleBit_HasPseudoElementData);
assert_bit!(SHOULD_SUPPRESS_LINEBREAK, ComputedStyleBit_SuppressLineBreak);
assert_bit!(IS_TEXT_COMBINED, ComputedStyleBit_IsTextCombined);
assert_bit!(IS_RELEVANT_LINK_VISITED, ComputedStyleBit_RelevantLinkVisited);
assert_bit!(DEPENDS_ON_FONT_METRICS, ComputedStyleBit_DependsOnFontMetrics);
}