background of text inside box-shadow becomes black after highlight

RESOLVED FIXED in mozilla7



8 years ago
5 months ago


(Reporter: brandon.cheng, Assigned: mats)


({regression, testcase})

regression, testcase
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(blocking2.0 -)


(Whiteboard: [fixed by Cairo 1.10 update in bug 562746])


(5 attachments, 1 obsolete attachment)



8 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0b7pre) Gecko/20101002 Firefox/4.0b7pre
Build Identifier: 

Text inside a block shadow will have a black background after it is selected, and then unselected.

Reproducible: Always

Steps to Reproduce:
1. Open up Minefield/Firefox Beta 7 Pre
2. Navigate to a page with the error
3. Highlight some text
4. Un-highlight by clicking elsewhere
Actual Results:  
background of highlighted text becomes black

Expected Results:  
Return text background to original color
Confirmed.  Brandon: could you create a small HTML page that shows the problem, and attach it?
Ever confirmed: true

Comment 2

8 years ago
Created attachment 480535 [details]
4 testcase demos.

Comment 3

8 years ago
Comment on attachment 480535 [details]
4 testcase demos.

My friend Joseph Peter created this. I created my own, but his beat mine by a mile in quality. The bug seems to be also related to rounded box corners.

It also occurs when the box is out of sight after scrolling down the page. Even more strange, the black background returns normal after highlighting the sidebar and the content.

Comment 4

8 years ago
BTW, use also "box-shadow" in testcases, the -moz-prefix is dropped.
Keywords: regression, testcase
Summary: background of text inside block-shadow becomes black after highlight → background of text inside box-shadow becomes black after highlight

Comment 5

8 years ago
Created attachment 480545 [details]
Testcase with both -moz- and no prefix in box-shadow

Just a quick update from the previous testcase, this one features -moz-box-shadow followed by box-shadow so it can be compared in both Firefox 3.6.x and 4.0x

When I did the original testcase for Brandon, I forgot to include the no prefix property, although I intended to.

The behavior I see in my computer is the testcase to work as expected on Firefox 3.6.10 from the Ubuntu repositories. In Minefield 4.0b7pre the first "block" appears as expected until text is selected or is scrolled off sight and on again, in which the background turns black; the second "block" is always showing a black background and the shadow does not correspond to what is expected from the CSS; while the last 2 "blocks" are shown as expected.
Regression range doesn't match (this is a more recent regression), but it still could be the same underlying problem.
Depends on: 536061

Comment 8

8 years ago
David: It seems similar (from reading comment 10), perhaps we should wait to see if fixing bug 536061 fixes this one?


8 years ago

Comment 9

8 years ago
"Patch rev. 1" in bug 536061 does not fix this bug.
Keywords: regressionwindow-wanted
I'm guessing David's border radius changes.
Those are the changes that caused border-radius + overflow:hidden to set a rounded clip region, so it's probably a preëxisting problem with complex clip regions.


8 years ago
No longer depends on: 536061
Assignee: nobody → matspal

Comment 13

8 years ago
Created attachment 496337 [details] [diff] [review]

dbaron is right - this is a bug in Cairo.
When the box shadow is completely clipped AND the clip has a RoundedRectangle
then the Fill appears to be confused as to which areas to fill.
Fwiw, after debugging I found this workaround...

But then I saw that we will update to Cairo 1.10 in bug 562746 so
I tried that (patch v5) and it fixes this bug.


8 years ago
Depends on: 562746


8 years ago
Flags: in-testsuite?
Keywords: regressionwindow-wanted
Whiteboard: [will be fixed by Cairo update]
We should probably figure out which cairo patch fixed the bug, so we can backport it now in case bug 562746 doesn't land.

Comment 15

8 years ago
The clip related changes looks quite substantial though.

It looks like we're missing most of the changes in 2010:
(except the fixes Karl contributed)
Whiteboard: [will be fixed by Cairo update] → [will be fixed by Cairo update][hardblocker]
The patch in comment #13 would be a potentially useful optimization so I think we should just take it. However, we should make it handle cases where the frame has border-radius. I think we just need to check whether 'clip' is inside skipGfxRect instead of frameGfxRect.

Comment 17

8 years ago
Fwiw, I did apply a few of the smaller patches from the Cairo tree
to see if it would fix this bug, but no luck...

I tried a few of the larger patches involving cairo-clip.c also,
but every time I ended up pulling in more and more unrelated
stuff just to make it compile...  and I doubt any patch of that
size would be accepted at this point...

So, I have given up on trying to fix this at the Cairo level.

Comment 18

8 years ago
Created attachment 504053 [details] [diff] [review]
partial workaround

Unfortunately this workaround seems to be less effective now -
it really only fixes a minority of cases I think.
It doesn't fix either of border-radius cases in the attached testcase.

I haven't measured if this pays off as an optimization.
Attachment #496337 - Attachment is obsolete: true

Comment 19

8 years ago
Created attachment 506955 [details] [diff] [review]
reset the current clip before painting an outer box shadow

Bug 628745 probably helps in some cases, but not for the testcases in
this bug unfortunately.

Resetting the current clip before painting the outer box shadow fixes
this bug - it's the wrong thing to do of course, but perhaps the lesser
evil?  Perhaps we can limit this to the cases where the current clip
is rounded -- is there a way to find that out?

The two workarounds in this bug + the fix in bug 628745 passed reftests
locally on Linux64.  I've submitted that to TryServer.
I don't understand why 628745 wouldn't fix attachment 480545 [details]. The text there doesn't intersect the corners, so the patch in bug 628745 should never be rendering it with a rounded clip rect. Can you explain this?
The box shadow does though, it seems.
Hmm, yeah. But this is a somewhat unusual testcase in that respect, I think. I think maybe with bug 628745 fixed, we could take this off the blocker list.

Alternatively, it seems to me that none of the *visible* part of the shadow intersects the rounded corners, so we could probably do more analysis and discover that.

Comment 23

8 years ago
Created attachment 507154 [details]
Testcase #3, the first case here is fixed by attachment 504053 [details] [diff] [review]

Comment 24

8 years ago
This looks more and more like an edge case to me.  It appears the
problem only occurs when a box shadow is clipped by an ancestor
with overflow != visible and border-radius != 0.

I haven't seen any reports of this bug occurring on any major sites
and the problem should be relatively easy to workaround with a few
style changes.  I don't think this should be blocking 2.0.
Requesting re-triage of blocking status.

FWIW, the TryServer job with the two wallpapers in this bug +
the fix in bug 628745 passed unit tests.
blocking2.0: betaN+ → ---
Whiteboard: [will be fixed by Cairo update][hardblocker] → [will be fixed by Cairo update]


8 years ago
blocking2.0: --- → ?


8 years ago
No longer blocks: 629012

Comment 25

8 years ago
[fixed by Cairo 1.10 update in bug 562746]
Last Resolved: 8 years ago
Resolution: --- → FIXED
Whiteboard: [will be fixed by Cairo update] → [fixed by Cairo 1.10 update in bug 562746]
Target Milestone: --- → mozilla7
Component: Layout: View Rendering → Layout: Web Painting
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.