RESOLVED FIXED 182264
Make preserve and restore focus more likely to be symmetrical
https://bugs.webkit.org/show_bug.cgi?id=182264
Summary Make preserve and restore focus more likely to be symmetrical
Megan Gardner
Reported 2018-01-29 15:11:04 PST
Make preserve and restore focus more likely to be symetrical
Attachments
Patch (9.54 KB, patch)
2018-01-29 18:00 PST, Megan Gardner
no flags
Patch (9.43 KB, patch)
2018-01-29 18:25 PST, Megan Gardner
no flags
Patch (9.04 KB, patch)
2018-01-30 10:33 PST, Megan Gardner
no flags
Patch (9.19 KB, patch)
2018-01-30 11:30 PST, Megan Gardner
thorton: review+
Megan Gardner
Comment 1 2018-01-29 18:00:36 PST
Megan Gardner
Comment 2 2018-01-29 18:01:03 PST
Tim Horton
Comment 3 2018-01-29 18:03:50 PST
Comment on attachment 332612 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332612&action=review > Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:174 > + RetainPtr<NSMutableArray> _focusStateStack; Vector<bool> is likely a better plan/more efficient/more WebKitty
Tim Horton
Comment 4 2018-01-29 18:06:17 PST
Comment on attachment 332612 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332612&action=review > Source/WebKit/ChangeLog:3 > + Make preserve and restore focus more likely to be symetrical Symmetrical
Tim Horton
Comment 5 2018-01-29 18:07:01 PST
Comment on attachment 332612 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332612&action=review > Source/WebKit/ChangeLog:5 > + There should be a radar here.
Megan Gardner
Comment 6 2018-01-29 18:25:17 PST
Wenson Hsieh
Comment 7 2018-01-29 19:24:34 PST
Comment on attachment 332614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332614&action=review > Source/WebKit/ChangeLog:3 > + Make preserve and restore focus more likely to be symetrical symetrical => symmetrical > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4173 > + BOOL shouldDecrement = _focusStateStack[lastIndex]; Nit - if (_focusStateStack.takeLast()) ... would read a bit more nicely here. We should also bail early before trying to take the last index (with an assertion, perhaps) if the list is empty, to avoid crashing just in case we get an extra call to _restore.
Wenson Hsieh
Comment 8 2018-01-30 08:36:59 PST
Comment on attachment 332614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332614&action=review > LayoutTests/fast/forms/ios/ipad/select-form-run-twice.html:38 > + function getSingleTapUIScript(x, y) It doesn't look like we use this function anywhere.
Megan Gardner
Comment 9 2018-01-30 10:33:48 PST
Simon Fraser (smfr)
Comment 10 2018-01-30 11:09:37 PST
Comment on attachment 332667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332667&action=review > Source/WebKit/ChangeLog:10 > + Keep a stack of if we actually increment the focusState, so that > + changes to the web content do not result in asymmetric decrements to the focus state. Is this actually working around a UIKit bug? If so, can we reference that in a comment so we know if we can remove it in future? > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4175 > --_webView->_activeFocusedStateRetainCount; This should also assert that _activeFocusedStateRetainCount isn't going to underflow.
Megan Gardner
Comment 11 2018-01-30 11:23:13 PST
Comment on attachment 332667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332667&action=review >> Source/WebKit/ChangeLog:10 >> + changes to the web content do not result in asymmetric decrements to the focus state. > > Is this actually working around a UIKit bug? If so, can we reference that in a comment so we know if we can remove it in future? It is, but even if they "fix" it, I don't know if we want to removed this, since it's small, and guards against bad behavior.
Megan Gardner
Comment 12 2018-01-30 11:30:10 PST
Tim Horton
Comment 13 2018-01-30 13:58:52 PST
Comment on attachment 332675 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332675&action=review > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4176 > --_webView->_activeFocusedStateRetainCount; Should we not let this go negative?
Megan Gardner
Comment 14 2018-01-30 14:16:35 PST
Note You need to log in before you can comment on or make changes to this bug.