Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call `ensure_no_corner_overlap()` to legalize border radii in `ClipItem::new_box_shadow()`. #3080

Merged
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Call `ensure_no_corner_overlap()` to legalize border radii in

`ClipItem::new_box_shadow()`.

If no blur is present, `DisplayListFlattener::add_box_shadow()` calls
`ClipItem::new_rounded_rect()` in its fast path, which calls
`ensure_no_corner_overlap()`. However, in the slow path, which is used when
blur is present, `ClipItem::new_box_shadow()` is called instead. Prior to this
patch, `ClipItem::new_box_shadow()` neglected to call
`ensure_no_corner_overlap()`. This is why the bug manifested itself only when
blur was present.

Closes #2581.
  • Loading branch information
pcwalton committed Sep 18, 2018
commit 86b800cc3b811a89e11ac3ee3440ac8fada7e40e
@@ -765,11 +765,14 @@ impl ClipItem {

pub fn new_box_shadow(
shadow_rect: LayoutRect,
shadow_radius: BorderRadius,
mut shadow_radius: BorderRadius,
prim_shadow_rect: LayoutRect,
blur_radius: f32,
clip_mode: BoxShadowClipMode,
) -> Self {
// Make sure corners don't overlap.
ensure_no_corner_overlap(&mut shadow_radius, &shadow_rect);

// Get the fractional offsets required to match the
// source rect with a minimal rect.
let fract_offset = LayoutPoint::new(
@@ -0,0 +1,20 @@

---
root:
items:
- type: stacking-context
bounds: [0, 0, 1000, 1000]
items:
- type: box-shadow
bounds: [ 0, 1, 265, 265 ]
color: red
clip-mode: outset
offset: 350 -1
blur-radius: 1
spread-radius: -80
border-radius:
top-left: [185, 185]
top-right: [0, 0]
bottom-left: [0, 0]
bottom-right: [185, 185]

@@ -0,0 +1,19 @@

---
root:
items:
- type: stacking-context
bounds: [0, 0, 1000, 1000]
items:
- type: box-shadow
bounds: [ 0, 1, 265, 265 ]
color: red
clip-mode: outset
offset: 350 -1
blur-radius: 1
spread-radius: -80
border-radius:
top-left: [250, 250]
top-right: [0, 0]
bottom-left: [0, 0]
bottom-right: [250, 250]
Binary file not shown.
@@ -24,8 +24,8 @@ platform(linux,mac) fuzzy(1,4) == inset-downscale.yaml inset-downscale.png
platform(linux,mac) == box-shadow-cache.yaml box-shadow-cache.png
platform(linux,mac) fuzzy(1,685) == overlap1.yaml overlap1.png
== overlap2.yaml overlap2.png
platform(linux,mac) == no-stretch.yaml no-stretch.png
platform(linux,mac) fuzzy(1,48) == no-stretch.yaml no-stretch.png
platform(linux,mac) == box-shadow-stretch-mode-x.yaml box-shadow-stretch-mode-x.png
platform(linux,mac) == box-shadow-stretch-mode-y.yaml box-shadow-stretch-mode-y.png
platform(linux,mac) == inset-mask-region.yaml inset-mask-region.png

== box-shadow-blurred-overlapping-radii.yaml box-shadow-blurred-overlapping-radii-ref.yaml
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.