Changeset 227855 in webkit


Ignore:
Timestamp:
Jan 30, 2018, 2:16:08 PM (8 years ago)
Author:
Megan Gardner
Message:

Make preserve and restore focus more likely to be symmetrical
https://bugs.webkit.org/show_bug.cgi?id=182264
Source/WebKit:

<rdar://problem/36948473>

Reviewed by Tim Horton.

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.
To work around problems associated with <rdar://problem/37000122>.

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _restoreFocusWithToken:]):
(-[WKContentView _preserveFocusWithToken:destructively:]):

LayoutTests:

Reviewed by Tim Horton.

Added new test to verify that opening a selection form twice works.

  • fast/forms/ios/ipad/select-form-run-twice-expected.txt: Added.
  • fast/forms/ios/ipad/select-form-run-twice.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r227841 r227855  
     12018-01-30  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Make preserve and restore focus more likely to be symmetrical
     4        https://bugs.webkit.org/show_bug.cgi?id=182264
     5
     6        Reviewed by Tim Horton.
     7
     8        Added new test to verify that opening a selection form twice works.
     9
     10        * fast/forms/ios/ipad/select-form-run-twice-expected.txt: Added.
     11        * fast/forms/ios/ipad/select-form-run-twice.html: Added.
     12
    1132018-01-30  Dean Jackson  <dino@apple.com>
    214
  • trunk/Source/WebKit/ChangeLog

    r227790 r227855  
     12018-01-30  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Make preserve and restore focus more likely to be symmetrical
     4        https://bugs.webkit.org/show_bug.cgi?id=182264
     5        <rdar://problem/36948473>
     6       
     7        Reviewed by Tim Horton.
     8
     9        Keep a stack of if we actually increment the focusState, so that
     10        changes to the web content do not result in asymmetric decrements to the focus state.
     11        To work around problems associated with <rdar://problem/37000122>.
     12
     13        * UIProcess/ios/WKContentViewInteraction.h:
     14        * UIProcess/ios/WKContentViewInteraction.mm:
     15        (-[WKContentView _restoreFocusWithToken:]):
     16        (-[WKContentView _preserveFocusWithToken:destructively:]):
     17
    1182018-01-30  Brent Fulgham  <bfulgham@apple.com>
    219
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r227377 r227855  
    172172    RetainPtr<UIGestureRecognizer> _previewGestureRecognizer;
    173173    RetainPtr<UIGestureRecognizer> _previewSecondaryGestureRecognizer;
     174    Vector<bool> _focusStateStack;
    174175#if HAVE(LINK_PREVIEW)
    175176    RetainPtr<UIPreviewItemController> _previewItemController;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r227710 r227855  
    41704170- (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token
    41714171{
    4172     if (!_inputPeripheral)
     4172    ASSERT(!_focusStateStack.isEmpty());
     4173   
     4174    if (_focusStateStack.takeLast()) {
     4175        ASSERT(_webView->_activeFocusedStateRetainCount);
    41734176        --_webView->_activeFocusedStateRetainCount;
     4177    }
    41744178}
    41754179
    41764180- (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively
    41774181{
    4178     if (!_inputPeripheral)
     4182    if (!_inputPeripheral) {
    41794183        ++_webView->_activeFocusedStateRetainCount;
     4184        _focusStateStack.append(true);
     4185    } else
     4186        _focusStateStack.append(false);
    41804187}
    41814188
Note: See TracChangeset for help on using the changeset viewer.