layout: Do not add empty border images to the display list (#37534)

Zero-sized gradient border images cause WebRender to panic, so simply
don't add them to the display list.

Testing: This change adds a WPT crash test.
Fixes: #37432

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-06-18 17:53:29 +02:00 committed by GitHub
parent fc2135cc02
commit bdf8c0ebc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 0 deletions

View file

@ -1509,6 +1509,13 @@ impl<'a> BuilderForBoxFragment<'a> {
};
let size = euclid::Size2D::new(width as i32, height as i32);
// If the size of the border is zero or the size of the border image is zero, just
// don't render anything. Zero-sized gradients cause problems in WebRender.
if size.is_empty() || border_image_size.is_empty() {
return true;
}
let details = BorderDetails::NinePatch(NinePatchBorder {
source,
width: size.width,