Closed
Bug 1178575
Opened 9 years ago
Closed 9 years ago
In certain cases, box-shadow is drawn twice
Categories
(Core :: Web Painting, defect)
Core
Web Painting
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: me, Assigned: MatsPalmgren_bugz)
References
Details
(Keywords: regression, testcase)
Attachments
(5 files)
362 bytes,
text/html
|
Details | |
365 bytes,
text/html
|
Details | |
8.70 KB,
patch
|
Details | Diff | Splinter Review | |
1.02 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
4.67 KB,
patch
|
Details | Diff | Splinter Review |
In a certain fairly obscure (but realistic) set of circumstances, an element’s box-shadow is drawn twice, which for a semi-transparent box-shadow has the effect of making it twice as opaque as it should be.
The issue appears to require these conditions:
- The element must be contained in something with `overflow: hidden`;
- The element must have `position: absolute` and it must span the element with `overflow: hidden` (the easiest way is typically `left: 0; right: 0`);
- The element’s `height` CSS property must be changed from something small to something large (the precise magnitudes of the small and large seem to vary on the box-shadow spread radius);
- The element must have a semi-transparent box-shadow with no blur but with spread;
This happened to me in real and fairly complex code that I was writing, but it reduced nicely to the attached test case.
Reproduced on both Arch Linux (64-bit) and Mac OS X.
nsDisplayBoxShadowOuter::Paint calls ComputeDisjointRectangles, which produces two disjoint rectangles. This code comes from https://hg.mozilla.org/mozilla-central/rev/1a0f2d658a49 .
(Prior to https://hg.mozilla.org/mozilla-central/rev/fdbe3aa72cdb this did a clip.)
Then it uses each as the aDirtyRect to a call to nsCSSRendering::PaintBoxShadowOuter, which in turn calls nsContextBoxBlur::BlurRectangle, which in the non-blur codepath does a FillRect. This path completely ignores aDirtyRect.
The actually regression, though, came in this range (from Linux nightlies):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4b6d63b05a0a&tochange=2f8af55d6e9a
but I'm not sure why.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(mats)
Version: 38 Branch → Trunk
(In reply to David Baron [:dbaron] ⏰UTC-7 from comment #1)
> nsDisplayBoxShadowOuter::Paint calls ComputeDisjointRectangles, which
> produces two disjoint rectangles. This code comes from
> https://hg.mozilla.org/mozilla-central/rev/1a0f2d658a49 .
>
> (Prior to https://hg.mozilla.org/mozilla-central/rev/fdbe3aa72cdb this did a
> clip.)
To be clear: it looks like these two revisions are, when combined, incorrect, although I don't know why the bug didn't show up until a week after the second one.
Assignee | ||
Comment 3•9 years ago
|
||
FWIW, it seems the bug only occurs when overflow occurs on both
the left and right sides, not when overflowing on just one side.
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to David Baron [:dbaron] ⏰UTC-7 (busy Aug. 8-Aug. 30) from comment #1)
> (Prior to fdbe3aa72cdb this did a clip.)
The Clip call was moved inside PaintBoxShadowOuter instead, but you're right
that the aDirtyRect part fell out.
> The actually regression, though, came in this range (from Linux nightlies):
> https://hg.mozilla.org/mozilla-central/
> pushloghtml?fromchange=4b6d63b05a0a&tochange=2f8af55d6e9a
> but I'm not sure why.
Backing out bug 1008301 in a trunk build makes the problem go away.
Here's a backout patch for doing that if anyone wants to investigate why.
Flags: needinfo?(mats)
I was hoping you'd be able to fix this.
Flags: needinfo?(mats)
Assignee | ||
Comment 6•9 years ago
|
||
Like dbaron, I don't understand why the bug only manifests after the changes
in bug 1008301. The fix seems simple enough though.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2bb1770827e5
(looks green to me)
Assignee: nobody → mats
Attachment #8644519 -
Flags: review?(roc)
Assignee | ||
Comment 7•9 years ago
|
||
Flags: needinfo?(mats)
Assignee | ||
Updated•9 years ago
|
Blocks: 613659
Keywords: regression,
testcase
Attachment #8644519 -
Flags: review?(roc) → review+
Assignee | ||
Comment 9•9 years ago
|
||
ComputeDisjointRectangles says it's only "approximate", so I wonder if this bug
can still occur if it generates two rectangles that overlap?
Assignee | ||
Updated•9 years ago
|
Flags: in-testsuite+
Comment 10•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/786625a84d87
https://hg.mozilla.org/mozilla-central/rev/927e481324f9
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Updated•6 years ago
|
Component: Layout: View Rendering → Layout: Web Painting
You need to log in
before you can comment on or make changes to this bug.
Description
•