RESOLVED FIXED 20592
The focus ring is not shown while navigating on some pages, css handling bug is possible
https://bugs.webkit.org/show_bug.cgi?id=20592
Summary The focus ring is not shown while navigating on some pages, css handling bug ...
Anatoly Borodin
Reported 2008-09-01 12:35:50 PDT
The focus ring disappears on some Internet pages, for example https://www.google.com/accounts/ServiceLogin : the focus ring disappears after passing the "Sign in" button and appears again at the "create one for free" link after a few tabs. The analyze of the page's source has given a simple test case, the focus ring is not shown on the "bad" page. The bug appears in the gtk branch built under FreeBSD (e.g. git f676a7ee078a079bc3bd9781d4d7c9ca5fd1d79c).
Attachments
correct behavior (290 bytes, text/html)
2008-09-01 12:38 PDT, Anatoly Borodin
no flags
incorrect behavior (313 bytes, text/html)
2008-09-01 12:38 PDT, Anatoly Borodin
no flags
Fix focus ring painting (3.35 KB, patch)
2008-09-22 17:09 PDT, Alp Toker
eric: review-
Fix focus ring painting, take two (4.15 KB, patch)
2008-09-24 16:52 PDT, Alp Toker
darin: review+
Anatoly Borodin
Comment 1 2008-09-01 12:38:20 PDT
Created attachment 23100 [details] correct behavior
Anatoly Borodin
Comment 2 2008-09-01 12:38:58 PDT
Created attachment 23101 [details] incorrect behavior
Alp Toker
Comment 3 2008-09-14 17:12:24 PDT
This seems to be due to the focus ring function in GraphicsContextCairo relying on the GraphicsContext to paint the focus ring, whereas other ports just use a platform focus ring paint function.
Alp Toker
Comment 4 2008-09-22 17:09:27 PDT
Created attachment 23684 [details] Fix focus ring painting
Eric Seidel (no email)
Comment 5 2008-09-22 17:35:34 PDT
Comment on attachment 23684 [details] Fix focus ring painting This seems like the wrong fix. Why would Gtk want to ignore the color parameter and use the stroke color instead? Shouldn't whatever callers be fixed to pass the strokeColor() in the necessary cases for gtk? I'm just not even sure why that change would be needed. This seems like the wrong layer to abstract at.
Alp Toker
Comment 6 2008-09-22 18:15:16 PDT
(In reply to comment #5) > (From update of attachment 23684 [details] [edit]) > This seems like the wrong fix. Why would Gtk want to ignore the color > parameter and use the stroke color instead? Shouldn't whatever callers be > fixed to pass the strokeColor() in the necessary cases for gtk? I'm just not > even sure why that change would be needed. This seems like the wrong layer to > abstract at. > The color passed in always seems to be the same which isn't what we want. It looks OK when the focus ring is rounded, thick and transparent, but the GTK+ focus ring is a single pixel dotted rectangle which usually has the text/foreground color, and is used for anchors as well as controls. Not sure how to get the desired color passed in here except by using the stroke or fill colors. Any suggestions?
Dave Hyatt
Comment 7 2008-09-22 19:44:33 PDT
Don't we use a special keyword for the focus ring color? Doesn't the value of that color come from the RenderTheme?
Alp Toker
Comment 8 2008-09-22 20:18:24 PDT
(In reply to comment #7) > Don't we use a special keyword for the focus ring color? Doesn't the value of > that color come from the RenderTheme? > I didn't notice a way to adjust the appearance of focused anchor elements (the most common user of drawFocusRing() since RenderTheme handles all controls itself). Looking at RenderTheme/RenderStyleConstants.h the EAppearance values are mostly concerned with widgets/controls which doesn't seem to help.
Alp Toker
Comment 9 2008-09-22 20:22:00 PDT
(In reply to comment #7) > Don't we use a special keyword for the focus ring color? Doesn't the value of > that color come from the RenderTheme? > I missed the question! Yes, the color does come from RenderTheme but it's constant, whereas the GTK+ focus ring works best when it either uses the current foreground color of the context (ie. matching the color of the text), or otherwise contrasts with the background it's painted on. (In older applications, the focus ring would XOR, but still was never stuck to a single color.)
Alp Toker
Comment 10 2008-09-22 20:24:36 PDT
(In reply to comment #9) > (In reply to comment #7) > > Don't we use a special keyword for the focus ring color? Doesn't the value of > > that color come from the RenderTheme? > > > > I missed the question! Yes, the color does come from RenderTheme but it's > constant, whereas the GTK+ focus ring works best when it either uses the > current foreground color of the context (ie. matching the color of the text), > or otherwise contrasts with the background it's painted on. (In older > applications, the focus ring would XOR, but still was never stuck to a single > color.) > Indeed, a little testing shows that the value of strokeColor() doesn't _always_ contrast with the background, so the technique in my patch isn't perfect but passable. Any thoughts?
Dave Hyatt
Comment 11 2008-09-24 14:49:52 PDT
Don't we just need to support invert when painting outlines? http://www.w3.org/TR/2004/CR-css3-ui-20040511/#outline-color0 That seems to be the bug here.
Dave Hyatt
Comment 12 2008-09-24 14:50:46 PDT
If you want to use the current foreground color, then currentColor is the right keyword. Not sure we support that yet though. Either way I think the CSS spec covers what you need. We just have to add the right support for it.
Alp Toker
Comment 13 2008-09-24 16:52:34 PDT
Created attachment 23771 [details] Fix focus ring painting, take two Fixed to use the color passed in to drawFocusRing()
Alp Toker
Comment 14 2008-09-24 16:57:28 PDT
Comment on attachment 23771 [details] Fix focus ring painting, take two >+ // We prefer the stroke color for focus rings in GTK+. >+ setColor(cr, color); Above comment isn't necessary any more, of course.
Darin Adler
Comment 15 2008-10-11 16:23:57 PDT
Comment on attachment 23771 [details] Fix focus ring painting, take two Seems fine, r=me
Alp Toker
Comment 16 2008-10-11 23:51:00 PDT
Landed in r37521.
Note You need to log in before you can comment on or make changes to this bug.