diff options
Diffstat (limited to 'components/layout_2020')
-rw-r--r-- | components/layout_2020/display_list/gradient.rs | 18 | ||||
-rw-r--r-- | components/layout_2020/display_list/mod.rs | 4 | ||||
-rw-r--r-- | components/layout_2020/dom_traversal.rs | 2 | ||||
-rw-r--r-- | components/layout_2020/flow/inline/line.rs | 4 | ||||
-rw-r--r-- | components/layout_2020/flow/inline/mod.rs | 4 | ||||
-rw-r--r-- | components/layout_2020/flow/mod.rs | 10 | ||||
-rw-r--r-- | components/layout_2020/query.rs | 2 | ||||
-rw-r--r-- | components/layout_2020/style_ext.rs | 4 | ||||
-rw-r--r-- | components/layout_2020/table/construct.rs | 6 | ||||
-rw-r--r-- | components/layout_2020/table/layout.rs | 27 | ||||
-rw-r--r-- | components/layout_2020/taffy/layout.rs | 4 | ||||
-rw-r--r-- | components/layout_2020/tests/floats.rs | 2 |
12 files changed, 43 insertions, 44 deletions
diff --git a/components/layout_2020/display_list/gradient.rs b/components/layout_2020/display_list/gradient.rs index 26f6882f49c..32d011b4454 100644 --- a/components/layout_2020/display_list/gradient.rs +++ b/components/layout_2020/display_list/gradient.rs @@ -33,10 +33,10 @@ pub(super) fn build( ) -> WebRenderGradient { match gradient { Gradient::Linear { - ref items, - ref direction, - ref color_interpolation_method, - ref flags, + items, + direction, + color_interpolation_method, + flags, compat_mode: _, } => build_linear( style, @@ -48,11 +48,11 @@ pub(super) fn build( builder, ), Gradient::Radial { - ref shape, - ref position, - ref color_interpolation_method, - ref items, - ref flags, + shape, + position, + color_interpolation_method, + items, + flags, compat_mode: _, } => build_radial( style, diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index 5f2e709530a..696aecefeda 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -780,7 +780,7 @@ impl<'a> BuilderForBoxFragment<'a> { for (index, image) in b.background_image.0.iter().enumerate().rev() { match image { Image::None => {}, - Image::Gradient(ref gradient) => { + Image::Gradient(gradient) => { let intrinsic = NaturalSizes::empty(); let Some(layer) = &background::layout_layer(self, painter, builder, index, intrinsic) @@ -816,7 +816,7 @@ impl<'a> BuilderForBoxFragment<'a> { }, } }, - Image::Url(ref image_url) => { + Image::Url(image_url) => { // FIXME: images won’t always have in intrinsic width or // height when support for SVG is added, or a WebRender // `ImageKey`, for that matter. diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index eca173ff838..6b44c7f46b4 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -417,7 +417,7 @@ where Node: NodeExt<'dom>, { match &pseudo_element_style.get_counters().content { - Content::Items(ref items) => { + Content::Items(items) => { let mut vec = vec![]; for item in items.items.iter() { match item { diff --git a/components/layout_2020/flow/inline/line.rs b/components/layout_2020/flow/inline/line.rs index 88ba145fe42..420d79ead9f 100644 --- a/components/layout_2020/flow/inline/line.rs +++ b/components/layout_2020/flow/inline/line.rs @@ -740,7 +740,7 @@ impl LineItem { match self { LineItem::InlineStartBoxPaddingBorderMargin(_) => true, LineItem::InlineEndBoxPaddingBorderMargin(_) => true, - LineItem::TextRun(_, ref mut item) => item.trim_whitespace_at_end(whitespace_trimmed), + LineItem::TextRun(_, item) => item.trim_whitespace_at_end(whitespace_trimmed), LineItem::Atomic(..) => false, LineItem::AbsolutelyPositioned(..) => true, LineItem::Float(..) => true, @@ -751,7 +751,7 @@ impl LineItem { match self { LineItem::InlineStartBoxPaddingBorderMargin(_) => true, LineItem::InlineEndBoxPaddingBorderMargin(_) => true, - LineItem::TextRun(_, ref mut item) => item.trim_whitespace_at_start(whitespace_trimmed), + LineItem::TextRun(_, item) => item.trim_whitespace_at_start(whitespace_trimmed), LineItem::Atomic(..) => false, LineItem::AbsolutelyPositioned(..) => true, LineItem::Float(..) => true, diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout_2020/flow/inline/mod.rs index 18a076227b5..a43a9333040 100644 --- a/components/layout_2020/flow/inline/mod.rs +++ b/components/layout_2020/flow/inline/mod.rs @@ -1534,7 +1534,7 @@ impl InlineFormattingContext { let mut new_linebreaker = LineBreaker::new(text_content.as_str()); for item in builder.inline_items.iter() { match &mut *item.borrow_mut() { - InlineItem::TextRun(ref mut text_run) => { + InlineItem::TextRun(text_run) => { text_run.borrow_mut().segment_and_shape( &text_content, &layout_context.font_context, @@ -1683,7 +1683,7 @@ impl InlineFormattingContext { }, )); }, - InlineItem::OutOfFlowFloatBox(ref float_box) => { + InlineItem::OutOfFlowFloatBox(float_box) => { float_box.layout_into_line_items(&mut layout); }, } diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 0fb44aba158..95ae394c29d 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -113,7 +113,7 @@ impl BlockLevelBox { BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(_) | BlockLevelBox::OutOfFlowFloatBox(_) => return true, BlockLevelBox::OutsideMarker(_) => return false, - BlockLevelBox::Independent(ref context) => { + BlockLevelBox::Independent(context) => { // FIXME: If the element doesn't fit next to floats, it will get clearance. // In that case this should be returning false. context.layout_style() @@ -135,7 +135,7 @@ impl BlockLevelBox { collected_margin.adjoin_assign(&CollapsedMargin::new(margin.block_start)); let child_boxes = match self { - BlockLevelBox::SameFormattingContextBlock { ref contents, .. } => match contents { + BlockLevelBox::SameFormattingContextBlock { contents, .. } => match contents { BlockContainer::BlockLevelBoxes(boxes) => boxes, BlockContainer::InlineFormattingContext(_) => return false, }, @@ -427,7 +427,7 @@ fn compute_inline_content_sizes_for_block_level_boxes( match &*box_.borrow() { BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(_) | BlockLevelBox::OutsideMarker { .. } => None, - BlockLevelBox::OutOfFlowFloatBox(ref float_box) => { + BlockLevelBox::OutOfFlowFloatBox(float_box) => { let inline_content_sizes_result = float_box.contents.outer_inline_content_sizes( layout_context, containing_block, @@ -465,7 +465,7 @@ fn compute_inline_content_sizes_for_block_level_boxes( // Instead, we treat it like an independent block with 'clear: both'. Some((inline_content_sizes_result, None, Clear::Both)) }, - BlockLevelBox::Independent(ref independent) => { + BlockLevelBox::Independent(independent) => { let inline_content_sizes_result = independent.outer_inline_content_sizes( layout_context, containing_block, @@ -2149,7 +2149,7 @@ fn block_size_is_zero_or_intrinsic(size: &StyleSize, containing_block: &Containi StyleSize::MaxContent | StyleSize::FitContent | StyleSize::Stretch => true, - StyleSize::LengthPercentage(ref lp) => { + StyleSize::LengthPercentage(lp) => { // TODO: Should this resolve definite percentages? Blink does it, Gecko and WebKit don't. lp.is_definitely_zero() || (lp.0.has_percentage() && !containing_block.size.block.is_definite()) diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs index 13f7f82b15c..a320e44dc46 100644 --- a/components/layout_2020/query.rs +++ b/components/layout_2020/query.rs @@ -191,7 +191,7 @@ pub fn process_resolved_style_request<'dom>( } let (content_rect, margins, padding, specific_layout_info) = match fragment { - Fragment::Box(ref box_fragment) | Fragment::Float(ref box_fragment) => { + Fragment::Box(box_fragment) | Fragment::Float(box_fragment) => { let box_fragment = box_fragment.borrow(); if style.get_box().position != Position::Static { let resolved_insets = || { diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs index a4fa6600fea..2d52303129c 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout_2020/style_ext.rs @@ -338,7 +338,7 @@ impl ComputedValuesExt for ComputedValues { fn physical_box_offsets(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>> { fn convert(inset: &Inset) -> LengthPercentageOrAuto<'_> { match inset { - Inset::LengthPercentage(ref v) => LengthPercentageOrAuto::LengthPercentage(v), + Inset::LengthPercentage(v) => LengthPercentageOrAuto::LengthPercentage(v), Inset::Auto => LengthPercentageOrAuto::Auto, Inset::AnchorFunction(_) => unreachable!("anchor() should be disabled"), Inset::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"), @@ -460,7 +460,7 @@ impl ComputedValuesExt for ComputedValues { fn physical_margin(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>> { fn convert(inset: &Margin) -> LengthPercentageOrAuto<'_> { match inset { - Margin::LengthPercentage(ref v) => LengthPercentageOrAuto::LengthPercentage(v), + Margin::LengthPercentage(v) => LengthPercentageOrAuto::LengthPercentage(v), Margin::Auto => LengthPercentageOrAuto::Auto, Margin::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"), } diff --git a/components/layout_2020/table/construct.rs b/components/layout_2020/table/construct.rs index f6578033043..9e18aef04d2 100644 --- a/components/layout_2020/table/construct.rs +++ b/components/layout_2020/table/construct.rs @@ -63,7 +63,7 @@ impl<Node> AnonymousTableContent<'_, Node> { fn is_whitespace_only(&self) -> bool { match self { Self::Element { .. } => false, - Self::Text(_, ref text) => text.chars().all(char_is_whitespace), + Self::Text(_, text) => text.chars().all(char_is_whitespace), } } @@ -170,7 +170,7 @@ impl Table { let slot = self.get_slot(coords); match slot { Some(TableSlot::Cell(cell)) => vec![ResolvedSlotAndLocation { cell, coords }], - Some(TableSlot::Spanned(ref offsets)) => offsets + Some(TableSlot::Spanned(offsets)) => offsets .iter() .flat_map(|offset| self.resolve_slot_at(coords - *offset)) .collect(), @@ -434,7 +434,7 @@ impl TableBuilder { for row_index in 0..self.table.size.height { let last_row_index_in_group = self.last_row_index_in_row_group_at_row_n(row_index); for cell in self.table.slots[row_index].iter_mut() { - if let TableSlot::Cell(ref mut cell) = cell { + if let TableSlot::Cell(cell) = cell { if cell.rowspan == 1 { continue; } diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index 8c526d0aed9..35f26417bb1 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -1093,7 +1093,7 @@ impl<'a> TableLayout<'a> { .par_iter() .enumerate() .map(|(column_index, slot)| { - let TableSlot::Cell(ref cell) = slot else { + let TableSlot::Cell(cell) = slot else { return None; }; @@ -2303,19 +2303,18 @@ impl<'a> RowFragmentLayout<'a> { relative_adjustement(&self.row.style, containing_block_for_children); } - let (inline_size, block_size) = - if let Some(ref row_group_layout) = row_group_fragment_layout { - self.rect.start_corner -= row_group_layout.rect.start_corner; - ( - row_group_layout.rect.size.inline, - SizeConstraint::Definite(row_group_layout.rect.size.block), - ) - } else { - ( - containing_block_for_logical_conversion.size.inline, - containing_block_for_logical_conversion.size.block, - ) - }; + let (inline_size, block_size) = if let Some(row_group_layout) = row_group_fragment_layout { + self.rect.start_corner -= row_group_layout.rect.start_corner; + ( + row_group_layout.rect.size.inline, + SizeConstraint::Definite(row_group_layout.rect.size.block), + ) + } else { + ( + containing_block_for_logical_conversion.size.inline, + containing_block_for_logical_conversion.size.block, + ) + }; let row_group_containing_block = ContainingBlock { size: ContainingBlockSize { diff --git a/components/layout_2020/taffy/layout.rs b/components/layout_2020/taffy/layout.rs index 0d7e34af882..1e58464629f 100644 --- a/components/layout_2020/taffy/layout.rs +++ b/components/layout_2020/taffy/layout.rs @@ -52,8 +52,8 @@ fn with_independant_formatting_context<T>( cb: impl FnOnce(&IndependentFormattingContext) -> T, ) -> T { match item { - TaffyItemBoxInner::InFlowBox(ref mut context) => cb(context), - TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(ref abspos_box) => { + TaffyItemBoxInner::InFlowBox(context) => cb(context), + TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(abspos_box) => { cb(&AtomicRefCell::borrow(abspos_box).context) }, } diff --git a/components/layout_2020/tests/floats.rs b/components/layout_2020/tests/floats.rs index 1d1fb93d2c2..8c5cd019a0c 100644 --- a/components/layout_2020/tests/floats.rs +++ b/components/layout_2020/tests/floats.rs @@ -302,7 +302,7 @@ fn test_tree_range_setting() { quickcheck::quickcheck(f); fn check(bands: Vec<FloatBandWrapper>, ranges: Vec<FloatRangeInput>) { let mut tree = FloatBandTree::new(); - for FloatBandWrapper(ref band) in &bands { + for FloatBandWrapper(band) in &bands { tree = tree.insert(*band); } |