mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
style: Container Relative Units: Set flag for USES_VIEWPORT_UNITS
only when viewport fallback is actually used
Differential Revision: https://phabricator.services.mozilla.com/D159866
This commit is contained in:
parent
15cf28815e
commit
14eece6f5a
3 changed files with 3 additions and 11 deletions
|
@ -375,9 +375,7 @@ pub struct ContainerSizeQueryResult {
|
||||||
impl ContainerSizeQueryResult {
|
impl ContainerSizeQueryResult {
|
||||||
fn get_viewport_size(context: &Context) -> Size2D<Au> {
|
fn get_viewport_size(context: &Context) -> Size2D<Au> {
|
||||||
use crate::values::specified::ViewportVariant;
|
use crate::values::specified::ViewportVariant;
|
||||||
context
|
context.viewport_size_for_viewport_unit_resolution(ViewportVariant::Small)
|
||||||
.device()
|
|
||||||
.au_viewport_size_for_viewport_unit_resolution(ViewportVariant::Small)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_logical_viewport_size(context: &Context) -> LogicalSize<Au> {
|
fn get_logical_viewport_size(context: &Context) -> LogicalSize<Au> {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
//! `<length>` computed values, and related ones.
|
//! `<length>` computed values, and related ones.
|
||||||
|
|
||||||
use super::{Context, Number, ToComputedValue};
|
use super::{Context, Number, ToComputedValue};
|
||||||
use crate::computed_value_flags::ComputedValueFlags;
|
|
||||||
use crate::values::animated::ToAnimatedValue;
|
use crate::values::animated::ToAnimatedValue;
|
||||||
use crate::values::computed::NonNegativeNumber;
|
use crate::values::computed::NonNegativeNumber;
|
||||||
use crate::values::generics::length as generics;
|
use crate::values::generics::length as generics;
|
||||||
|
@ -53,16 +52,9 @@ impl specified::NoCalcLength {
|
||||||
length.to_computed_value(context, base_size)
|
length.to_computed_value(context, base_size)
|
||||||
},
|
},
|
||||||
specified::NoCalcLength::ViewportPercentage(length) => {
|
specified::NoCalcLength::ViewportPercentage(length) => {
|
||||||
context
|
|
||||||
.builder
|
|
||||||
.add_flags(ComputedValueFlags::USES_VIEWPORT_UNITS);
|
|
||||||
length.to_computed_value(context)
|
length.to_computed_value(context)
|
||||||
},
|
},
|
||||||
specified::NoCalcLength::ContainerRelative(length) => {
|
specified::NoCalcLength::ContainerRelative(length) => {
|
||||||
// Fallback uses small viewport size.
|
|
||||||
context
|
|
||||||
.builder
|
|
||||||
.add_flags(ComputedValueFlags::USES_VIEWPORT_UNITS);
|
|
||||||
length.to_computed_value(context)
|
length.to_computed_value(context)
|
||||||
},
|
},
|
||||||
specified::NoCalcLength::ServoCharacterWidth(length) => {
|
specified::NoCalcLength::ServoCharacterWidth(length) => {
|
||||||
|
|
|
@ -361,6 +361,8 @@ impl<'a> Context<'a> {
|
||||||
&self,
|
&self,
|
||||||
variant: ViewportVariant,
|
variant: ViewportVariant,
|
||||||
) -> default::Size2D<Au> {
|
) -> default::Size2D<Au> {
|
||||||
|
self.builder
|
||||||
|
.add_flags(ComputedValueFlags::USES_VIEWPORT_UNITS);
|
||||||
self.builder
|
self.builder
|
||||||
.device
|
.device
|
||||||
.au_viewport_size_for_viewport_unit_resolution(variant)
|
.au_viewport_size_for_viewport_unit_resolution(variant)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue