Skip to content

Commit

Permalink
style: Fix servo build.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Jan 8, 2019
1 parent 80651fd commit c7f30ad
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 117 deletions.
36 changes: 18 additions & 18 deletions components/layout/block.rs
Expand Up @@ -66,7 +66,7 @@ use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::ComputedValues;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::values::computed::{LengthPercentageOrAuto, LengthPercentageOrNone};

/// Information specific to floated blocks.
#[derive(Clone, Serialize)]
Expand Down Expand Up @@ -418,15 +418,15 @@ impl CandidateBSizeIterator {
// `min-height` and `max-height`, percentage values are ignored.

let block_size = match fragment.style.content_block_size() {
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
MaybeAuto::from_option(lp.maybe_to_used_value(block_container_block_size))
},
};

let max_block_size = match fragment.style.max_block_size() {
LengthOrPercentageOrNone::None => None,
LengthOrPercentageOrNone::LengthOrPercentage(ref lp) => {
LengthPercentageOrNone::None => None,
LengthPercentageOrNone::LengthPercentage(ref lp) => {
lp.maybe_to_used_value(block_container_block_size)
},
};
Expand Down Expand Up @@ -1396,7 +1396,7 @@ impl BlockFlow {
let content_block_size = self.fragment.style().content_block_size();

match content_block_size {
LengthOrPercentageOrAuto::Auto => {
LengthPercentageOrAuto::Auto => {
let container_size = containing_block_size?;
let (block_start, block_end) = {
let position = self.fragment.style().logical_position();
Expand All @@ -1415,11 +1415,11 @@ impl BlockFlow {
// calculated during assign-inline-size.
let margin = self.fragment.style().logical_margin();
let margin_block_start = match margin.block_start {
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
};
let margin_block_end = match margin.block_end {
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
};

Expand All @@ -1431,7 +1431,7 @@ impl BlockFlow {
(_, _) => None,
}
},
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
lp.maybe_to_used_value(containing_block_size)
},
}
Expand All @@ -1452,11 +1452,11 @@ impl BlockFlow {
// calculated during assign-inline-size.
let margin = self.fragment.style().logical_margin();
let margin_block_start = match margin.block_start {
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
};
let margin_block_end = match margin.block_end {
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
};

Expand Down Expand Up @@ -2022,7 +2022,7 @@ impl BlockFlow {
// 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
// SERPs falls into this category.
if self.fragment.style.max_inline_size() != LengthOrPercentageOrNone::None {
if self.fragment.style.max_inline_size() != LengthPercentageOrNone::None {
return;
}

Expand Down Expand Up @@ -2153,8 +2153,8 @@ impl Flow for BlockFlow {
// If this block has a fixed width, just use that for the minimum and preferred width,
// rather than bubbling up children inline width.
let consult_children = match self.fragment.style().get_position().width {
LengthOrPercentageOrAuto::Auto => true,
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => lp.maybe_to_used_value(None).is_none(),
LengthPercentageOrAuto::Auto => true,
LengthPercentageOrAuto::LengthPercentage(ref lp) => lp.maybe_to_used_value(None).is_none(),
};
self.bubble_inline_sizes_for_block(consult_children);
self.fragment
Expand Down Expand Up @@ -2541,8 +2541,8 @@ impl Flow for BlockFlow {
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().inline_start ==
LengthOrPercentageOrAuto::Auto &&
self.fragment.style().logical_position().inline_end == LengthOrPercentageOrAuto::Auto
LengthPercentageOrAuto::Auto &&
self.fragment.style().logical_position().inline_end == LengthPercentageOrAuto::Auto
{
self.base.position.start.i = inline_position
}
Expand All @@ -2554,8 +2554,8 @@ impl Flow for BlockFlow {
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().block_start ==
LengthOrPercentageOrAuto::Auto &&
self.fragment.style().logical_position().block_end == LengthOrPercentageOrAuto::Auto
LengthPercentageOrAuto::Auto &&
self.fragment.style().logical_position().block_end == LengthPercentageOrAuto::Auto
{
self.base.position.start.b = block_position
}
Expand Down
6 changes: 3 additions & 3 deletions components/layout/display_list/background.rs
Expand Up @@ -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_origin::single_value::T as BackgroundOrigin;
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::NonNegative;
use style::values::specified::background::BackgroundRepeatKeyword;
Expand Down Expand Up @@ -88,7 +88,7 @@ fn compute_background_image_size(
(
GenericBackgroundSize::Explicit {
width,
height: NonNegative(LengthOrPercentageOrAuto::Auto),
height: NonNegative(LengthPercentageOrAuto::Auto),
},
_,
) => {
Expand All @@ -98,7 +98,7 @@ fn compute_background_image_size(
},
(
GenericBackgroundSize::Explicit {
width: NonNegative(LengthOrPercentageOrAuto::Auto),
width: NonNegative(LengthPercentageOrAuto::Auto),
height,
},
_,
Expand Down
8 changes: 4 additions & 4 deletions components/layout/display_list/gradient.rs
Expand Up @@ -9,7 +9,7 @@ use app_units::Au;
use euclid::{Point2D, Size2D, Vector2D};
use style::properties::ComputedValues;
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::GradientItem as GenericGradientItem;
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
Expand Down Expand Up @@ -107,14 +107,14 @@ fn convert_gradient_stops(
{
let first = stop_items.first_mut().unwrap();
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%.
{
let last = stop_items.last_mut().unwrap();
if last.position.is_none() {
last.position = Some(LengthOrPercentage::new_percent(Percentage(1.0)));
last.position = Some(LengthPercentage::new_percent(Percentage(1.0)));
}
}

Expand Down Expand Up @@ -210,7 +210,7 @@ where
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) {
return 0.0;
}
Expand Down
30 changes: 15 additions & 15 deletions components/layout/flex.rs
Expand Up @@ -29,7 +29,7 @@ use style::properties::ComputedValues;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::flex::FlexBasis;
use style::values::computed::{
LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone,
LengthPercentage, LengthPercentageOrAuto, LengthPercentageOrNone,
};
use style::values::generics::flex::FlexBasis as GenericFlexBasis;

Expand All @@ -46,16 +46,16 @@ impl AxisSize {
/// Generate a new available cross or main axis size from the specified size of the container,
/// containing block size, min constraint, and max constraint
pub fn new(
size: LengthOrPercentageOrAuto,
size: LengthPercentageOrAuto,
content_size: Option<Au>,
min: LengthOrPercentage,
max: LengthOrPercentageOrNone,
min: LengthPercentage,
max: LengthPercentageOrNone,
) -> AxisSize {
match size {
LengthOrPercentageOrAuto::Auto => {
LengthPercentageOrAuto::Auto => {
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) {
Some(length) => AxisSize::Definite(length),
None => AxisSize::Infinite,
Expand All @@ -71,7 +71,7 @@ impl AxisSize {
/// is definite after flex size resolving.
fn from_flex_basis(
flex_basis: FlexBasis,
main_length: LengthOrPercentageOrAuto,
main_length: LengthPercentageOrAuto,
containing_length: Au,
) -> MaybeAuto {
let width = match flex_basis {
Expand All @@ -80,7 +80,7 @@ fn from_flex_basis(
};

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),
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ impl FlexItem {
let block = flow.as_mut_block();
match direction {
// 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
Direction::Inline => {
let basis = from_flex_basis(
Expand Down Expand Up @@ -225,18 +225,18 @@ impl FlexItem {
let mut margin_count = 0;
match direction {
Direction::Inline => {
if margin.inline_start == LengthOrPercentageOrAuto::Auto {
if margin.inline_start == LengthPercentageOrAuto::Auto {
margin_count += 1;
}
if margin.inline_end == LengthOrPercentageOrAuto::Auto {
if margin.inline_end == LengthPercentageOrAuto::Auto {
margin_count += 1;
}
},
Direction::Block => {
if margin.block_start == LengthOrPercentageOrAuto::Auto {
if margin.block_start == LengthPercentageOrAuto::Auto {
margin_count += 1;
}
if margin.block_end == LengthOrPercentageOrAuto::Auto {
if margin.block_end == LengthPercentageOrAuto::Auto {
margin_count += 1;
}
},
Expand Down Expand Up @@ -819,7 +819,7 @@ impl FlexFlow {
// cross size of item should equal to the line size if any auto margin exists.
// https://drafts.csswg.org/css-flexbox/#algo-cross-margins
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) {
Au(0)
} else {
Expand All @@ -833,7 +833,7 @@ impl FlexFlow {

let self_align = block.fragment.style().get_position().align_self;
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);
block.base.block_container_explicit_block_size = Some(line.cross_size);
Expand Down
6 changes: 3 additions & 3 deletions components/layout/floats.rs
Expand Up @@ -10,7 +10,7 @@ use std::cmp::{max, min};
use std::fmt;
use style::computed_values::float::T as StyleFloat;
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::values::computed::LengthOrPercentageOrAuto;
use style::values::computed::LengthPercentageOrAuto;

/// The kind of float: left or right.
#[derive(Clone, Copy, Debug, Serialize)]
Expand Down Expand Up @@ -550,8 +550,8 @@ impl SpeculatedFloatPlacement {
let inline_size =
flow.as_block().fragment.style.content_inline_size();
let fixed = match inline_size {
LengthOrPercentageOrAuto::Auto => false,
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
LengthPercentageOrAuto::Auto => false,
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
lp.is_definitely_zero() || lp.maybe_to_used_value(None).is_some()
}
};
Expand Down
18 changes: 9 additions & 9 deletions components/layout/flow.rs
Expand Up @@ -67,7 +67,7 @@ use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::ComputedValues;
use style::selector_parser::RestyleDamage;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::LengthOrPercentageOrAuto;
use style::values::computed::LengthPercentageOrAuto;
use webrender_api::LayoutTransform;

/// This marker trait indicates that a type is a struct with `#[repr(C)]` whose first field
Expand Down Expand Up @@ -1068,13 +1068,13 @@ impl BaseFlow {
flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);

let logical_position = style.logical_position();
if logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
logical_position.inline_end == LengthOrPercentageOrAuto::Auto
if logical_position.inline_start == LengthPercentageOrAuto::Auto &&
logical_position.inline_end == LengthPercentageOrAuto::Auto
{
flags.insert(FlowFlags::INLINE_POSITION_IS_STATIC);
}
if logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
logical_position.block_end == LengthOrPercentageOrAuto::Auto
if logical_position.block_start == LengthPercentageOrAuto::Auto &&
logical_position.block_end == LengthPercentageOrAuto::Auto
{
flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC);
}
Expand Down Expand Up @@ -1161,13 +1161,13 @@ impl BaseFlow {
let logical_position = style.logical_position();
self.flags.set(
FlowFlags::INLINE_POSITION_IS_STATIC,
logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
logical_position.inline_end == LengthOrPercentageOrAuto::Auto,
logical_position.inline_start == LengthPercentageOrAuto::Auto &&
logical_position.inline_end == LengthPercentageOrAuto::Auto,
);
self.flags.set(
FlowFlags::BLOCK_POSITION_IS_STATIC,
logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
logical_position.block_end == LengthOrPercentageOrAuto::Auto,
logical_position.block_start == LengthPercentageOrAuto::Auto &&
logical_position.block_end == LengthPercentageOrAuto::Auto,
);
}
}
Expand Down

0 comments on commit c7f30ad

Please sign in to comment.