Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-08-15 02:53:35 +02:00 committed by Martin Robinson
parent b6e8088e8e
commit 274d273f50
11 changed files with 81 additions and 70 deletions

View file

@ -653,7 +653,7 @@ impl Fragment {
absolute_bounds: Rect<Au>,
) {
let background = style.get_background();
let background_color = style.resolve_color(background.background_color);
let background_color = style.resolve_color(background.background_color.clone());
// XXXManishearth the below method should ideally use an iterator over
// backgrounds
self.build_display_list_for_background_if_applicable_with_background(
@ -1037,7 +1037,9 @@ impl Fragment {
webrender_api::BoxShadowDisplayItem {
common: items::empty_common_item_properties(),
box_bounds: absolute_bounds.to_layout(),
color: style.resolve_color(box_shadow.base.color).to_layout(),
color: style
.resolve_color(box_shadow.base.color.clone())
.to_layout(),
offset: LayoutVector2D::new(
box_shadow.base.horizontal.px(),
box_shadow.base.vertical.px(),
@ -1083,10 +1085,10 @@ impl Fragment {
let border_style_struct = style.get_border();
let mut colors = SideOffsets2D::new(
border_style_struct.border_top_color,
border_style_struct.border_right_color,
border_style_struct.border_bottom_color,
border_style_struct.border_left_color,
border_style_struct.border_top_color.clone(),
border_style_struct.border_right_color.clone(),
border_style_struct.border_bottom_color.clone(),
border_style_struct.border_left_color.clone(),
);
let mut border_style = SideOffsets2D::new(
border_style_struct.border_top_style,
@ -1316,7 +1318,7 @@ impl Fragment {
// Append the outline to the display list.
let color = style
.resolve_color(style.get_outline().outline_color)
.resolve_color(style.get_outline().outline_color.clone())
.to_layout();
let base = state.create_base_display_item(
clip,
@ -1451,7 +1453,8 @@ impl Fragment {
// TODO: Allow non-text fragments to be selected too.
if scanned_text_fragment_info.selected() {
let style = self.selected_style();
let background_color = style.resolve_color(style.get_background().background_color);
let background_color =
style.resolve_color(style.get_background().background_color.clone());
let base = state.create_base_display_item(
stacking_relative_border_box,
self.node,
@ -2055,7 +2058,7 @@ impl Fragment {
base: base.clone(),
shadow: webrender_api::Shadow {
offset: LayoutVector2D::new(shadow.horizontal.px(), shadow.vertical.px()),
color: self.style.resolve_color(shadow.color).to_layout(),
color: self.style.resolve_color(shadow.color.clone()).to_layout(),
blur_radius: shadow.blur.px(),
},
},

View file

@ -86,7 +86,7 @@ fn convert_gradient_stops(
// Only keep the color stops, discard the color interpolation hints.
let mut stop_items = gradient_items
.iter()
.filter_map(|item| match *item {
.filter_map(|item| match item {
GradientItem::SimpleColorStop(color) => Some(ColorStop {
color,
position: None,
@ -191,7 +191,7 @@ fn convert_gradient_stops(
assert!(offset.is_finite());
stops.push(GradientStop {
offset: offset,
color: style.resolve_color(stop.color).to_layout(),
color: style.resolve_color(stop.color.clone()).to_layout(),
})
}
stops

View file

@ -794,7 +794,7 @@ fn perform_border_collapse_for_row(
child_table_row
.final_collapsed_borders
.inline
.push_or_set(i, *this_inline_border);
.push_or_set(i, this_inline_border.clone());
if i == 0 {
child_table_row.final_collapsed_borders.inline[i].combine(&table_inline_borders.start);
} else if i + 1 == number_of_borders_inline_direction {
@ -821,7 +821,7 @@ fn perform_border_collapse_for_row(
this_border.combine(&previous_block_borders[i]);
}
},
PreviousBlockCollapsedBorders::FromTable(table_border) => {
PreviousBlockCollapsedBorders::FromTable(ref table_border) => {
this_border.combine(&table_border);
},
}
@ -837,7 +837,7 @@ fn perform_border_collapse_for_row(
.iter()
.enumerate()
{
let next_block = next_block.push_or_set(i, *this_block_border);
let next_block = next_block.push_or_set(i, this_block_border.clone());
match next_block_borders {
NextBlockCollapsedBorders::FromNextRow(next_block_borders) => {
if next_block_borders.len() > i {
@ -1358,7 +1358,7 @@ impl<'table> TableCellStyleInfo<'table> {
if background as *const Background == initial.get_background() as *const _ {
return;
}
let background_color = sty.resolve_color(background.background_color);
let background_color = sty.resolve_color(background.background_color.clone());
cell_flow.build_display_list_for_background_if_applicable_with_background(
state,
background,

View file

@ -375,7 +375,7 @@ impl fmt::Debug for TableCellFlow {
}
}
#[derive(Clone, Copy, Debug, Serialize)]
#[derive(Clone, Debug, Serialize)]
pub struct CollapsedBordersForCell {
pub inline_start_border: CollapsedBorder,
pub inline_end_border: CollapsedBorder,
@ -494,10 +494,10 @@ impl CollapsedBordersForCell {
) {
let logical_border_colors = LogicalMargin::new(
writing_mode,
self.block_start_border.color,
self.inline_end_border.color,
self.block_end_border.color,
self.inline_start_border.color,
self.block_start_border.color.clone(),
self.inline_end_border.color.clone(),
self.block_end_border.color.clone(),
self.inline_start_border.color.clone(),
);
*border_colors = logical_border_colors.to_physical(writing_mode);

View file

@ -718,7 +718,7 @@ impl CollapsedBorderSpacingForRow {
}
/// All aspects of a border that can collapse with adjacent borders. See CSS 2.1 § 17.6.2.1.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Debug)]
pub struct CollapsedBorder {
/// The style of the border.
pub style: BorderStyle,
@ -771,7 +771,7 @@ impl CollapsedBorder {
CollapsedBorder {
style: css_style.get_border().border_top_style,
width: Au::from(css_style.get_border().border_top_width),
color: css_style.get_border().border_top_color,
color: css_style.get_border().border_top_color.clone(),
provenance: provenance,
}
}
@ -782,7 +782,7 @@ impl CollapsedBorder {
CollapsedBorder {
style: css_style.get_border().border_right_style,
width: Au::from(css_style.get_border().border_right_width),
color: css_style.get_border().border_right_color,
color: css_style.get_border().border_right_color.clone(),
provenance: provenance,
}
}
@ -796,7 +796,7 @@ impl CollapsedBorder {
CollapsedBorder {
style: css_style.get_border().border_bottom_style,
width: Au::from(css_style.get_border().border_bottom_width),
color: css_style.get_border().border_bottom_color,
color: css_style.get_border().border_bottom_color.clone(),
provenance: provenance,
}
}
@ -807,7 +807,7 @@ impl CollapsedBorder {
CollapsedBorder {
style: css_style.get_border().border_left_style,
width: Au::from(css_style.get_border().border_left_width),
color: css_style.get_border().border_left_color,
color: css_style.get_border().border_left_color.clone(),
provenance: provenance,
}
}
@ -883,18 +883,18 @@ impl CollapsedBorder {
match (self.style, other.style) {
// Step 1.
(BorderStyle::Hidden, _) => {},
(_, BorderStyle::Hidden) => *self = *other,
(_, BorderStyle::Hidden) => *self = other.clone(),
// Step 2.
(BorderStyle::None, _) => *self = *other,
(BorderStyle::None, _) => *self = other.clone(),
(_, BorderStyle::None) => {},
// Step 3.
_ if self.width > other.width => {},
_ if self.width < other.width => *self = *other,
_ if self.width < other.width => *self = other.clone(),
(this_style, other_style) if this_style > other_style => {},
(this_style, other_style) if this_style < other_style => *self = *other,
(this_style, other_style) if this_style < other_style => *self = other.clone(),
// Step 4.
_ if (self.provenance as i8) >= other.provenance as i8 => {},
_ => *self = *other,
_ => *self = other.clone(),
}
}
}
@ -1013,22 +1013,22 @@ fn set_inline_position_of_child_flow(
.collapsed_borders_for_row
.inline
.get(child_index)
.map_or(CollapsedBorder::new(), |x| *x),
.map_or(CollapsedBorder::new(), |x| x.clone()),
inline_end_border: border_collapse_info
.collapsed_borders_for_row
.inline
.get(child_index + 1)
.map_or(CollapsedBorder::new(), |x| *x),
.map_or(CollapsedBorder::new(), |x| x.clone()),
block_start_border: border_collapse_info
.collapsed_borders_for_row
.block_start
.get(child_index)
.map_or(CollapsedBorder::new(), |x| *x),
.map_or(CollapsedBorder::new(), |x| x.clone()),
block_end_border: border_collapse_info
.collapsed_borders_for_row
.block_end
.get(child_index)
.map_or(CollapsedBorder::new(), |x| *x),
.map_or(CollapsedBorder::new(), |x| x.clone()),
inline_start_width: border_collapse_info
.collapsed_border_spacing_for_row
.inline