Struct style::values::computed::Context
[−]
[src]
pub struct Context<'a> {
pub is_root_element: bool,
pub builder: StyleBuilder<'a>,
pub cached_system_font: Option<()>,
pub font_metrics_provider: &'a FontMetricsProvider,
pub in_media_query: bool,
pub quirks_mode: QuirksMode,
pub for_smil_animation: bool,
pub for_non_inherited_property: Option<LonghandId>,
pub rule_cache_conditions: RefCell<&'a mut RuleCacheConditions>,
}A Context is all the data a specified value could ever need to compute
itself and be transformed to a computed value.
Fields
is_root_element: bool
Whether the current element is the root element.
builder: StyleBuilder<'a>
Values accessed through this need to be in the properties "computed early": color, text-decoration, font-size, display, position, float, border-*-style, outline-style, font-family, writing-mode...
cached_system_font: Option<()>
A dummy option for servo so initializing a computed::Context isn't painful.
TODO(emilio): Make constructors for Context, and drop this.
font_metrics_provider: &'a FontMetricsProvider
A font metrics provider, used to access font metrics to implement font-relative units.
in_media_query: bool
Whether or not we are computing the media list in a media query
quirks_mode: QuirksMode
The quirks mode of this context.
for_smil_animation: bool
Whether this computation is being done for a SMIL animation.
This is used to allow certain properties to generate out-of-range values, which SMIL allows.
for_non_inherited_property: Option<LonghandId>
The property we are computing a value for, if it is a non-inherited property. None if we are computed a value for an inherited property or not computing for a property at all (e.g. in a media query evaluation).
rule_cache_conditions: RefCell<&'a mut RuleCacheConditions>
The conditions to cache a rule node on the rule cache.
FIXME(emilio): Drop the refcell.
Methods
impl<'a> Context<'a>[src]
pub fn for_media_query_evaluation<F, R>(
device: &Device,
quirks_mode: QuirksMode,
f: F
) -> R where
F: FnOnce(&Context) -> R, [src]
device: &Device,
quirks_mode: QuirksMode,
f: F
) -> R where
F: FnOnce(&Context) -> R,
Creates a suitable context for media query evaluation, in which
font-relative units compute against the system_font, and executes f
with it.
pub fn is_root_element(&self) -> bool[src]
Whether the current element is the root element.
pub fn device(&self) -> &Device[src]
The current device.
pub fn viewport_size_for_viewport_unit_resolution(&self) -> Size2D<Au>[src]
The current viewport size, used to resolve viewport units.
pub fn default_style(&self) -> &ComputedValues[src]
The default computed style we're getting our reset style from.
pub fn style(&self) -> &StyleBuilder[src]
The current style.
pub fn maybe_zoom_text(&self, size: NonNegativeLength) -> NonNegativeLength[src]
(Servo doesn't do text-zoom)