aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/display_list/builder.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-09-08 08:53:15 +0200
committerGitHub <noreply@github.com>2023-09-08 06:53:15 +0000
commita0cff6a0858e675b805a71238ab96fa295a271f8 (patch)
tree83140f935c3873a6ea620ea89431335d779300a6 /components/layout/display_list/builder.rs
parentb7aa98915702e720b084499366588274464c10cd (diff)
downloadservo-a0cff6a0858e675b805a71238ab96fa295a271f8.tar.gz
servo-a0cff6a0858e675b805a71238ab96fa295a271f8.zip
Layout 2013: Don't use WebRender border image outset support (#30315)
The border image outset support in WebRender is going to be removed and even in versions of WebRender where it still exists, it fails to render properly. A border image is a type of border composed of slices of images. The "outset" of this kind of border is a property in CSS that makes the border boundaries expand. Previously, the value was passed to WebRender which would expand the border by this amount and render the images into the expanded rectangle. Since this is going to be removed, we handle this property outside of WebRender. The change is simply to expand the border area by the outset before calculating the rest of the border values. This is necessary for the WebRender upgrade.
Diffstat (limited to 'components/layout/display_list/builder.rs')
-rw-r--r--components/layout/display_list/builder.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index 26147896682..ac0caa51518 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -1185,19 +1185,20 @@ impl Fragment {
let border_style_struct = style.get_border();
let border_image_outset =
border::image_outset(border_style_struct.border_image_outset, border_width);
- let border_image_area = bounds.outer_rect(border_image_outset).size;
+ let border_image_area = bounds.outer_rect(border_image_outset);
+ let border_image_size = border_image_area.size;
let border_image_width = border::image_width(
&border_style_struct.border_image_width,
border_width.to_layout(),
- border_image_area,
+ border_image_size,
);
let border_image_repeat = &border_style_struct.border_image_repeat;
let border_image_fill = border_style_struct.border_image_slice.fill;
let border_image_slice = &border_style_struct.border_image_slice.offsets;
let mut stops = Vec::new();
- let mut width = border_image_area.width.to_px() as u32;
- let mut height = border_image_area.height.to_px() as u32;
+ let mut width = border_image_size.width.to_px() as u32;
+ let mut height = border_image_size.height.to_px() as u32;
let source = match image {
Image::Url(ref image_url) => {
let url = image_url.url()?;
@@ -1215,7 +1216,7 @@ impl Fragment {
state,
style,
paint_worklet,
- border_image_area,
+ border_image_size,
)?;
width = image.width;
height = image.height;
@@ -1229,7 +1230,7 @@ impl Fragment {
compat_mode: _,
} => {
let (wr_gradient, linear_stops) =
- gradient::linear(style, border_image_area, items, *direction, *repeating);
+ gradient::linear(style, border_image_size, items, *direction, *repeating);
stops = linear_stops;
NinePatchBorderSource::Gradient(wr_gradient)
},
@@ -1242,7 +1243,7 @@ impl Fragment {
} => {
let (wr_gradient, radial_stops) = gradient::radial(
style,
- border_image_area,
+ border_image_size,
items,
shape,
position,
@@ -1266,17 +1267,12 @@ impl Fragment {
fill: border_image_fill,
repeat_horizontal: border_image_repeat.0.to_layout(),
repeat_vertical: border_image_repeat.1.to_layout(),
- outset: SideOffsets2D::new(
- border_image_outset.top.to_f32_px(),
- border_image_outset.right.to_f32_px(),
- border_image_outset.bottom.to_f32_px(),
- border_image_outset.left.to_f32_px(),
- ),
+ outset: SideOffsets2D::zero(),
});
state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data(
base,
webrender_api::BorderDisplayItem {
- bounds: bounds.to_layout(),
+ bounds: border_image_area.to_layout(),
common: items::empty_common_item_properties(),
widths: border_image_width,
details,