mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
style: Fix servo build.
This commit is contained in:
parent
80651fde47
commit
c7f30ad0df
16 changed files with 117 additions and 117 deletions
|
@ -66,7 +66,7 @@ use style::context::SharedStyleContext;
|
||||||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
use style::values::computed::{LengthPercentageOrAuto, LengthPercentageOrNone};
|
||||||
|
|
||||||
/// Information specific to floated blocks.
|
/// Information specific to floated blocks.
|
||||||
#[derive(Clone, Serialize)]
|
#[derive(Clone, Serialize)]
|
||||||
|
@ -418,15 +418,15 @@ impl CandidateBSizeIterator {
|
||||||
// `min-height` and `max-height`, percentage values are ignored.
|
// `min-height` and `max-height`, percentage values are ignored.
|
||||||
|
|
||||||
let block_size = match fragment.style.content_block_size() {
|
let block_size = match fragment.style.content_block_size() {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
MaybeAuto::from_option(lp.maybe_to_used_value(block_container_block_size))
|
MaybeAuto::from_option(lp.maybe_to_used_value(block_container_block_size))
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let max_block_size = match fragment.style.max_block_size() {
|
let max_block_size = match fragment.style.max_block_size() {
|
||||||
LengthOrPercentageOrNone::None => None,
|
LengthPercentageOrNone::None => None,
|
||||||
LengthOrPercentageOrNone::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrNone::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(block_container_block_size)
|
lp.maybe_to_used_value(block_container_block_size)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1396,7 +1396,7 @@ impl BlockFlow {
|
||||||
let content_block_size = self.fragment.style().content_block_size();
|
let content_block_size = self.fragment.style().content_block_size();
|
||||||
|
|
||||||
match content_block_size {
|
match content_block_size {
|
||||||
LengthOrPercentageOrAuto::Auto => {
|
LengthPercentageOrAuto::Auto => {
|
||||||
let container_size = containing_block_size?;
|
let container_size = containing_block_size?;
|
||||||
let (block_start, block_end) = {
|
let (block_start, block_end) = {
|
||||||
let position = self.fragment.style().logical_position();
|
let position = self.fragment.style().logical_position();
|
||||||
|
@ -1415,11 +1415,11 @@ impl BlockFlow {
|
||||||
// calculated during assign-inline-size.
|
// calculated during assign-inline-size.
|
||||||
let margin = self.fragment.style().logical_margin();
|
let margin = self.fragment.style().logical_margin();
|
||||||
let margin_block_start = match margin.block_start {
|
let margin_block_start = match margin.block_start {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
|
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
|
||||||
};
|
};
|
||||||
let margin_block_end = match margin.block_end {
|
let margin_block_end = match margin.block_end {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
|
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1431,7 +1431,7 @@ impl BlockFlow {
|
||||||
(_, _) => None,
|
(_, _) => None,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(containing_block_size)
|
lp.maybe_to_used_value(containing_block_size)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1452,11 +1452,11 @@ impl BlockFlow {
|
||||||
// calculated during assign-inline-size.
|
// calculated during assign-inline-size.
|
||||||
let margin = self.fragment.style().logical_margin();
|
let margin = self.fragment.style().logical_margin();
|
||||||
let margin_block_start = match margin.block_start {
|
let margin_block_start = match margin.block_start {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
|
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
|
||||||
};
|
};
|
||||||
let margin_block_end = match margin.block_end {
|
let margin_block_end = match margin.block_end {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
|
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2022,7 +2022,7 @@ impl BlockFlow {
|
||||||
// If `max-width` is set, then don't perform this speculation. We guess that the
|
// If `max-width` is set, then don't perform this speculation. We guess that the
|
||||||
// page set `max-width` in order to avoid hitting floats. The search box on Google
|
// page set `max-width` in order to avoid hitting floats. The search box on Google
|
||||||
// SERPs falls into this category.
|
// SERPs falls into this category.
|
||||||
if self.fragment.style.max_inline_size() != LengthOrPercentageOrNone::None {
|
if self.fragment.style.max_inline_size() != LengthPercentageOrNone::None {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2153,8 +2153,8 @@ impl Flow for BlockFlow {
|
||||||
// If this block has a fixed width, just use that for the minimum and preferred width,
|
// If this block has a fixed width, just use that for the minimum and preferred width,
|
||||||
// rather than bubbling up children inline width.
|
// rather than bubbling up children inline width.
|
||||||
let consult_children = match self.fragment.style().get_position().width {
|
let consult_children = match self.fragment.style().get_position().width {
|
||||||
LengthOrPercentageOrAuto::Auto => true,
|
LengthPercentageOrAuto::Auto => true,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => lp.maybe_to_used_value(None).is_none(),
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => lp.maybe_to_used_value(None).is_none(),
|
||||||
};
|
};
|
||||||
self.bubble_inline_sizes_for_block(consult_children);
|
self.bubble_inline_sizes_for_block(consult_children);
|
||||||
self.fragment
|
self.fragment
|
||||||
|
@ -2541,8 +2541,8 @@ impl Flow for BlockFlow {
|
||||||
.flags
|
.flags
|
||||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||||
self.fragment.style().logical_position().inline_start ==
|
self.fragment.style().logical_position().inline_start ==
|
||||||
LengthOrPercentageOrAuto::Auto &&
|
LengthPercentageOrAuto::Auto &&
|
||||||
self.fragment.style().logical_position().inline_end == LengthOrPercentageOrAuto::Auto
|
self.fragment.style().logical_position().inline_end == LengthPercentageOrAuto::Auto
|
||||||
{
|
{
|
||||||
self.base.position.start.i = inline_position
|
self.base.position.start.i = inline_position
|
||||||
}
|
}
|
||||||
|
@ -2554,8 +2554,8 @@ impl Flow for BlockFlow {
|
||||||
.flags
|
.flags
|
||||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||||
self.fragment.style().logical_position().block_start ==
|
self.fragment.style().logical_position().block_start ==
|
||||||
LengthOrPercentageOrAuto::Auto &&
|
LengthPercentageOrAuto::Auto &&
|
||||||
self.fragment.style().logical_position().block_end == LengthOrPercentageOrAuto::Auto
|
self.fragment.style().logical_position().block_end == LengthPercentageOrAuto::Auto
|
||||||
{
|
{
|
||||||
self.base.position.start.b = block_position
|
self.base.position.start.b = block_position
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use style::computed_values::background_attachment::single_value::T as Background
|
||||||
use style::computed_values::background_clip::single_value::T as BackgroundClip;
|
use style::computed_values::background_clip::single_value::T as BackgroundClip;
|
||||||
use style::computed_values::background_origin::single_value::T as BackgroundOrigin;
|
use style::computed_values::background_origin::single_value::T as BackgroundOrigin;
|
||||||
use style::properties::style_structs::Background;
|
use style::properties::style_structs::Background;
|
||||||
use style::values::computed::{BackgroundSize, LengthOrPercentageOrAuto};
|
use style::values::computed::{BackgroundSize, LengthPercentageOrAuto};
|
||||||
use style::values::generics::background::BackgroundSize as GenericBackgroundSize;
|
use style::values::generics::background::BackgroundSize as GenericBackgroundSize;
|
||||||
use style::values::generics::NonNegative;
|
use style::values::generics::NonNegative;
|
||||||
use style::values::specified::background::BackgroundRepeatKeyword;
|
use style::values::specified::background::BackgroundRepeatKeyword;
|
||||||
|
@ -88,7 +88,7 @@ fn compute_background_image_size(
|
||||||
(
|
(
|
||||||
GenericBackgroundSize::Explicit {
|
GenericBackgroundSize::Explicit {
|
||||||
width,
|
width,
|
||||||
height: NonNegative(LengthOrPercentageOrAuto::Auto),
|
height: NonNegative(LengthPercentageOrAuto::Auto),
|
||||||
},
|
},
|
||||||
_,
|
_,
|
||||||
) => {
|
) => {
|
||||||
|
@ -98,7 +98,7 @@ fn compute_background_image_size(
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
GenericBackgroundSize::Explicit {
|
GenericBackgroundSize::Explicit {
|
||||||
width: NonNegative(LengthOrPercentageOrAuto::Auto),
|
width: NonNegative(LengthPercentageOrAuto::Auto),
|
||||||
height,
|
height,
|
||||||
},
|
},
|
||||||
_,
|
_,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use app_units::Au;
|
||||||
use euclid::{Point2D, Size2D, Vector2D};
|
use euclid::{Point2D, Size2D, Vector2D};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::image::{EndingShape, LineDirection};
|
use style::values::computed::image::{EndingShape, LineDirection};
|
||||||
use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position};
|
use style::values::computed::{Angle, GradientItem, LengthPercentage, Percentage, Position};
|
||||||
use style::values::generics::image::EndingShape as GenericEndingShape;
|
use style::values::generics::image::EndingShape as GenericEndingShape;
|
||||||
use style::values::generics::image::GradientItem as GenericGradientItem;
|
use style::values::generics::image::GradientItem as GenericGradientItem;
|
||||||
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
|
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
|
||||||
|
@ -107,14 +107,14 @@ fn convert_gradient_stops(
|
||||||
{
|
{
|
||||||
let first = stop_items.first_mut().unwrap();
|
let first = stop_items.first_mut().unwrap();
|
||||||
if first.position.is_none() {
|
if first.position.is_none() {
|
||||||
first.position = Some(LengthOrPercentage::new_percent(Percentage(0.)));
|
first.position = Some(LengthPercentage::new_percent(Percentage(0.)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the last color stop does not have a position, set its position to 100%.
|
// If the last color stop does not have a position, set its position to 100%.
|
||||||
{
|
{
|
||||||
let last = stop_items.last_mut().unwrap();
|
let last = stop_items.last_mut().unwrap();
|
||||||
if last.position.is_none() {
|
if last.position.is_none() {
|
||||||
last.position = Some(LengthOrPercentage::new_percent(Percentage(1.0)));
|
last.position = Some(LengthPercentage::new_percent(Percentage(1.0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ where
|
||||||
Size2D::new(cmp(left_side, right_side), cmp(top_side, bottom_side))
|
Size2D::new(cmp(left_side, right_side), cmp(top_side, bottom_side))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn position_to_offset(position: LengthOrPercentage, total_length: Au) -> f32 {
|
fn position_to_offset(position: LengthPercentage, total_length: Au) -> f32 {
|
||||||
if total_length == Au(0) {
|
if total_length == Au(0) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ use style::properties::ComputedValues;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::values::computed::flex::FlexBasis;
|
use style::values::computed::flex::FlexBasis;
|
||||||
use style::values::computed::{
|
use style::values::computed::{
|
||||||
LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone,
|
LengthPercentage, LengthPercentageOrAuto, LengthPercentageOrNone,
|
||||||
};
|
};
|
||||||
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
|
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
|
||||||
|
|
||||||
|
@ -46,16 +46,16 @@ impl AxisSize {
|
||||||
/// Generate a new available cross or main axis size from the specified size of the container,
|
/// Generate a new available cross or main axis size from the specified size of the container,
|
||||||
/// containing block size, min constraint, and max constraint
|
/// containing block size, min constraint, and max constraint
|
||||||
pub fn new(
|
pub fn new(
|
||||||
size: LengthOrPercentageOrAuto,
|
size: LengthPercentageOrAuto,
|
||||||
content_size: Option<Au>,
|
content_size: Option<Au>,
|
||||||
min: LengthOrPercentage,
|
min: LengthPercentage,
|
||||||
max: LengthOrPercentageOrNone,
|
max: LengthPercentageOrNone,
|
||||||
) -> AxisSize {
|
) -> AxisSize {
|
||||||
match size {
|
match size {
|
||||||
LengthOrPercentageOrAuto::Auto => {
|
LengthPercentageOrAuto::Auto => {
|
||||||
AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None))
|
AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None))
|
||||||
}
|
}
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
match lp.maybe_to_used_value(content_size) {
|
match lp.maybe_to_used_value(content_size) {
|
||||||
Some(length) => AxisSize::Definite(length),
|
Some(length) => AxisSize::Definite(length),
|
||||||
None => AxisSize::Infinite,
|
None => AxisSize::Infinite,
|
||||||
|
@ -71,7 +71,7 @@ impl AxisSize {
|
||||||
/// is definite after flex size resolving.
|
/// is definite after flex size resolving.
|
||||||
fn from_flex_basis(
|
fn from_flex_basis(
|
||||||
flex_basis: FlexBasis,
|
flex_basis: FlexBasis,
|
||||||
main_length: LengthOrPercentageOrAuto,
|
main_length: LengthPercentageOrAuto,
|
||||||
containing_length: Au,
|
containing_length: Au,
|
||||||
) -> MaybeAuto {
|
) -> MaybeAuto {
|
||||||
let width = match flex_basis {
|
let width = match flex_basis {
|
||||||
|
@ -80,7 +80,7 @@ fn from_flex_basis(
|
||||||
};
|
};
|
||||||
|
|
||||||
match width.0 {
|
match width.0 {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::from_style(main_length, containing_length),
|
LengthPercentageOrAuto::Auto => MaybeAuto::from_style(main_length, containing_length),
|
||||||
other => MaybeAuto::from_style(other, containing_length),
|
other => MaybeAuto::from_style(other, containing_length),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ impl FlexItem {
|
||||||
let block = flow.as_mut_block();
|
let block = flow.as_mut_block();
|
||||||
match direction {
|
match direction {
|
||||||
// TODO(stshine): the definition of min-{width, height} in style component
|
// TODO(stshine): the definition of min-{width, height} in style component
|
||||||
// should change to LengthOrPercentageOrAuto for automatic implied minimal size.
|
// should change to LengthPercentageOrAuto for automatic implied minimal size.
|
||||||
// https://drafts.csswg.org/css-flexbox-1/#min-size-auto
|
// https://drafts.csswg.org/css-flexbox-1/#min-size-auto
|
||||||
Direction::Inline => {
|
Direction::Inline => {
|
||||||
let basis = from_flex_basis(
|
let basis = from_flex_basis(
|
||||||
|
@ -225,18 +225,18 @@ impl FlexItem {
|
||||||
let mut margin_count = 0;
|
let mut margin_count = 0;
|
||||||
match direction {
|
match direction {
|
||||||
Direction::Inline => {
|
Direction::Inline => {
|
||||||
if margin.inline_start == LengthOrPercentageOrAuto::Auto {
|
if margin.inline_start == LengthPercentageOrAuto::Auto {
|
||||||
margin_count += 1;
|
margin_count += 1;
|
||||||
}
|
}
|
||||||
if margin.inline_end == LengthOrPercentageOrAuto::Auto {
|
if margin.inline_end == LengthPercentageOrAuto::Auto {
|
||||||
margin_count += 1;
|
margin_count += 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Direction::Block => {
|
Direction::Block => {
|
||||||
if margin.block_start == LengthOrPercentageOrAuto::Auto {
|
if margin.block_start == LengthPercentageOrAuto::Auto {
|
||||||
margin_count += 1;
|
margin_count += 1;
|
||||||
}
|
}
|
||||||
if margin.block_end == LengthOrPercentageOrAuto::Auto {
|
if margin.block_end == LengthPercentageOrAuto::Auto {
|
||||||
margin_count += 1;
|
margin_count += 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -819,7 +819,7 @@ impl FlexFlow {
|
||||||
// cross size of item should equal to the line size if any auto margin exists.
|
// cross size of item should equal to the line size if any auto margin exists.
|
||||||
// https://drafts.csswg.org/css-flexbox/#algo-cross-margins
|
// https://drafts.csswg.org/css-flexbox/#algo-cross-margins
|
||||||
if auto_margin_count > 0 {
|
if auto_margin_count > 0 {
|
||||||
if margin.block_start == LengthOrPercentageOrAuto::Auto {
|
if margin.block_start == LengthPercentageOrAuto::Auto {
|
||||||
margin_block_start = if free_space < Au(0) {
|
margin_block_start = if free_space < Au(0) {
|
||||||
Au(0)
|
Au(0)
|
||||||
} else {
|
} else {
|
||||||
|
@ -833,7 +833,7 @@ impl FlexFlow {
|
||||||
|
|
||||||
let self_align = block.fragment.style().get_position().align_self;
|
let self_align = block.fragment.style().get_position().align_self;
|
||||||
if self_align == AlignSelf::Stretch &&
|
if self_align == AlignSelf::Stretch &&
|
||||||
block.fragment.style().content_block_size() == LengthOrPercentageOrAuto::Auto
|
block.fragment.style().content_block_size() == LengthPercentageOrAuto::Auto
|
||||||
{
|
{
|
||||||
free_space = Au(0);
|
free_space = Au(0);
|
||||||
block.base.block_container_explicit_block_size = Some(line.cross_size);
|
block.base.block_container_explicit_block_size = Some(line.cross_size);
|
||||||
|
|
|
@ -10,7 +10,7 @@ use std::cmp::{max, min};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style::computed_values::float::T as StyleFloat;
|
use style::computed_values::float::T as StyleFloat;
|
||||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthPercentageOrAuto;
|
||||||
|
|
||||||
/// The kind of float: left or right.
|
/// The kind of float: left or right.
|
||||||
#[derive(Clone, Copy, Debug, Serialize)]
|
#[derive(Clone, Copy, Debug, Serialize)]
|
||||||
|
@ -550,8 +550,8 @@ impl SpeculatedFloatPlacement {
|
||||||
let inline_size =
|
let inline_size =
|
||||||
flow.as_block().fragment.style.content_inline_size();
|
flow.as_block().fragment.style.content_inline_size();
|
||||||
let fixed = match inline_size {
|
let fixed = match inline_size {
|
||||||
LengthOrPercentageOrAuto::Auto => false,
|
LengthPercentageOrAuto::Auto => false,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.is_definitely_zero() || lp.maybe_to_used_value(None).is_some()
|
lp.is_definitely_zero() || lp.maybe_to_used_value(None).is_some()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,7 +67,7 @@ use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::selector_parser::RestyleDamage;
|
use style::selector_parser::RestyleDamage;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthPercentageOrAuto;
|
||||||
use webrender_api::LayoutTransform;
|
use webrender_api::LayoutTransform;
|
||||||
|
|
||||||
/// This marker trait indicates that a type is a struct with `#[repr(C)]` whose first field
|
/// This marker trait indicates that a type is a struct with `#[repr(C)]` whose first field
|
||||||
|
@ -1068,13 +1068,13 @@ impl BaseFlow {
|
||||||
flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||||
|
|
||||||
let logical_position = style.logical_position();
|
let logical_position = style.logical_position();
|
||||||
if logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
|
if logical_position.inline_start == LengthPercentageOrAuto::Auto &&
|
||||||
logical_position.inline_end == LengthOrPercentageOrAuto::Auto
|
logical_position.inline_end == LengthPercentageOrAuto::Auto
|
||||||
{
|
{
|
||||||
flags.insert(FlowFlags::INLINE_POSITION_IS_STATIC);
|
flags.insert(FlowFlags::INLINE_POSITION_IS_STATIC);
|
||||||
}
|
}
|
||||||
if logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
|
if logical_position.block_start == LengthPercentageOrAuto::Auto &&
|
||||||
logical_position.block_end == LengthOrPercentageOrAuto::Auto
|
logical_position.block_end == LengthPercentageOrAuto::Auto
|
||||||
{
|
{
|
||||||
flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC);
|
flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC);
|
||||||
}
|
}
|
||||||
|
@ -1161,13 +1161,13 @@ impl BaseFlow {
|
||||||
let logical_position = style.logical_position();
|
let logical_position = style.logical_position();
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
FlowFlags::INLINE_POSITION_IS_STATIC,
|
FlowFlags::INLINE_POSITION_IS_STATIC,
|
||||||
logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
|
logical_position.inline_start == LengthPercentageOrAuto::Auto &&
|
||||||
logical_position.inline_end == LengthOrPercentageOrAuto::Auto,
|
logical_position.inline_end == LengthPercentageOrAuto::Auto,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
FlowFlags::BLOCK_POSITION_IS_STATIC,
|
FlowFlags::BLOCK_POSITION_IS_STATIC,
|
||||||
logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
|
logical_position.block_start == LengthPercentageOrAuto::Auto &&
|
||||||
logical_position.block_end == LengthOrPercentageOrAuto::Auto,
|
logical_position.block_end == LengthPercentageOrAuto::Auto,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ use style::selector_parser::RestyleDamage;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::str::char_is_whitespace;
|
use style::str::char_is_whitespace;
|
||||||
use style::values::computed::counters::ContentItem;
|
use style::values::computed::counters::ContentItem;
|
||||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
use style::values::computed::{LengthPercentage, LengthPercentageOrAuto};
|
||||||
use style::values::generics::box_::{Perspective, VerticalAlign};
|
use style::values::generics::box_::{Perspective, VerticalAlign};
|
||||||
use style::values::generics::transform;
|
use style::values::generics::transform;
|
||||||
use webrender_api::{self, LayoutTransform};
|
use webrender_api::{self, LayoutTransform};
|
||||||
|
@ -1448,14 +1448,14 @@ impl Fragment {
|
||||||
pub fn relative_position(&self, containing_block_size: &LogicalSize<Au>) -> LogicalSize<Au> {
|
pub fn relative_position(&self, containing_block_size: &LogicalSize<Au>) -> LogicalSize<Au> {
|
||||||
fn from_style(style: &ComputedValues, container_size: &LogicalSize<Au>) -> LogicalSize<Au> {
|
fn from_style(style: &ComputedValues, container_size: &LogicalSize<Au>) -> LogicalSize<Au> {
|
||||||
let offsets = style.logical_position();
|
let offsets = style.logical_position();
|
||||||
let offset_i = if offsets.inline_start != LengthOrPercentageOrAuto::Auto {
|
let offset_i = if offsets.inline_start != LengthPercentageOrAuto::Auto {
|
||||||
MaybeAuto::from_style(offsets.inline_start, container_size.inline)
|
MaybeAuto::from_style(offsets.inline_start, container_size.inline)
|
||||||
.specified_or_zero()
|
.specified_or_zero()
|
||||||
} else {
|
} else {
|
||||||
-MaybeAuto::from_style(offsets.inline_end, container_size.inline)
|
-MaybeAuto::from_style(offsets.inline_end, container_size.inline)
|
||||||
.specified_or_zero()
|
.specified_or_zero()
|
||||||
};
|
};
|
||||||
let offset_b = if offsets.block_start != LengthOrPercentageOrAuto::Auto {
|
let offset_b = if offsets.block_start != LengthPercentageOrAuto::Auto {
|
||||||
MaybeAuto::from_style(offsets.block_start, container_size.block).specified_or_zero()
|
MaybeAuto::from_style(offsets.block_start, container_size.block).specified_or_zero()
|
||||||
} else {
|
} else {
|
||||||
-MaybeAuto::from_style(offsets.block_end, container_size.block).specified_or_zero()
|
-MaybeAuto::from_style(offsets.block_end, container_size.block).specified_or_zero()
|
||||||
|
@ -1611,8 +1611,8 @@ impl Fragment {
|
||||||
SpecificFragmentInfo::Iframe(_) |
|
SpecificFragmentInfo::Iframe(_) |
|
||||||
SpecificFragmentInfo::Svg(_) => {
|
SpecificFragmentInfo::Svg(_) => {
|
||||||
let inline_size = match self.style.content_inline_size() {
|
let inline_size = match self.style.content_inline_size() {
|
||||||
LengthOrPercentageOrAuto::Auto => None,
|
LengthPercentageOrAuto::Auto => None,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(None)
|
lp.maybe_to_used_value(None)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2510,12 +2510,12 @@ impl Fragment {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if inline_context_node.style.logical_margin().inline_end !=
|
if inline_context_node.style.logical_margin().inline_end !=
|
||||||
LengthOrPercentageOrAuto::zero()
|
LengthPercentageOrAuto::zero()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if inline_context_node.style.logical_padding().inline_end !=
|
if inline_context_node.style.logical_padding().inline_end !=
|
||||||
LengthOrPercentage::zero()
|
LengthPercentage::zero()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2536,12 +2536,12 @@ impl Fragment {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if inline_context_node.style.logical_margin().inline_start !=
|
if inline_context_node.style.logical_margin().inline_start !=
|
||||||
LengthOrPercentageOrAuto::zero()
|
LengthPercentageOrAuto::zero()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if inline_context_node.style.logical_padding().inline_start !=
|
if inline_context_node.style.logical_padding().inline_start !=
|
||||||
LengthOrPercentage::zero()
|
LengthPercentage::zero()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ use std::cmp::{max, min};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style::logical_geometry::{LogicalMargin, WritingMode};
|
use style::logical_geometry::{LogicalMargin, WritingMode};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::LengthOrPercentageOrNone;
|
use style::values::computed::LengthPercentageOrNone;
|
||||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
use style::values::computed::{LengthPercentage, LengthPercentageOrAuto};
|
||||||
|
|
||||||
/// A collapsible margin. See CSS 2.1 § 8.3.1.
|
/// A collapsible margin. See CSS 2.1 § 8.3.1.
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
@ -135,8 +135,8 @@ impl MarginCollapseInfo {
|
||||||
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
||||||
may_collapse_through = may_collapse_through &&
|
may_collapse_through = may_collapse_through &&
|
||||||
match fragment.style().content_block_size() {
|
match fragment.style().content_block_size() {
|
||||||
LengthOrPercentageOrAuto::Auto => true,
|
LengthPercentageOrAuto::Auto => true,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.is_definitely_zero() ||
|
lp.is_definitely_zero() ||
|
||||||
lp.maybe_to_used_value(containing_block_size).is_none()
|
lp.maybe_to_used_value(containing_block_size).is_none()
|
||||||
},
|
},
|
||||||
|
@ -435,10 +435,10 @@ pub enum MaybeAuto {
|
||||||
|
|
||||||
impl MaybeAuto {
|
impl MaybeAuto {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_style(length: LengthOrPercentageOrAuto, containing_length: Au) -> MaybeAuto {
|
pub fn from_style(length: LengthPercentageOrAuto, containing_length: Au) -> MaybeAuto {
|
||||||
match length {
|
match length {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
MaybeAuto::Specified(lp.to_used_value(containing_length))
|
MaybeAuto::Specified(lp.to_used_value(containing_length))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -498,12 +498,12 @@ impl MaybeAuto {
|
||||||
///
|
///
|
||||||
/// `style_length`: content size as given in the CSS.
|
/// `style_length`: content size as given in the CSS.
|
||||||
pub fn style_length(
|
pub fn style_length(
|
||||||
style_length: LengthOrPercentageOrAuto,
|
style_length: LengthPercentageOrAuto,
|
||||||
container_size: Option<Au>,
|
container_size: Option<Au>,
|
||||||
) -> MaybeAuto {
|
) -> MaybeAuto {
|
||||||
match style_length {
|
match style_length {
|
||||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
MaybeAuto::from_option(lp.maybe_to_used_value(container_size))
|
MaybeAuto::from_option(lp.maybe_to_used_value(container_size))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,16 +570,16 @@ impl SizeConstraint {
|
||||||
/// Create a `SizeConstraint` for an axis.
|
/// Create a `SizeConstraint` for an axis.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
container_size: Option<Au>,
|
container_size: Option<Au>,
|
||||||
min_size: LengthOrPercentage,
|
min_size: LengthPercentage,
|
||||||
max_size: LengthOrPercentageOrNone,
|
max_size: LengthPercentageOrNone,
|
||||||
border: Option<Au>,
|
border: Option<Au>,
|
||||||
) -> SizeConstraint {
|
) -> SizeConstraint {
|
||||||
let mut min_size =
|
let mut min_size =
|
||||||
min_size.maybe_to_used_value(container_size).unwrap_or(Au(0));
|
min_size.maybe_to_used_value(container_size).unwrap_or(Au(0));
|
||||||
|
|
||||||
let mut max_size = match max_size {
|
let mut max_size = match max_size {
|
||||||
LengthOrPercentageOrNone::None => None,
|
LengthPercentageOrNone::None => None,
|
||||||
LengthOrPercentageOrNone::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrNone::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(container_size)
|
lp.maybe_to_used_value(container_size)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@ use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
use style::values::computed::{LengthPercentageOrAuto, LengthPercentageOrNone};
|
||||||
use style::values::generics::column::ColumnCount;
|
use style::values::generics::column::ColumnCount;
|
||||||
use style::values::Either;
|
use style::values::Either;
|
||||||
|
|
||||||
|
@ -155,15 +155,15 @@ impl Flow for MulticolFlow {
|
||||||
available_block_size: {
|
available_block_size: {
|
||||||
let style = &self.block_flow.fragment.style;
|
let style = &self.block_flow.fragment.style;
|
||||||
let size = match style.content_block_size() {
|
let size = match style.content_block_size() {
|
||||||
LengthOrPercentageOrAuto::Auto => None,
|
LengthPercentageOrAuto::Auto => None,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(None)
|
lp.maybe_to_used_value(None)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let size = size.or_else(|| {
|
let size = size.or_else(|| {
|
||||||
match style.max_block_size() {
|
match style.max_block_size() {
|
||||||
LengthOrPercentageOrNone::None => None,
|
LengthPercentageOrNone::None => None,
|
||||||
LengthOrPercentageOrNone::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrNone::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(None)
|
lp.maybe_to_used_value(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::style_structs::Background;
|
use style::properties::style_structs::Background;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthPercentageOrAuto;
|
||||||
use style::values::CSSFloat;
|
use style::values::CSSFloat;
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
@ -301,14 +301,14 @@ impl Flow for TableFlow {
|
||||||
self.column_intrinsic_inline_sizes
|
self.column_intrinsic_inline_sizes
|
||||||
.push(ColumnIntrinsicInlineSize {
|
.push(ColumnIntrinsicInlineSize {
|
||||||
minimum_length: match *specified_inline_size {
|
minimum_length: match *specified_inline_size {
|
||||||
LengthOrPercentageOrAuto::Auto => Au(0),
|
LengthPercentageOrAuto::Auto => Au(0),
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(None).unwrap_or(Au(0))
|
lp.maybe_to_used_value(None).unwrap_or(Au(0))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
percentage: match *specified_inline_size {
|
percentage: match *specified_inline_size {
|
||||||
LengthOrPercentageOrAuto::Auto => 0.0,
|
LengthPercentageOrAuto::Auto => 0.0,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.as_percentage().map_or(0.0, |p| p.0)
|
lp.as_percentage().map_or(0.0, |p| p.0)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@ use euclid::Point2D;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthPercentageOrAuto;
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe impl crate::flow::HasBaseFlow for TableColGroupFlow {}
|
unsafe impl crate::flow::HasBaseFlow for TableColGroupFlow {}
|
||||||
|
@ -31,10 +31,10 @@ pub struct TableColGroupFlow {
|
||||||
/// The table column fragments
|
/// The table column fragments
|
||||||
pub cols: Vec<Fragment>,
|
pub cols: Vec<Fragment>,
|
||||||
|
|
||||||
/// The specified inline-sizes of table columns. (We use `LengthOrPercentageOrAuto` here in
|
/// The specified inline-sizes of table columns. (We use `LengthPercentageOrAuto` here in
|
||||||
/// lieu of `ColumnInlineSize` because column groups do not establish minimum or preferred
|
/// lieu of `ColumnInlineSize` because column groups do not establish minimum or preferred
|
||||||
/// inline sizes.)
|
/// inline sizes.)
|
||||||
pub inline_sizes: Vec<LengthOrPercentageOrAuto>,
|
pub inline_sizes: Vec<LengthPercentageOrAuto>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableColGroupFlow {
|
impl TableColGroupFlow {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use style::computed_values::border_spacing::T as BorderSpacing;
|
||||||
use style::computed_values::border_top_style::T as BorderStyle;
|
use style::computed_values::border_top_style::T as BorderStyle;
|
||||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::{Color, LengthOrPercentageOrAuto};
|
use style::values::computed::{Color, LengthPercentageOrAuto};
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe impl crate::flow::HasBaseFlow for TableRowFlow {}
|
unsafe impl crate::flow::HasBaseFlow for TableRowFlow {}
|
||||||
|
@ -430,22 +430,22 @@ impl Flow for TableRowFlow {
|
||||||
let child_base = kid.mut_base();
|
let child_base = kid.mut_base();
|
||||||
let child_column_inline_size = ColumnIntrinsicInlineSize {
|
let child_column_inline_size = ColumnIntrinsicInlineSize {
|
||||||
minimum_length: match child_specified_inline_size {
|
minimum_length: match child_specified_inline_size {
|
||||||
LengthOrPercentageOrAuto::Auto => None,
|
LengthPercentageOrAuto::Auto => None,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(None)
|
lp.maybe_to_used_value(None)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
.unwrap_or(child_base.intrinsic_inline_sizes.minimum_inline_size),
|
.unwrap_or(child_base.intrinsic_inline_sizes.minimum_inline_size),
|
||||||
percentage: match child_specified_inline_size {
|
percentage: match child_specified_inline_size {
|
||||||
LengthOrPercentageOrAuto::Auto => 0.0,
|
LengthPercentageOrAuto::Auto => 0.0,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.as_percentage().map_or(0.0, |p| p.0)
|
lp.as_percentage().map_or(0.0, |p| p.0)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
preferred: child_base.intrinsic_inline_sizes.preferred_inline_size,
|
preferred: child_base.intrinsic_inline_sizes.preferred_inline_size,
|
||||||
constrained: match child_specified_inline_size {
|
constrained: match child_specified_inline_size {
|
||||||
LengthOrPercentageOrAuto::Auto => false,
|
LengthPercentageOrAuto::Auto => false,
|
||||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||||
lp.maybe_to_used_value(None).is_some()
|
lp.maybe_to_used_value(None).is_some()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,7 +35,7 @@ use style::computed_values::{position, table_layout};
|
||||||
use style::context::SharedStyleContext;
|
use style::context::SharedStyleContext;
|
||||||
use style::logical_geometry::{LogicalRect, LogicalSize};
|
use style::logical_geometry::{LogicalRect, LogicalSize};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthPercentageOrAuto;
|
||||||
use style::values::CSSFloat;
|
use style::values::CSSFloat;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize)]
|
#[derive(Clone, Copy, Debug, Serialize)]
|
||||||
|
@ -203,7 +203,7 @@ impl TableWrapperFlow {
|
||||||
// says "the basic idea is the same as the shrink-to-fit width that CSS2.1 defines". So we
|
// says "the basic idea is the same as the shrink-to-fit width that CSS2.1 defines". So we
|
||||||
// just use the shrink-to-fit inline size.
|
// just use the shrink-to-fit inline size.
|
||||||
let available_inline_size = match self.block_flow.fragment.style().content_inline_size() {
|
let available_inline_size = match self.block_flow.fragment.style().content_inline_size() {
|
||||||
LengthOrPercentageOrAuto::Auto => {
|
LengthPercentageOrAuto::Auto => {
|
||||||
self.block_flow
|
self.block_flow
|
||||||
.get_shrink_to_fit_inline_size(available_inline_size) -
|
.get_shrink_to_fit_inline_size(available_inline_size) -
|
||||||
table_border_padding
|
table_border_padding
|
||||||
|
|
|
@ -718,8 +718,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(size));
|
specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(size));
|
||||||
hints.push(from_declaration(
|
hints.push(from_declaration(
|
||||||
shared_lock,
|
shared_lock,
|
||||||
PropertyDeclaration::Width(specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
PropertyDeclaration::Width(specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Length(value)
|
specified::LengthPercentage::Length(value)
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -745,8 +745,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
match width {
|
match width {
|
||||||
LengthOrPercentageOrAuto::Auto => {},
|
LengthOrPercentageOrAuto::Auto => {},
|
||||||
LengthOrPercentageOrAuto::Percentage(percentage) => {
|
LengthOrPercentageOrAuto::Percentage(percentage) => {
|
||||||
let width_value = specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
let width_value = specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Percentage(
|
specified::LengthPercentage::Percentage(
|
||||||
computed::Percentage(percentage),
|
computed::Percentage(percentage),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -757,8 +757,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
},
|
},
|
||||||
LengthOrPercentageOrAuto::Length(length) => {
|
LengthOrPercentageOrAuto::Length(length) => {
|
||||||
let width_value =
|
let width_value =
|
||||||
specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Length(
|
specified::LengthPercentage::Length(
|
||||||
specified::NoCalcLength::Absolute(
|
specified::NoCalcLength::Absolute(
|
||||||
specified::AbsoluteLength::Px(length.to_f32_px()),
|
specified::AbsoluteLength::Px(length.to_f32_px()),
|
||||||
),
|
),
|
||||||
|
@ -784,8 +784,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
match height {
|
match height {
|
||||||
LengthOrPercentageOrAuto::Auto => {},
|
LengthOrPercentageOrAuto::Auto => {},
|
||||||
LengthOrPercentageOrAuto::Percentage(percentage) => {
|
LengthOrPercentageOrAuto::Percentage(percentage) => {
|
||||||
let height_value = specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
let height_value = specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Percentage(
|
specified::LengthPercentage::Percentage(
|
||||||
computed::Percentage(percentage),
|
computed::Percentage(percentage),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -796,8 +796,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
},
|
},
|
||||||
LengthOrPercentageOrAuto::Length(length) => {
|
LengthOrPercentageOrAuto::Length(length) => {
|
||||||
let height_value =
|
let height_value =
|
||||||
specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Length(
|
specified::LengthPercentage::Length(
|
||||||
specified::NoCalcLength::Absolute(
|
specified::NoCalcLength::Absolute(
|
||||||
specified::AbsoluteLength::Px(length.to_f32_px()),
|
specified::AbsoluteLength::Px(length.to_f32_px()),
|
||||||
)
|
)
|
||||||
|
@ -829,8 +829,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(cols));
|
specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(cols));
|
||||||
hints.push(from_declaration(
|
hints.push(from_declaration(
|
||||||
shared_lock,
|
shared_lock,
|
||||||
PropertyDeclaration::Width(specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
PropertyDeclaration::Width(specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Length(value)
|
specified::LengthPercentage::Length(value)
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -853,8 +853,8 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
||||||
));
|
));
|
||||||
hints.push(from_declaration(
|
hints.push(from_declaration(
|
||||||
shared_lock,
|
shared_lock,
|
||||||
PropertyDeclaration::Height(specified::LengthOrPercentageOrAuto::LengthOrPercentage(
|
PropertyDeclaration::Height(specified::LengthPercentageOrAuto::LengthPercentage(
|
||||||
specified::LengthOrPercentage::Length(value)
|
specified::LengthPercentage::Length(value)
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ fn negative_letter_spacing_should_parse_properly() {
|
||||||
#[test]
|
#[test]
|
||||||
fn negative_word_spacing_should_parse_properly() {
|
fn negative_word_spacing_should_parse_properly() {
|
||||||
use style::properties::longhands::word_spacing;
|
use style::properties::longhands::word_spacing;
|
||||||
use style::values::specified::length::{FontRelativeLength, LengthOrPercentage, NoCalcLength};
|
use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength};
|
||||||
|
|
||||||
let negative_value = parse_longhand!(word_spacing, "-0.5em");
|
let negative_value = parse_longhand!(word_spacing, "-0.5em");
|
||||||
let expected = Spacing::Value(LengthOrPercentage::Length(NoCalcLength::FontRelative(
|
let expected = Spacing::Value(LengthPercentage::Length(NoCalcLength::FontRelative(
|
||||||
FontRelativeLength::Em(-0.5),
|
FontRelativeLength::Em(-0.5),
|
||||||
)));
|
)));
|
||||||
assert_eq!(negative_value, expected);
|
assert_eq!(negative_value, expected);
|
||||||
|
|
|
@ -14,10 +14,10 @@ use style::parser::ParserContext;
|
||||||
use style::shared_lock::{SharedRwLock, StylesheetGuards};
|
use style::shared_lock::{SharedRwLock, StylesheetGuards};
|
||||||
use style::stylesheets::viewport_rule::*;
|
use style::stylesheets::viewport_rule::*;
|
||||||
use style::stylesheets::{CssRuleType, Origin, Stylesheet, StylesheetInDocument};
|
use style::stylesheets::{CssRuleType, Origin, Stylesheet, StylesheetInDocument};
|
||||||
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
use style::values::specified::LengthPercentageOrAuto::{self, Auto};
|
||||||
use style::values::specified::NoCalcLength::{self, ViewportPercentage};
|
use style::values::specified::NoCalcLength::{self, ViewportPercentage};
|
||||||
use style::values::specified::ViewportPercentageLength::Vw;
|
use style::values::specified::ViewportPercentageLength::Vw;
|
||||||
use style::values::specified::LengthOrPercentage;
|
use style::values::specified::LengthPercentage;
|
||||||
use style_traits::viewport::*;
|
use style_traits::viewport::*;
|
||||||
use style_traits::{ParsingMode, PinchZoomFactor};
|
use style_traits::{ParsingMode, PinchZoomFactor};
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ macro_rules! assert_decl_len {
|
||||||
|
|
||||||
macro_rules! viewport_length {
|
macro_rules! viewport_length {
|
||||||
($value:expr, px) => {
|
($value:expr, px) => {
|
||||||
ViewportLength::Specified(LengthOrPercentageOrAuto::LengthOrPercentage(LengthOrPercentage::Length(NoCalcLength::from_px(
|
ViewportLength::Specified(LengthPercentageOrAuto::LengthPercentage(LengthPercentage::Length(NoCalcLength::from_px(
|
||||||
$value,
|
$value,
|
||||||
))))
|
))))
|
||||||
};
|
};
|
||||||
($value:expr, vw) => {
|
($value:expr, vw) => {
|
||||||
ViewportLength::Specified(LengthOrPercentageOrAuto::LengthOrPercentage(LengthOrPercentage::Length(ViewportPercentage(Vw(
|
ViewportLength::Specified(LengthPercentageOrAuto::LengthPercentage(LengthPercentage::Length(ViewportPercentage(Vw(
|
||||||
$value,
|
$value,
|
||||||
)))))
|
)))))
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue