Struct style::stylist::Stylist
[−]
[src]
pub struct Stylist { /* fields omitted */ }
This structure holds all the selectors and device characteristics
for a given document. The selectors are converted into Rule
s
and sorted into SelectorMap
s keyed off stylesheet origin and
pseudo-element (see CascadeData
).
This structure is effectively created once per pipeline, in the LayoutThread corresponding to that pipeline.
Methods
impl Stylist
[src]
pub fn new(device: Device, quirks_mode: QuirksMode) -> Self
[src]
Construct a new Stylist
, using given Device
and QuirksMode
.
If more members are added here, think about whether they should
be reset in clear().
ⓘImportant traits for ExtraStyleDataIterator<'a>pub fn iter_extra_data_origins(&self) -> ExtraStyleDataIterator
[src]
Iterate over the extra data in origin order.
ⓘImportant traits for ExtraStyleDataIterator<'a>pub fn iter_extra_data_origins_rev(&self) -> ExtraStyleDataIterator
[src]
Iterate over the extra data in reverse origin order.
pub fn num_selectors(&self) -> usize
[src]
Returns the number of selectors.
pub fn num_declarations(&self) -> usize
[src]
Returns the number of declarations.
pub fn num_rebuilds(&self) -> usize
[src]
Returns the number of times the stylist has been rebuilt.
pub fn num_revalidation_selectors(&self) -> usize
[src]
Returns the number of revalidation_selectors.
pub fn num_invalidations(&self) -> usize
[src]
Returns the number of entries in invalidation maps.
pub fn each_invalidation_map<'a, F>(&'a self, f: F) where
F: FnMut(&'a InvalidationMap, Origin),
[src]
F: FnMut(&'a InvalidationMap, Origin),
Invokes f
with the InvalidationMap
for each origin.
NOTE(heycam) This might be better as an iter_invalidation_maps
, once
we have impl trait
and can return that easily without bothering to
create a whole new iterator type.
pub fn flush<E>(
&mut self,
guards: &StylesheetGuards,
document_element: Option<E>
) -> bool where
E: TElement,
[src]
&mut self,
guards: &StylesheetGuards,
document_element: Option<E>
) -> bool where
E: TElement,
Flush the list of stylesheets if they changed, ensuring the stylist is up-to-date.
pub fn insert_stylesheet_before(
&mut self,
sheet: StylistSheet,
before_sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
[src]
&mut self,
sheet: StylistSheet,
before_sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
Insert a given stylesheet before another stylesheet in the document.
pub fn force_stylesheet_origins_dirty(&mut self, origins: OriginSet)
[src]
Marks a given stylesheet origin as dirty, due to, for example, changes in the declarations that affect a given rule.
FIXME(emilio): Eventually it'd be nice for this to become more fine-grained.
[src]
Sets whether author style is enabled or not.
pub fn stylesheets_have_changed(&self) -> bool
[src]
Returns whether we've recorded any stylesheet change so far.
pub fn append_stylesheet(
&mut self,
sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
[src]
&mut self,
sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
Appends a new stylesheet to the current set.
pub fn prepend_stylesheet(
&mut self,
sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
[src]
&mut self,
sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
Appends a new stylesheet to the current set.
pub fn remove_stylesheet(
&mut self,
sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
[src]
&mut self,
sheet: StylistSheet,
guard: &SharedRwLockReadGuard
)
Remove a given stylesheet to the current set.
pub fn might_have_attribute_dependency(&self, local_name: &LocalName) -> bool
[src]
Returns whether the given attribute might appear in an attribute selector of some rule in the stylist.
pub fn has_state_dependency(&self, state: ElementState) -> bool
[src]
Returns whether the given ElementState bit is relied upon by a selector of some rule in the stylist.
pub fn has_document_state_dependency(&self, state: DocumentState) -> bool
[src]
Returns whether the given DocumentState bit is relied upon by a selector of some rule in the stylist.
pub fn precomputed_values_for_pseudo(
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
parent: Option<&ComputedValues>,
cascade_flags: CascadeFlags,
font_metrics: &FontMetricsProvider
) -> Arc<ComputedValues>
[src]
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
parent: Option<&ComputedValues>,
cascade_flags: CascadeFlags,
font_metrics: &FontMetricsProvider
) -> Arc<ComputedValues>
Computes the style for a given "precomputed" pseudo-element, taking the universal rules and applying them.
If inherit_all
is true, then all properties are inherited from the
parent; otherwise, non-inherited properties are reset to their initial
values. The flow constructor uses this flag when constructing anonymous
flows.
pub fn precomputed_values_for_pseudo_with_rule_node(
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
parent: Option<&ComputedValues>,
cascade_flags: CascadeFlags,
font_metrics: &FontMetricsProvider,
rule_node: StrongRuleNode
) -> Arc<ComputedValues>
[src]
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
parent: Option<&ComputedValues>,
cascade_flags: CascadeFlags,
font_metrics: &FontMetricsProvider,
rule_node: StrongRuleNode
) -> Arc<ComputedValues>
Computes the style for a given "precomputed" pseudo-element with given rule node.
pub fn rule_node_for_precomputed_pseudo(
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
extra_declarations: Option<Vec<ApplicableDeclarationBlock>>
) -> StrongRuleNode
[src]
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
extra_declarations: Option<Vec<ApplicableDeclarationBlock>>
) -> StrongRuleNode
Returns the rule node for given precomputed pseudo-element.
If we want to include extra declarations to this precomputed pseudo-element, we can provide a vector of ApplicableDeclarationBlock to extra_declarations argument. This is useful for providing extra @page rules.
pub fn style_for_anonymous(
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
parent_style: &ComputedValues
) -> Arc<ComputedValues>
[src]
&self,
guards: &StylesheetGuards,
pseudo: &PseudoElement,
parent_style: &ComputedValues
) -> Arc<ComputedValues>
Returns the style for an anonymous box of the given type.
pub fn lazily_compute_pseudo_element_style<E>(
&self,
guards: &StylesheetGuards,
element: &E,
pseudo: &PseudoElement,
rule_inclusion: RuleInclusion,
parent_style: &ComputedValues,
is_probe: bool,
font_metrics: &FontMetricsProvider,
matching_fn: Option<&Fn(&PseudoElement) -> bool>
) -> Option<Arc<ComputedValues>> where
E: TElement,
[src]
&self,
guards: &StylesheetGuards,
element: &E,
pseudo: &PseudoElement,
rule_inclusion: RuleInclusion,
parent_style: &ComputedValues,
is_probe: bool,
font_metrics: &FontMetricsProvider,
matching_fn: Option<&Fn(&PseudoElement) -> bool>
) -> Option<Arc<ComputedValues>> where
E: TElement,
Computes a pseudo-element style lazily during layout.
This can only be done for a certain set of pseudo-elements, like :selection.
Check the documentation on lazy pseudo-elements in docs/components/style.md
pub fn compute_pseudo_element_style_with_inputs(
&self,
inputs: &CascadeInputs,
pseudo: &PseudoElement,
guards: &StylesheetGuards,
parent_style: Option<&ComputedValues>,
font_metrics: &FontMetricsProvider,
cascade_flags: CascadeFlags
) -> Option<Arc<ComputedValues>>
[src]
&self,
inputs: &CascadeInputs,
pseudo: &PseudoElement,
guards: &StylesheetGuards,
parent_style: Option<&ComputedValues>,
font_metrics: &FontMetricsProvider,
cascade_flags: CascadeFlags
) -> Option<Arc<ComputedValues>>
Computes a pseudo-element style lazily using the given CascadeInputs. This can be used for truly lazy pseudo-elements or to avoid redoing selector matching for eager pseudo-elements when we need to recompute their style with a new parent style.
pub fn compute_style_with_inputs(
&self,
inputs: &CascadeInputs,
pseudo: Option<&PseudoElement>,
guards: &StylesheetGuards,
parent_style: Option<&ComputedValues>,
parent_style_ignoring_first_line: Option<&ComputedValues>,
layout_parent_style: Option<&ComputedValues>,
font_metrics: &FontMetricsProvider,
cascade_flags: CascadeFlags
) -> Arc<ComputedValues>
[src]
&self,
inputs: &CascadeInputs,
pseudo: Option<&PseudoElement>,
guards: &StylesheetGuards,
parent_style: Option<&ComputedValues>,
parent_style_ignoring_first_line: Option<&ComputedValues>,
layout_parent_style: Option<&ComputedValues>,
font_metrics: &FontMetricsProvider,
cascade_flags: CascadeFlags
) -> Arc<ComputedValues>
Computes a style using the given CascadeInputs. This can be used to compute a style any time we know what rules apply and just need to use the given parent styles.
parent_style is the style to inherit from for properties affected by first-line ancestors.
parent_style_ignoring_first_line is the style to inherit from for properties not affected by first-line ancestors.
layout_parent_style is the style used for some property fixups. It's the style of the nearest ancestor with a layout box.
is_link should be true if we're computing style for a link; that affects how :visited handling is done.
pub fn set_device(
&mut self,
device: Device,
guards: &StylesheetGuards
) -> OriginSet
[src]
&mut self,
device: Device,
guards: &StylesheetGuards
) -> OriginSet
Set a given device, which may change the styles that apply to the document.
Returns the sheet origins that were actually affected.
This means that we may need to rebuild style data even if the stylesheets haven't changed.
Also, the device that arrives here may need to take the viewport rules into account.
For Gecko, this is called when XBL bindings are used by different documents.
pub fn media_features_change_changed_style(
&self,
guards: &StylesheetGuards
) -> OriginSet
[src]
&self,
guards: &StylesheetGuards
) -> OriginSet
Returns whether, given a media feature change, any previously-applicable style has become non-applicable, or vice-versa for each origin.
pub fn viewport_constraints(&self) -> Option<&ViewportConstraints>
[src]
Returns the viewport constraints that apply to this document because of a @viewport rule.
pub fn quirks_mode(&self) -> QuirksMode
[src]
Returns the Quirks Mode of the document.
pub fn set_quirks_mode(&mut self, quirks_mode: QuirksMode)
[src]
Sets the quirks mode of the document.
pub fn push_applicable_declarations<E, F>(
&self,
element: &E,
pseudo_element: Option<&PseudoElement>,
style_attribute: Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>,
smil_override: Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>,
animation_rules: AnimationRules,
rule_inclusion: RuleInclusion,
applicable_declarations: &mut ApplicableDeclarationList,
context: &mut MatchingContext<E::Impl>,
flags_setter: &mut F
) where
E: TElement,
F: FnMut(&E, ElementSelectorFlags),
[src]
&self,
element: &E,
pseudo_element: Option<&PseudoElement>,
style_attribute: Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>,
smil_override: Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>,
animation_rules: AnimationRules,
rule_inclusion: RuleInclusion,
applicable_declarations: &mut ApplicableDeclarationList,
context: &mut MatchingContext<E::Impl>,
flags_setter: &mut F
) where
E: TElement,
F: FnMut(&E, ElementSelectorFlags),
Returns the applicable CSS declarations for the given element.
This corresponds to ElementRuleCollector
in WebKit.
pub fn may_have_rules_for_id<E>(&self, id: &Atom, element: E) -> bool where
E: TElement,
[src]
E: TElement,
Given an id, returns whether there might be any rules for that id in any of our rule maps.
pub fn get_animation(&self, name: &Atom) -> Option<&KeyframesAnimation>
[src]
Returns the registered @keyframes
animation for the specified name.
pub fn match_revalidation_selectors<E, F>(
&self,
element: E,
bloom: Option<&BloomFilter>,
nth_index_cache: &mut NthIndexCache,
flags_setter: &mut F
) -> SmallBitVec where
E: TElement,
F: FnMut(&E, ElementSelectorFlags),
[src]
&self,
element: E,
bloom: Option<&BloomFilter>,
nth_index_cache: &mut NthIndexCache,
flags_setter: &mut F
) -> SmallBitVec where
E: TElement,
F: FnMut(&E, ElementSelectorFlags),
Computes the match results of a given element against the set of revalidation selectors.
pub fn compute_for_declarations(
&self,
guards: &StylesheetGuards,
parent_style: &ComputedValues,
declarations: Arc<Locked<PropertyDeclarationBlock>>
) -> Arc<ComputedValues>
[src]
&self,
guards: &StylesheetGuards,
parent_style: &ComputedValues,
declarations: Arc<Locked<PropertyDeclarationBlock>>
) -> Arc<ComputedValues>
Computes styles for a given declaration with parent_style.
pub fn device(&self) -> &Device
[src]
Accessor for a shared reference to the device.
pub fn device_mut(&mut self) -> &mut Device
[src]
Accessor for a mutable reference to the device.
pub fn rule_tree(&self) -> &RuleTree
[src]
Accessor for a shared reference to the rule tree.
pub fn shutdown()
[src]
Shutdown the static data that this module stores.
Trait Implementations
impl MallocSizeOf for Stylist
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more