style: Move the RELEVANT_LINK_VISITED flag to servo.

And kill one GetParentAllowServo call while at it, and some other dumbness...

Bug: 1383307
Reviewed-by: Manishearth
This commit is contained in:
Emilio Cobos Álvarez 2017-07-23 04:50:08 +02:00
parent d0561e76df
commit 4e0492c5d1
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 64 additions and 8 deletions

View file

@ -33,5 +33,9 @@ bitflags! {
///
/// This is used from Gecko's layout engine.
const IS_TEXT_COMBINED = 1 << 2,
/// A flag used to mark styles under a relevant link that is also
/// visited.
const IS_RELEVANT_LINK_VISITED = 1 << 3,
}
}

View file

@ -2650,6 +2650,11 @@ impl<'a> StyleBuilder<'a> {
)
}
/// Returns whether we have a visited style.
pub fn has_visited_style(&self) -> bool {
self.visited_style.is_some()
}
/// Returns the style we're inheriting from.
pub fn inherited_style(&self) -> &'a ComputedValues {
self.inherited_style
@ -2805,14 +2810,14 @@ bitflags! {
pub flags CascadeFlags: u8 {
/// 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 = 0x01,
const INHERIT_ALL = 1,
/// Whether to skip any display style fixup for root element, flex/grid
/// item, and ruby descendants.
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 0x02,
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 1 << 1,
/// Whether to only cascade properties that are visited dependent.
const VISITED_DEPENDENT_ONLY = 0x04,
const VISITED_DEPENDENT_ONLY = 1 << 2,
/// Whether the given element we're styling is the document element,
/// that is, matches :root.
@ -2822,15 +2827,19 @@ bitflags! {
///
/// This affects some style adjustments, like blockification, and means
/// that it may affect global state, like the Device's root font-size.
const IS_ROOT_ELEMENT = 0x08,
const IS_ROOT_ELEMENT = 1 << 3,
/// Whether to convert display:contents into display:inline. This
/// is used by Gecko to prevent display:contents on generated
/// content.
const PROHIBIT_DISPLAY_CONTENTS = 0x10,
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4,
/// Whether we're styling the ::-moz-fieldset-content anonymous box.
const IS_FIELDSET_CONTENT = 0x20,
const IS_FIELDSET_CONTENT = 1 << 5,
/// Whether we're computing the style of a link element that happens to
/// be visited.
const IS_VISITED_LINK = 1 << 6,
}
}