Bug 1618939 - Hit MOZ_CRASH(explicit panic) at gfx/wr/webrender/src/render_task.rs:37 r=gw

Adding a repro-case reftest that asks for a 19996x5000 RenderTask (at
-p1), then fix it in analogy with the clamping to reasonable values that
happens for `NormalBorder`.

Differential Revision: https://phabricator.services.mozilla.com/D65660

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bert Peers 2020-03-06 03:48:40 +00:00
Родитель ed93ca2a18
Коммит 180c84a40e
4 изменённых файлов: 55 добавлений и 2 удалений

Просмотреть файл

@ -18,6 +18,8 @@ use crate::prim_store::{
};
use crate::prim_store::PrimitiveInstanceKind;
/// Maximum resolution in device pixels at which line decorations are rasterized.
pub const MAX_LINE_DECORATION_RESOLUTION: u32 = 4096;
#[derive(Clone, Debug, Hash, MallocSizeOf, PartialEq, Eq)]
#[cfg_attr(feature = "capture", derive(Serialize))]

Просмотреть файл

@ -34,7 +34,7 @@ use crate::prim_store::borders::{ImageBorderDataHandle, NormalBorderDataHandle};
use crate::prim_store::gradient::{GRADIENT_FP_STOPS, GradientCacheKey, GradientStopKey};
use crate::prim_store::gradient::{LinearGradientPrimitive, LinearGradientDataHandle, RadialGradientDataHandle, ConicGradientDataHandle};
use crate::prim_store::image::{ImageDataHandle, ImageInstance, VisibleImageTile, YuvImageDataHandle};
use crate::prim_store::line_dec::LineDecorationDataHandle;
use crate::prim_store::line_dec::{LineDecorationDataHandle,MAX_LINE_DECORATION_RESOLUTION};
use crate::prim_store::picture::PictureDataHandle;
use crate::prim_store::text_run::{TextRunDataHandle, TextRunPrimitive};
#[cfg(debug_assertions)]
@ -2920,7 +2920,14 @@ impl PrimitiveStore {
// TODO(gw): Do we ever need / want to support scales for text decorations
// based on the current transform?
let scale_factor = Scale::new(1.0) * device_pixel_scale;
let task_size = (LayoutSize::from_au(cache_key.size) * scale_factor).ceil().to_i32();
let mut task_size = (LayoutSize::from_au(cache_key.size) * scale_factor).ceil().to_i32();
if task_size.width > MAX_LINE_DECORATION_RESOLUTION as i32 ||
task_size.height > MAX_LINE_DECORATION_RESOLUTION as i32 {
let max_extent = cmp::max(task_size.width, task_size.height);
let task_scale_factor = Scale::new(MAX_LINE_DECORATION_RESOLUTION as f32 / max_extent as f32);
task_size = (LayoutSize::from_au(cache_key.size) * scale_factor * task_scale_factor)
.ceil().to_i32();
}
// Request a pre-rendered image task.
// TODO(gw): This match is a bit untidy, but it should disappear completely

Просмотреть файл

@ -0,0 +1,43 @@
---
root:
items:
- type: line
baseline: 0
start: 0
end: 50
width: 5000
thickness: 5000
orientation: horizontal
color: red
style: solid
- type: line
baseline: 0
start: 100
end: 150
width: 5000
thickness: 5000
orientation: horizontal
color: green
style: dashed
- type: line
baseline: 0
start: 200
end: 250
width: 5000
thickness: 5000
orientation: horizontal
color: blue
style: dotted
- type: line
baseline: 0
start: 300
end: 350
width: 5000
thickness: 5000
orientation: horizontal
color: yellow
style: wavy

Просмотреть файл

@ -66,6 +66,7 @@ fuzzy(1,113) platform(linux) == raster-space.yaml raster-space.png
skip_on(android) skip_on(mac,>=10.14) != allow-subpixel.yaml allow-subpixel-ref.yaml # Android: we don't enable sub-px aa on this platform.
skip_on(android,device) == bg-color.yaml bg-color-ref.yaml # Fails on Pixel2
!= large-glyphs.yaml blank.yaml
!= large-line-decoration.yaml blank.yaml
skip_on(android,device) == snap-text-offset.yaml snap-text-offset-ref.yaml
fuzzy(5,4435) == shadow-border.yaml shadow-solid-ref.yaml
fuzzy(5,4435) == shadow-image.yaml shadow-solid-ref.yaml