Created attachment 410344 [details]
This is similar to bug 216754 and bug 216257 but still broken after those fixes.
The conditions needed for this bug are:
1) An element E is display:none because of an attribute selector
2) Script asks for E's computed style's display property
3) The attribute from the attribute selector changes so that E is now display:block
4) Some descendant D of E is focused using D.focus()
After r257839, we end up using the stale computed style stored at step (2) when checking for hidden ancestors in Element::isVisibleWithoutResolvingFullStyle(), so incorrectly conclude that D is not visible.
I've attached a test case.
In practice, this is happening on m.youtube.com in Chrome for iOS, where tapping on the search button will fail to focus the search field. In that case, the code asking for the computed style is actually in Chrome's injected logic for autofill and translation. However, the attached test case reproduces the bug more generally (in MiniBrowser and Safari).
Attribute change invalidation fails to invalidate the computed style.
Created attachment 417442 [details]
Created attachment 417524 [details]
*** Bug 220580 has been marked as a duplicate of this bug. ***
Created attachment 417527 [details]
Speedometer A/B looks good.
Committed r271446: <https://trac.webkit.org/changeset/271446>
All reviewed patches have been landed. Closing bug and clearing flags on attachment 417524 [details].