Closed Bug 601512 Opened 14 years ago Closed 13 years ago

background of text inside box-shadow becomes black after highlight

Categories

(Core :: Web Painting, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla7
Tracking Status
blocking2.0 --- -

People

(Reporter: brandon.cheng, Assigned: MatsPalmgren_bugz)

References

Details

(Keywords: regression, testcase, Whiteboard: [fixed by Cairo 1.10 update in bug 562746])

Attachments

(5 files, 1 obsolete file)

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+
Attached file 4 testcase demos.
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.
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
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
David: It seems similar (from reading comment 10), perhaps we should wait to see if fixing bug 536061 fixes this one?
"Patch rev. 1" in bug 536061 does not fix this bug.
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.
No longer depends on: 536061
Attached patch workaround (obsolete) — Splinter 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.
Depends on: 562746
Flags: in-testsuite?
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.
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.
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.
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
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.
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]
blocking2.0: --- → ?
Blocks: 629012
No longer blocks: 629012
[fixed by Cairo 1.10 update in bug 562746]
Status: NEW → RESOLVED
Closed: 13 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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: