Bug 1543844 - Fix incorrect max scale detection in WR border rendering. r=emilio

The local rect for border segments is not solely determined by
the widths and/or radius. Instead of determining the max scale
based on those parameters, use the calculated border segment
rects to determine an appropriate max scale factor.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Glenn Watson 2019-04-12 09:58:24 +00:00
Родитель fa6b2a70f8
Коммит 6348da8082
5 изменённых файлов: 30 добавлений и 17 удалений

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

@ -11,7 +11,7 @@ use display_list_flattener::DisplayListFlattener;
use gpu_types::{BorderInstance, BorderSegment, BrushFlags};
use prim_store::{BorderSegmentInfo, BrushSegment, NinePatchDescriptor};
use prim_store::{EdgeAaSegmentMask, ScrollNodeAndClipChain};
use prim_store::borders::NormalBorderPrim;
use prim_store::borders::{NormalBorderPrim, NormalBorderData};
use util::{lerp, RectHelpers};
// Using 2048 as the maximum radius in device space before which we
@ -872,21 +872,13 @@ pub fn create_border_segments(
/// resolution and stretching them, so they will have the right shape, but
/// blurrier.
pub fn get_max_scale_for_border(
radii: &BorderRadius,
widths: &LayoutSideOffsets
border_data: &NormalBorderData,
) -> LayoutToDeviceScale {
let r = radii.top_left.width
.max(radii.top_left.height)
.max(radii.top_right.width)
.max(radii.top_right.height)
.max(radii.bottom_left.width)
.max(radii.bottom_left.height)
.max(radii.bottom_right.width)
.max(radii.bottom_right.height)
.max(widths.top)
.max(widths.bottom)
.max(widths.left)
.max(widths.right);
let mut r = 1.0;
for segment in &border_data.border_segments {
let size = segment.local_task_size;
r = size.width.max(size.height.max(r));
}
LayoutToDeviceScale::new(MAX_BORDER_RESOLUTION as f32 / r)
}

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

@ -2583,8 +2583,7 @@ impl PrimitiveStore {
// Pick the maximum dimension as scale
let world_scale = LayoutToWorldScale::new(scale_width.max(scale_height));
let mut scale = world_scale * device_pixel_scale;
let max_scale = get_max_scale_for_border(&border_data.border.radius,
&border_data.widths);
let max_scale = get_max_scale_for_border(border_data);
scale.0 = scale.0.min(max_scale.0);
// For each edge and corner, request the render task by content key

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

@ -0,0 +1,9 @@
---
root:
items:
- type: border
bounds: [ 0, 0, 4000, 1 ]
width: [ 1, 0, 0, 0 ]
border-type: normal
style: solid
color: red

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

@ -0,0 +1,12 @@
---
root:
items:
- type: stacking-context
transform: scale(3000, 1)
items:
- type: border
bounds: [ 0, 0, 100, 100 ]
width: [ 1, 0, 0, 0 ]
border-type: normal
style: solid
color: red

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

@ -28,3 +28,4 @@ platform(linux,mac) == border-dashed-dotted-caching.yaml border-dashed-dotted-ca
!= small-inset-outset.yaml small-inset-outset-notref.yaml
== no-aa.yaml green-square.yaml
border-double-1px.yaml border-double-1px-ref.yaml
== max-scale.yaml max-scale-ref.yaml