Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -89,7 +89,10 @@ pub fn update_animation_state<E>(
},
};
debug!("update_animation_state({:?}): {:?}", still_running, running_animation);
debug!(
"update_animation_state({:?}): {:?}",
still_running, running_animation
);
if still_running {
animations_still_running.push(running_animation);
@ -97,11 +100,13 @@ pub fn update_animation_state<E>(
}
if let Animation::Transition(node, _, ref frame) = running_animation {
script_chan.send(ConstellationControlMsg::TransitionEnd(
node.to_untrusted_node_address(),
frame.property_animation.property_name().into(),
frame.duration,
)).unwrap();
script_chan
.send(ConstellationControlMsg::TransitionEnd(
node.to_untrusted_node_address(),
frame.property_animation.property_name().into(),
frame.duration,
))
.unwrap();
}
expired_animations
@ -150,7 +155,8 @@ pub fn update_animation_state<E>(
.send(ConstellationMsg::ChangeRunningAnimationsState(
pipeline_id,
animation_state,
)).unwrap();
))
.unwrap();
}
/// Recalculates style for a set of animations. This does *not* run with the DOM

View file

@ -1334,7 +1334,8 @@ impl BlockFlow {
self.fragment.style.writing_mode,
inline_size_for_float_placement,
block_size + self.fragment.margin.block_start_end(),
).convert(
)
.convert(
self.fragment.style.writing_mode,
self.base.floats.writing_mode,
),
@ -1361,7 +1362,8 @@ impl BlockFlow {
self.base.floats.writing_mode,
self.base.writing_mode,
container_size,
).start;
)
.start;
let margin_offset = LogicalPoint::new(
self.base.writing_mode,
Au(0),
@ -2626,7 +2628,8 @@ impl Flow for BlockFlow {
.early_absolute_position_info
.relative_containing_block_mode,
CoordinateSystem::Own,
).translate(&stacking_context_position.to_vector()),
)
.translate(&stacking_context_position.to_vector()),
);
}

View file

@ -185,7 +185,8 @@ impl InlineBlockSplit {
predecessors: mem::replace(
fragment_accumulator,
InlineFragmentsAccumulator::from_inline_node(node, style_context),
).to_intermediate_inline_fragments::<ConcreteThreadSafeLayoutNode>(style_context),
)
.to_intermediate_inline_fragments::<ConcreteThreadSafeLayoutNode>(style_context),
flow: flow,
};
@ -402,7 +403,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
&self.layout_context,
));
SpecificFragmentInfo::Image(image_info)
}
},
Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement)) => {
let data = node.media_data().unwrap();
SpecificFragmentInfo::Media(Box::new(MediaFragmentInfo::new(data)))

View file

@ -590,7 +590,8 @@ impl ClippingRegion {
rect: complex.rect.translate(delta),
radii: complex.radii,
mode: complex.mode,
}).collect(),
})
.collect(),
}
}

View file

@ -922,7 +922,8 @@ impl Flow for FlexFlow {
.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
}).map(|(index, flow)| FlexItem::new(index, flow))
})
.map(|(index, flow)| FlexItem::new(index, flow))
.collect();
items.sort_by_key(|item| item.order);

View file

