mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rustfmt recent changes.
This commit is contained in:
parent
c7f30ad0df
commit
2a6cdaa30a
22 changed files with 141 additions and 172 deletions
|
@ -431,8 +431,11 @@ impl CandidateBSizeIterator {
|
|||
},
|
||||
};
|
||||
|
||||
let min_block_size =
|
||||
fragment.style.min_block_size().maybe_to_used_value(block_container_block_size).unwrap_or(Au(0));
|
||||
let min_block_size = fragment
|
||||
.style
|
||||
.min_block_size()
|
||||
.maybe_to_used_value(block_container_block_size)
|
||||
.unwrap_or(Au(0));
|
||||
|
||||
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
||||
let adjustment_for_box_sizing = match fragment.style.get_position().box_sizing {
|
||||
|
@ -2154,7 +2157,9 @@ impl Flow for BlockFlow {
|
|||
// rather than bubbling up children inline width.
|
||||
let consult_children = match self.fragment.style().get_position().width {
|
||||
LengthPercentageOrAuto::Auto => true,
|
||||
LengthPercentageOrAuto::LengthPercentage(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.fragment
|
||||
|
@ -2540,8 +2545,7 @@ impl Flow for BlockFlow {
|
|||
.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.fragment.style().logical_position().inline_start ==
|
||||
LengthPercentageOrAuto::Auto &&
|
||||
self.fragment.style().logical_position().inline_start == LengthPercentageOrAuto::Auto &&
|
||||
self.fragment.style().logical_position().inline_end == LengthPercentageOrAuto::Auto
|
||||
{
|
||||
self.base.position.start.i = inline_position
|
||||
|
@ -2553,8 +2557,7 @@ impl Flow for BlockFlow {
|
|||
.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.fragment.style().logical_position().block_start ==
|
||||
LengthPercentageOrAuto::Auto &&
|
||||
self.fragment.style().logical_position().block_start == LengthPercentageOrAuto::Auto &&
|
||||
self.fragment.style().logical_position().block_end == LengthPercentageOrAuto::Auto
|
||||
{
|
||||
self.base.position.start.b = block_position
|
||||
|
|
|
@ -28,9 +28,7 @@ use style::logical_geometry::{Direction, LogicalSize};
|
|||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::flex::FlexBasis;
|
||||
use style::values::computed::{
|
||||
LengthPercentage, LengthPercentageOrAuto, LengthPercentageOrNone,
|
||||
};
|
||||
use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, LengthPercentageOrNone};
|
||||
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
|
||||
|
||||
/// The size of an axis. May be a specified size, a min/max
|
||||
|
@ -54,13 +52,13 @@ impl AxisSize {
|
|||
match size {
|
||||
LengthPercentageOrAuto::Auto => {
|
||||
AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None))
|
||||
}
|
||||
},
|
||||
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
match lp.maybe_to_used_value(content_size) {
|
||||
Some(length) => AxisSize::Definite(length),
|
||||
None => AxisSize::Infinite,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -459,10 +457,9 @@ impl FlexFlow {
|
|||
// stripped out, and max replaced with union_nonbreaking_inline.
|
||||
fn inline_mode_bubble_inline_sizes(&mut self) {
|
||||
// FIXME(emilio): This doesn't handle at all writing-modes.
|
||||
let fixed_width = !model::style_length(
|
||||
self.block_flow.fragment.style().get_position().width,
|
||||
None,
|
||||
).is_auto();
|
||||
let fixed_width =
|
||||
!model::style_length(self.block_flow.fragment.style().get_position().width, None)
|
||||
.is_auto();
|
||||
|
||||
let mut computation = self.block_flow.fragment.compute_intrinsic_inline_sizes();
|
||||
if !fixed_width {
|
||||
|
@ -486,10 +483,9 @@ impl FlexFlow {
|
|||
// Currently, this is the core of BlockFlow::bubble_inline_sizes() with all float logic
|
||||
// stripped out.
|
||||
fn block_mode_bubble_inline_sizes(&mut self) {
|
||||
let fixed_width = !model::style_length(
|
||||
self.block_flow.fragment.style().get_position().width,
|
||||
None,
|
||||
).is_auto();
|
||||
let fixed_width =
|
||||
!model::style_length(self.block_flow.fragment.style().get_position().width, None)
|
||||
.is_auto();
|
||||
|
||||
let mut computation = self.block_flow.fragment.compute_intrinsic_inline_sizes();
|
||||
if !fixed_width {
|
||||
|
|
|
@ -547,13 +547,12 @@ impl SpeculatedFloatPlacement {
|
|||
// nonzero value (in this case, 1px) so that the layout
|
||||
// traversal logic will know that objects later in the document
|
||||
// might flow around this float.
|
||||
let inline_size =
|
||||
flow.as_block().fragment.style.content_inline_size();
|
||||
let inline_size = flow.as_block().fragment.style.content_inline_size();
|
||||
let fixed = match inline_size {
|
||||
LengthPercentageOrAuto::Auto => false,
|
||||
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.is_definitely_zero() || lp.maybe_to_used_value(None).is_some()
|
||||
}
|
||||
},
|
||||
};
|
||||
if !fixed {
|
||||
float_inline_size = Au::from_px(1)
|
||||
|
|
|
@ -1614,7 +1614,7 @@ impl Fragment {
|
|||
LengthPercentageOrAuto::Auto => None,
|
||||
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let mut inline_size = inline_size.unwrap_or_else(|| {
|
||||
|
@ -1622,8 +1622,7 @@ impl Fragment {
|
|||
// the size constraints work properly.
|
||||
// TODO(stshine): Find a cleaner way to do this.
|
||||
let padding = self.style.logical_padding();
|
||||
self.border_padding.inline_start =
|
||||
padding.inline_start.to_used_value(Au(0));
|
||||
self.border_padding.inline_start = padding.inline_start.to_used_value(Au(0));
|
||||
self.border_padding.inline_end = padding.inline_end.to_used_value(Au(0));
|
||||
self.border_padding.block_start = padding.block_start.to_used_value(Au(0));
|
||||
self.border_padding.block_end = padding.block_end.to_used_value(Au(0));
|
||||
|
|
|
@ -481,7 +481,6 @@ impl MaybeAuto {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn map<F>(&self, mapper: F) -> MaybeAuto
|
||||
where
|
||||
|
@ -497,15 +496,12 @@ impl MaybeAuto {
|
|||
/// Receive an optional container size and return used value for width or height.
|
||||
///
|
||||
/// `style_length`: content size as given in the CSS.
|
||||
pub fn style_length(
|
||||
style_length: LengthPercentageOrAuto,
|
||||
container_size: Option<Au>,
|
||||
) -> MaybeAuto {
|
||||
pub fn style_length(style_length: LengthPercentageOrAuto, container_size: Option<Au>) -> MaybeAuto {
|
||||
match style_length {
|
||||
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::from_option(lp.maybe_to_used_value(container_size))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,8 +570,9 @@ impl SizeConstraint {
|
|||
max_size: LengthPercentageOrNone,
|
||||
border: Option<Au>,
|
||||
) -> SizeConstraint {
|
||||
let mut min_size =
|
||||
min_size.maybe_to_used_value(container_size).unwrap_or(Au(0));
|
||||
let mut min_size = min_size
|
||||
.maybe_to_used_value(container_size)
|
||||
.unwrap_or(Au(0));
|
||||
|
||||
let mut max_size = match max_size {
|
||||
LengthPercentageOrNone::None => None,
|
||||
|
|
|
@ -158,15 +158,13 @@ impl Flow for MulticolFlow {
|
|||
LengthPercentageOrAuto::Auto => None,
|
||||
LengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None)
|
||||
}
|
||||
},
|
||||
};
|
||||
let size = size.or_else(|| {
|
||||
match style.max_block_size() {
|
||||
LengthPercentageOrNone::None => None,
|
||||
LengthPercentageOrNone::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None)
|
||||
}
|
||||
}
|
||||
let size = size.or_else(|| match style.max_block_size() {
|
||||
LengthPercentageOrNone::None => None,
|
||||
LengthPercentageOrNone::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None)
|
||||
},
|
||||
});
|
||||
|
||||
size.unwrap_or_else(|| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue