background of text inside box-shadow becomes black after highlight

RESOLVED FIXED in mozilla7

Status

()

Core
Layout: View Rendering
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: Brandon Cheng, Assigned: mats)

Tracking

({regression, testcase})

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

Firefox Tracking Flags

(blocking2.0 -)

Details

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

Attachments

(5 attachments, 1 obsolete attachment)

(Reporter)

Description

7 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?
Status: UNCONFIRMED → NEW
Ever confirmed: true
blocking2.0: --- → betaN+
(Reporter)

Comment 2

7 years ago
Created attachment 480535 [details]
4 testcase demos.
(Reporter)

Comment 3

7 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

7 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

7 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.
Might the regression range match the regression range in bug 536061?  (See bug 536061 comment 13.)
Regression range doesn't match (this is a more recent regression), but it still could be the same underlying problem.
Depends on: 536061
(Reporter)

Comment 8

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

Updated

7 years ago
(Assignee)

Comment 9

7 years ago
"Patch rev. 1" in bug 536061 does not fix this bug.
Keywords: regressionwindow-wanted
Regression range on Windows
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=8e0fce7d5b49&tochange=79d0beec27b5
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.
(Assignee)

Updated

7 years ago
No longer depends on: 536061
Assignee: nobody → matspal
(Assignee)

Comment 13

7 years ago
Created attachment 496337 [details] [diff] [review]
workaround

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.
(Assignee)

Updated

7 years ago
Depends on: 562746
(Assignee)

Updated

7 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.
(Assignee)

Comment 15

7 years ago
The clip related changes looks quite substantial though.
https://bugzilla.mozilla.org/attachment.cgi?id=490975&action=diff#a/gfx/cairo/cairo/src/cairo-clip.c_sec2

It looks like we're missing most of the changes in 2010:
http://cgit.freedesktop.org/cairo/log/src/cairo-clip.c?id=108b1c7825116ed3f93aa57384bbd3290cdc9181
(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.
(Assignee)

Comment 17

7 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.
(Assignee)

Comment 18

7 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
Depends on: 628745
(Assignee)

Comment 19

7 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.
(Assignee)

Comment 23

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

Comment 24

7 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]
(Assignee)

Updated

7 years ago
blocking2.0: --- → ?
blocking2.0: ? → -
Blocks: 629012
(Assignee)

Updated

7 years ago
No longer blocks: 629012
(Assignee)

Comment 25

6 years ago
[fixed by Cairo 1.10 update in bug 562746]
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [will be fixed by Cairo update] → [fixed by Cairo 1.10 update in bug 562746]
Target Milestone: --- → mozilla7
You need to log in before you can comment on or make changes to this bug.