@ -416,23 +416,28 @@ impl ImageFragmentInfo {
layout_context: &LayoutContext,
) -> ImageFragmentInfo {
// First use any image data present in the element...
let image_or_metadata = node.image_data().and_then(|(image, metadata)| {
match (image, metadata) {
let image_or_metadata = node
.image_data()
.and_then(|(image, metadata)| match (image, metadata) {
(Some(image), _) => Some(ImageOrMetadata::Image(image)),
(None, Some(metadata)) => Some(ImageOrMetadata::Metadata(metadata)),
_ => None,
}
}).or_else(|| url.and_then(|url| {
// Otherwise query the image cache for anything known about the associated source URL.
layout_context.get_or_request_image_or_meta(
node.opaque(),
url,
UsePlaceholder::Yes
).map(|result| match result {
ImageOrMetadataAvailable::ImageAvailable(i, _) => ImageOrMetadata::Image(i),
ImageOrMetadataAvailable::MetadataAvailable(m) => ImageOrMetadata::Metadata(m),
})
}));
.or_else(|| {
url.and_then(|url| {
// Otherwise query the image cache for anything known about the associated source URL.
layout_context
.get_or_request_image_or_meta(node.opaque(), url, UsePlaceholder::Yes)
.map(|result| match result {
ImageOrMetadataAvailable::ImageAvailable(i, _) => {
ImageOrMetadata::Image(i)
},
ImageOrMetadataAvailable::MetadataAvailable(m) => {
ImageOrMetadata::Metadata(m)
},
})
})
});
let current_pixel_density = density.unwrap_or(1f64);
@ -452,15 +457,13 @@ impl ImageFragmentInfo {
}),
)
},
Some(ImageOrMetadata::Metadata(m)) => {
(
None,
Some(ImageMetadata {
height: (m.height as f64 / current_pixel_density) as u32,
width: (m.width as f64 / current_pixel_density) as u32,
}),
)
},
Some(ImageOrMetadata::Metadata(m)) => (
None,
Some(ImageMetadata {
height: (m.height as f64 / current_pixel_density) as u32,
width: (m.width as f64 / current_pixel_density) as u32,
}),
),
None => (None, None),
};
@ -1012,7 +1015,7 @@ impl Fragment {
} else {
Au(0)
}
}
},
SpecificFragmentInfo::Media(ref info) => {
if let Some((_, width, _)) = info.current_frame {
Au::from_px(width as i32)
@ -1042,7 +1045,7 @@ impl Fragment {
} else {
Au(0)
}
}
},
SpecificFragmentInfo::Media(ref info) => {
if let Some((_, _, height)) = info.current_frame {
Au::from_px(height as i32)
@ -1174,17 +1177,21 @@ impl Fragment {
(_, Ordering::Equal) => (first_isize, first_bsize),
// When both rectangles grow (smaller than min sizes),
// Choose the larger one;
(Ordering::Greater, Ordering::Greater) => if first_isize > second_isize {
(first_isize, first_bsize)
} else {
(second_isize, second_bsize)
(Ordering::Greater, Ordering::Greater) => {
if first_isize > second_isize {
(first_isize, first_bsize)
} else {
(second_isize, second_bsize)
}
},
// When both rectangles shrink (larger than max sizes),
// Choose the smaller one;
(Ordering::Less, Ordering::Less) => if first_isize > second_isize {
(second_isize, second_bsize)
} else {
(first_isize, first_bsize)
(Ordering::Less, Ordering::Less) => {
if first_isize > second_isize {
(second_isize, second_bsize)
} else {
(first_isize, first_bsize)
}
},
// It does not matter which we choose here, because both sizes
// will be clamped to constraint;
@ -3173,7 +3180,8 @@ impl Fragment {
perspective_origin
.vertical
.to_used_value(stacking_relative_border_box.size.height),
).to_layout();
)
.to_layout();
let pre_transform = LayoutTransform::create_translation(
perspective_origin.x,

View file

@ -316,7 +316,8 @@ impl LineBreaker {
.map(|fragment| match fragment.specific {
SpecificFragmentInfo::ScannedText(ref info) => info.run.bidi_level,
_ => para_level,
}).collect();
})
.collect();
let mut lines = mem::replace(&mut self.lines, Vec::new());
@ -336,7 +337,8 @@ impl LineBreaker {
let start = FragmentIndex(run.start as isize);
let len = FragmentIndex(run.len() as isize);
(Range::new(start, len), levels[run.start])
}).collect(),
})
.collect(),
);
}
}
@ -1719,7 +1721,8 @@ impl Flow for InlineFlow {
debug_assert!(first_fragment_index < self.fragments.fragments.len());
let first_fragment = &self.fragments.fragments[first_fragment_index];
let padding_box_origin = (first_fragment.border_box -
first_fragment.style.logical_border_width()).start;
first_fragment.style.logical_border_width())
.start;
containing_block_positions.push(
padding_box_origin.to_physical(self.base.writing_mode, container_size),
);
@ -1733,7 +1736,8 @@ impl Flow for InlineFlow {
debug_assert!(first_fragment_index < self.fragments.fragments.len());
let first_fragment = &self.fragments.fragments[first_fragment_index];
let padding_box_origin = (first_fragment.border_box -
first_fragment.style.logical_border_width()).start;
first_fragment.style.logical_border_width())
.start;
containing_block_positions.push(
padding_box_origin.to_physical(self.base.writing_mode, container_size),
);
@ -1878,7 +1882,8 @@ impl Flow for InlineFlow {
relative_containing_block_size,
relative_containing_block_mode,
CoordinateSystem::Own,
).translate(&stacking_context_position.to_vector()),
)
.translate(&stacking_context_position.to_vector()),
)
}
}

View file

@ -257,7 +257,8 @@ impl Flow for ListItemFlow {
.early_absolute_position_info
.relative_containing_block_mode,
CoordinateSystem::Own,
).translate(&stacking_context_position.to_vector()),
)
.translate(&stacking_context_position.to_vector()),
);
}
}

