Changeset 246931 in webkit


Ignore:
Timestamp:
Jun 28, 2019 1:12:45 PM (5 years ago)
Author:
Wenson Hsieh
Message:

Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
https://bugs.webkit.org/show_bug.cgi?id=199331
<rdar://problem/52116170>

Reviewed by Tim Horton.

Source/WebCore:

Add a new quirk to avoid resizing the web view when input view bounds change.

  • page/Quirks.cpp:

(WebCore::Quirks::shouldAvoidResizingWhenInputViewBoundsChange const):

  • page/Quirks.h:

Source/WebKit:

Expose new SPI, such that clients may check whether to avoid resizing the web view when changing input view
bounds. In particular, resizing the web view in this case causes toolbar menus in Microsoft Word online to
dismiss immediately after opening them, due to resize events fired as a result of the input view dismissing.

  • Shared/FocusedElementInformation.cpp:

(WebKit::FocusedElementInformation::encode const):
(WebKit::FocusedElementInformation::decode):

  • Shared/FocusedElementInformation.h:

Add a new flag to FocusedElementInformation to indicate whether we should avoid resizing the web view when an
input view is presented.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]):

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:
  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _elementDidBlur]):

Reset the value of the flag.

(-[WKContentView _shouldAvoidResizingWhenInputViewBoundsChange]):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::getFocusedElementInformation):

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246925 r246931  
     12019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
     4        https://bugs.webkit.org/show_bug.cgi?id=199331
     5        <rdar://problem/52116170>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add a new quirk to avoid resizing the web view when input view bounds change.
     10
     11        * page/Quirks.cpp:
     12        (WebCore::Quirks::shouldAvoidResizingWhenInputViewBoundsChange const):
     13        * page/Quirks.h:
     14
    1152019-06-28  Konstantin Tokarev  <annulen@yandex.ru>
    216
  • trunk/Source/WebCore/page/Quirks.cpp

    r246768 r246931  
    299299#endif
    300300
     301bool Quirks::shouldAvoidResizingWhenInputViewBoundsChange() const
     302{
     303    if (!needsQuirks())
     304        return false;
     305
     306    auto host = m_document->topDocument().url().host();
     307    return equalLettersIgnoringASCIICase(host, "live.com") || host.endsWithIgnoringASCIICase(".live.com");
     308}
     309
    301310bool Quirks::shouldDisablePointerEventsQuirk() const
    302311{
  • trunk/Source/WebCore/page/Quirks.h

    r246768 r246931  
    6161    WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
    6262    WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
     63    WEBCORE_EXPORT bool shouldAvoidResizingWhenInputViewBoundsChange() const;
    6364
    6465    bool needsGMailOverflowScrollQuirk() const;
  • trunk/Source/WebKit/ChangeLog

    r246928 r246931  
     12019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
     4        https://bugs.webkit.org/show_bug.cgi?id=199331
     5        <rdar://problem/52116170>
     6
     7        Reviewed by Tim Horton.
     8
     9        Expose new SPI, such that clients may check whether to avoid resizing the web view when changing input view
     10        bounds. In particular, resizing the web view in this case causes toolbar menus in Microsoft Word online to
     11        dismiss immediately after opening them, due to resize events fired as a result of the input view dismissing.
     12
     13        * Shared/FocusedElementInformation.cpp:
     14        (WebKit::FocusedElementInformation::encode const):
     15        (WebKit::FocusedElementInformation::decode):
     16        * Shared/FocusedElementInformation.h:
     17
     18        Add a new flag to FocusedElementInformation to indicate whether we should avoid resizing the web view when an
     19        input view is presented.
     20
     21        * UIProcess/API/Cocoa/WKWebView.mm:
     22        (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]):
     23        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     24        * UIProcess/ios/WKContentViewInteraction.h:
     25        * UIProcess/ios/WKContentViewInteraction.mm:
     26        (-[WKContentView _elementDidBlur]):
     27
     28        Reset the value of the flag.
     29
     30        (-[WKContentView _shouldAvoidResizingWhenInputViewBoundsChange]):
     31        * WebProcess/WebPage/ios/WebPageIOS.mm:
     32        (WebKit::WebPage::getFocusedElementInformation):
     33
    1342019-06-28  Jer Noble  <jer.noble@apple.com>
    235
  • trunk/Source/WebKit/Shared/FocusedElementInformation.cpp

    r246311 r246931  
    107107    encoder << shouldSynthesizeKeyEventsForEditing;
    108108    encoder << isSpellCheckingEnabled;
     109    encoder << shouldAvoidResizingWhenInputViewBoundsChange;
    109110}
    110111
     
    231232        return false;
    232233
     234    if (!decoder.decode(result.shouldAvoidResizingWhenInputViewBoundsChange))
     235        return false;
     236
    233237    return true;
    234238}
  • trunk/Source/WebKit/Shared/FocusedElementInformation.h

    r246311 r246931  
    139139    bool shouldSynthesizeKeyEventsForEditing { false };
    140140    bool isSpellCheckingEnabled { true };
     141    bool shouldAvoidResizingWhenInputViewBoundsChange { false };
    141142
    142143    FocusedElementIdentifier focusedElementIdentifier { 0 };
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r246928 r246931  
    14261426}
    14271427
     1428- (BOOL)_shouldAvoidResizingWhenInputViewBoundsChange
     1429{
     1430    return [_contentView _shouldAvoidResizingWhenInputViewBoundsChange];
     1431}
     1432
    14281433- (_WKDragInteractionPolicy)_dragInteractionPolicy
    14291434{
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r246928 r246931  
    273273
    274274@property (nonatomic, setter=_setDragInteractionPolicy:) _WKDragInteractionPolicy _dragInteractionPolicy WK_API_AVAILABLE(ios(11.0));
     275@property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange WK_API_AVAILABLE(ios(WK_IOS_TBA));
    275276
    276277- (void)_beginInteractiveObscuredInsetsChange;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r246912 r246931  
    526526- (void)_didStartProvisionalLoadForMainFrame;
    527527
    528 @property (nonatomic, readonly, getter=_shouldUseContextMenus) BOOL _shouldUseContextMenus;
     528@property (nonatomic, readonly) BOOL _shouldUseContextMenus;
     529@property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange;
    529530
    530531@end
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r246924 r246931  
    53015301    _focusedElementInformation.elementType = WebKit::InputType::None;
    53025302    _focusedElementInformation.shouldSynthesizeKeyEventsForEditing = false;
     5303    _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange = false;
    53035304    _inputPeripheral = nil;
    53045305    _focusRequiresStrongPasswordAssistance = NO;
     
    62206221#endif
    62216222    return NO;
     6223}
     6224
     6225- (BOOL)_shouldAvoidResizingWhenInputViewBoundsChange
     6226{
     6227    return _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange;
    62226228}
    62236229
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r246892 r246931  
    29702970        information.isAutocorrect = false;
    29712971    }
     2972
     2973    information.shouldAvoidResizingWhenInputViewBoundsChange = m_focusedElement->document().quirks().shouldAvoidResizingWhenInputViewBoundsChange();
    29722974}
    29732975
Note: See TracChangeset for help on using the changeset viewer.