Steps to reproduce:
1) Open <http://www.superbus.co.il>.
2) Open and close one of the popup menus in the top menu.
Results: the focus ring apparently gets drawn multiple times, so it becomes solid color.
Wow, that's a really neat effect!
Created attachment 9842 [details]
Test case reduction
Changing to "HasReduction", even if it might be possible to make the current one shorter. I fiddled with it quite a bit without being able to reduce it more.
Why is this P1? Moving to P2...
And I did notice that it's a regression, yet, somehow this doesn't seem that much of a priority to me :)
(In reply to comment #6)
> And I did notice that it's a regression, yet, somehow this doesn't seem that
> much of a priority to me :)
A variant of this bug, with a search field instead of a popup, affects <http://www.apple.com/buy/locator/>.
Regression = p1.
Created attachment 15883 [details]
This test case demonstrates that the overpainting happens when WebHTMLView takes the "use unioned rect" code path, the focus ring lies in the "unioned rect" but not in any of the actual damaged rects.
I think the reason is that in that case, the -[WebClipView _focusRingVisibleRect] includes the non-damaged area (which is clipped out for normal drawing).
Created attachment 15926 [details]
Clip to the enclosing rectangle if you decide to paint all of it
The idea here is that if WebHTMLView decides to paint the "unioned rect" instead of individual rects, it should clip to that.
This patch may be a no-go due to performance considerations -- obviously the paint() methods will do the same amount of work, but maybe Core Graphics will have to work a lot harder.
Another problem with this patch is that it makes the fast/repaint tests ineffective (another way to look at it is that it will often allow incremental repaint bugs to go unnoticed).
And now while typing this comment I got the impression that this patch made "focus rings around text controls" bugs much more noticeable.
I'm also seeing doubly-painted focus rings in Gmail under certain Safari/OS combinations.
Only the last reduction ("Test case") fails for me now.
See also: bug 40597.
I see doubly-painted focus rings when I focus the search input field on http://developer.apple.com.
For what it's worth it looks like this has been fixed in WK2, but still exists in WK1.