Closed Bug 1221341 Opened 4 years ago Closed 4 years ago

Box-shadow of elements with transform:scale() is rendered incorrectly: with transparent areas between box-shadow and border-box

Categories

(Core :: Graphics, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: arni2033, Assigned: mchang)

Details

(Whiteboard: [gfx-noted])

Attachments

(5 files)

STR:   (Win7_64, Nightly 45, 32bit, ID 20151102030241, new profile)
1. Open attached "testcase 1"

Result:
 [see screenshot] Box-shadow is rendered w/ transparent area between box-shadow and border-box

Expectations:
 It should render correctly, w/o transparent areas between box-shadow and border-box
Summary: Box-shadow is rendered incorrectly: with transparent areas between box-shadow and border-box → Box-shadow of elements with transform:scale() is rendered incorrectly: with transparent areas between box-shadow and border-box
To reproduce the screenshot you may need to maximize the window (because window's width should be an even number). Also, that happens not only on "scale(8)" but also on "scale(2)". It's just more noticeable at "scale(8)"
Attached file testcase 2
Simplified testcase
Seems to be a rounding error
Attached image screenshot testcase 2
aurora
Mozilla/5.0 (Windows NT 5.1; rv:44.0) Gecko/20100101 Firefox/44.0
Mason, is this related to the shadow rendering work you have been working on lately ?
Flags: needinfo?(mchang)
Whiteboard: [gfx-noted]
(In reply to Nicolas Silva [:nical] from comment #4)
> Mason, is this related to the shadow rendering work you have been working on
> lately ?

Yup, probably.
Assignee: nobody → mchang
Flags: needinfo?(mchang)
The problem with this bug was that we would clip the inner rect of a box shadow with a pre-transformed rect [1] that was just rounded. Then we'd clip it at [2]. When scaled 8x here, we'd clip too little. This patch snaps the clip rect to device pixels rather than just doing a rounding.

[1] https://dxr.mozilla.org/mozilla-central/source/layout/base/nsCSSRendering.cpp?from=nsCSSRendering.cpp#1289
[2] https://dxr.mozilla.org/mozilla-central/source/layout/base/nsCSSRendering.cpp?from=nsCSSRendering.cpp#1400
Attachment #8691122 - Flags: review?(mstange)
Attachment #8691122 - Flags: review?(mstange) → review+
https://hg.mozilla.org/mozilla-central/rev/ff8ba03eae9c
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Has STR: --- → yes
You need to log in before you can comment on or make changes to this bug.