View file

@ -505,10 +505,12 @@ pub fn style_length(
) -> MaybeAuto {
match container_size {
Some(length) => MaybeAuto::from_style(style_length, length),
None => if let LengthOrPercentageOrAuto::Length(length) = style_length {
MaybeAuto::Specified(Au::from(length))
} else {
MaybeAuto::Auto
None => {
if let LengthOrPercentageOrAuto::Length(length) = style_length {
MaybeAuto::Specified(Au::from(length))
} else {
MaybeAuto::Auto
}
},
}
}
@ -580,19 +582,23 @@ impl SizeConstraint {
) -> SizeConstraint {
let mut min_size = match container_size {
Some(container_size) => min_size.to_used_value(container_size),
None => if let LengthOrPercentage::Length(length) = min_size {
Au::from(length)
} else {
Au(0)
None => {
if let LengthOrPercentage::Length(length) = min_size {
Au::from(length)
} else {
Au(0)
}
},
};
let mut max_size = match container_size {
Some(container_size) => max_size.to_used_value(container_size),
None => if let LengthOrPercentageOrNone::Length(length) = max_size {
Some(Au::from(length))
} else {
None
None => {
if let LengthOrPercentageOrNone::Length(length) = max_size {
Some(Au::from(length))
} else {
None
}
},
};
// Make sure max size is not smaller than min size.

View file

@ -164,7 +164,8 @@ impl Flow for MulticolFlow {
LogicalSize::from_physical(
self.block_flow.base.writing_mode,
ctx.shared_context().viewport_size(),
).block
)
.block
}
},
});

View file

@ -603,7 +603,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
// cause this assertion to fail sometimes, so it's
// commented out for now.
/*assert!(node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT),
"First fragment of inline node found wasn't its first fragment!");*/
"First fragment of inline node found wasn't its first fragment!");*/
self.node_offset_box = Some(NodeOffsetBoxInfo {
offset: border_box.origin,
@ -840,12 +840,11 @@ where
let applies = true;
fn used_value_for_position_property<N: LayoutNode>(
layout_el: <N::ConcreteThreadSafeLayoutNode as ThreadSafeLayoutNode>::ConcreteThreadSafeLayoutElement,
layout_root: &mut Flow,
requested_node: N,
longhand_id: LonghandId,
) -> String
{
layout_el: <N::ConcreteThreadSafeLayoutNode as ThreadSafeLayoutNode>::ConcreteThreadSafeLayoutElement,
layout_root: &mut Flow,
requested_node: N,
longhand_id: LonghandId,
) -> String {
let maybe_data = layout_el.borrow_layout_data();
let position = maybe_data.map_or(Point2D::zero(), |data| {
match (*data).flow_construction_result {

View file

@ -197,7 +197,8 @@ impl Flow for TableCellFlow {
let specified_inline_size = MaybeAuto::from_style(
self.block_flow.fragment.style().content_inline_size(),
Au(0),
).specified_or_zero();
)
.specified_or_zero();
if self
.block_flow
.base

View file

@ -143,7 +143,8 @@ impl TableWrapperFlow {
);
total_guess = &total_guess + &guess;
guess
}).collect();
})
.collect();
// Assign inline sizes.
let selection =
@ -385,7 +386,8 @@ impl Flow for TableWrapperFlow {
size: column_intrinsic_inline_size.minimum_length,
percentage: column_intrinsic_inline_size.percentage,
},
).collect::<Vec<_>>();
)
.collect::<Vec<_>>();
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
// Now compute the real value.
@ -753,17 +755,17 @@ impl ExcessInlineSizeDistributionInfo {
if !column_intrinsic_inline_size.constrained &&
column_intrinsic_inline_size.percentage == 0.0
{
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage =
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage +
column_intrinsic_inline_size.preferred;
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage = self
.preferred_inline_size_of_nonconstrained_columns_with_no_percentage +
column_intrinsic_inline_size.preferred;
self.count_of_nonconstrained_columns_with_no_percentage += 1
}
if column_intrinsic_inline_size.constrained &&
column_intrinsic_inline_size.percentage == 0.0
{
self.preferred_inline_size_of_constrained_columns_with_no_percentage =
self.preferred_inline_size_of_constrained_columns_with_no_percentage +
column_intrinsic_inline_size.preferred
self.preferred_inline_size_of_constrained_columns_with_no_percentage = self
.preferred_inline_size_of_constrained_columns_with_no_percentage +
column_intrinsic_inline_size.preferred
}
self.total_percentage += column_intrinsic_inline_size.percentage;
self.column_count += 1