mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1790652 - Split in_media_query and in_container_query bits from computed::Context. r=dshin
No behavior change, but it makes more sense this way :) Differential Revision: https://phabricator.services.mozilla.com/D159851
This commit is contained in:
parent
32728dff0f
commit
9f9bdc7ccb
@ -166,9 +166,12 @@ pub struct Context<'a> {
|
||||
#[cfg(feature = "servo")]
|
||||
pub cached_system_font: Option<()>,
|
||||
|
||||
/// Whether or not we are computing the media list in a media query
|
||||
/// Whether or not we are computing the media list in a media query.
|
||||
pub in_media_query: bool,
|
||||
|
||||
/// Whether or not we are computing the container query condition.
|
||||
pub in_container_query: bool,
|
||||
|
||||
/// The quirks mode of this context.
|
||||
pub quirks_mode: QuirksMode,
|
||||
|
||||
@ -215,6 +218,7 @@ impl<'a> Context<'a> {
|
||||
builder: StyleBuilder::for_inheritance(device, None, None),
|
||||
cached_system_font: None,
|
||||
in_media_query: true,
|
||||
in_container_query: true,
|
||||
quirks_mode,
|
||||
for_smil_animation: false,
|
||||
container_info: None,
|
||||
@ -248,7 +252,8 @@ impl<'a> Context<'a> {
|
||||
let context = Context {
|
||||
builder: StyleBuilder::for_inheritance(device, style, None),
|
||||
cached_system_font: None,
|
||||
in_media_query: true,
|
||||
in_media_query: false,
|
||||
in_container_query: true,
|
||||
quirks_mode,
|
||||
for_smil_animation: false,
|
||||
container_info,
|
||||
@ -271,6 +276,7 @@ impl<'a> Context<'a> {
|
||||
builder,
|
||||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
in_container_query: false,
|
||||
quirks_mode,
|
||||
container_info: None,
|
||||
for_smil_animation: false,
|
||||
@ -292,6 +298,7 @@ impl<'a> Context<'a> {
|
||||
builder,
|
||||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
in_container_query: false,
|
||||
quirks_mode,
|
||||
container_info: None,
|
||||
for_smil_animation,
|
||||
@ -344,7 +351,7 @@ impl<'a> Context<'a> {
|
||||
vertical,
|
||||
font,
|
||||
size,
|
||||
self.in_media_query,
|
||||
self.in_media_or_container_query(),
|
||||
retrieve_math_scales,
|
||||
)
|
||||
}
|
||||
@ -359,6 +366,11 @@ impl<'a> Context<'a> {
|
||||
.au_viewport_size_for_viewport_unit_resolution(variant)
|
||||
}
|
||||
|
||||
/// Whether we're in a media or container query.
|
||||
pub fn in_media_or_container_query(&self) -> bool {
|
||||
self.in_media_query || self.in_container_query
|
||||
}
|
||||
|
||||
/// The default computed style we're getting our reset style from.
|
||||
pub fn default_style(&self) -> &ComputedValues {
|
||||
self.builder.default_style()
|
||||
|
@ -264,7 +264,7 @@ impl FontRelativeLength {
|
||||
// element, the rem units refer to the property's initial
|
||||
// value.
|
||||
//
|
||||
let reference_size = if context.builder.is_root_element || context.in_media_query {
|
||||
let reference_size = if context.builder.is_root_element || context.in_media_or_container_query() {
|
||||
reference_font_size
|
||||
} else {
|
||||
context.device().root_font_size()
|
||||
|
Loading…
Reference in New Issue
Block a user