Changeset 247746 in webkit


Ignore:
Timestamp:
Jul 23, 2019 2:49:00 PM (5 years ago)
Author:
Alan Bujtas
Message:

[iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
https://bugs.webkit.org/show_bug.cgi?id=200044
<rdar://problem/53103732>

Reviewed by Wenson Hsieh.

Source/WebCore:

  1. The keyboard gets dismissed as the result of scroll event.
  2. The (horizontal)scroll event is initiated by WebKit as we try to re-center the content.
  3. The content gets off-centered as the result of the newly constructed drop-down menu which slightly sticks out of the document to the right (layout overflows).

It works with shipping version of iOS because _zoomToFocusRect operates on stale viewport information (see r244494 for the progression).
This patch applies a site specific quirk to restore shipping behavior.

  • page/Quirks.cpp:

(WebCore::Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible const):

  • page/Quirks.h:

Source/WebKit:

  • Shared/FocusedElementInformation.cpp:

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

  • Shared/FocusedElementInformation.h:
  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):

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

(-[WKContentView _elementDidBlur]):
(-[WKContentView _shouldAvoidScrollingWhenFocusedContentIsVisible]):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::getFocusedElementInformation):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r247735 r247746  
     12019-07-23  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
     4        https://bugs.webkit.org/show_bug.cgi?id=200044
     5        <rdar://problem/53103732>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        1. The keyboard gets dismissed as the result of scroll event.
     10        2. The (horizontal)scroll event is initiated by WebKit as we try to re-center the content.
     11        3. The content gets off-centered as the result of the newly constructed drop-down menu which slightly sticks out of the document to the right (layout overflows).
     12
     13        It works with shipping version of iOS because _zoomToFocusRect operates on stale viewport information (see r244494 for the progression).
     14        This patch applies a site specific quirk to restore shipping behavior.
     15
     16        * page/Quirks.cpp:
     17        (WebCore::Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible const):
     18        * page/Quirks.h:
     19
    1202019-07-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
    221
  • trunk/Source/WebCore/page/Quirks.cpp

    r247627 r247746  
    438438}
    439439
    440 }
     440bool Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible() const
     441{
     442    if (!needsQuirks())
     443        return false;
     444
     445    return equalLettersIgnoringASCIICase(m_document->url().host(), "www.zillow.com");
     446}
     447
     448}
  • trunk/Source/WebCore/page/Quirks.h

    r247621 r247746  
    6363    WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
    6464    WEBCORE_EXPORT bool shouldAvoidResizingWhenInputViewBoundsChange() const;
     65    WEBCORE_EXPORT bool shouldAvoidScrollingWhenFocusedContentIsVisible() const;
    6566
    6667    WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
  • trunk/Source/WebKit/ChangeLog

    r247745 r247746  
     12019-07-23  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
     4        https://bugs.webkit.org/show_bug.cgi?id=200044
     5        <rdar://problem/53103732>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * Shared/FocusedElementInformation.cpp:
     10        (WebKit::FocusedElementInformation::encode const):
     11        (WebKit::FocusedElementInformation::decode):
     12        * Shared/FocusedElementInformation.h:
     13        * UIProcess/API/Cocoa/WKWebView.mm:
     14        (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
     15        * UIProcess/ios/WKContentViewInteraction.h:
     16        * UIProcess/ios/WKContentViewInteraction.mm:
     17        (-[WKContentView _elementDidBlur]):
     18        (-[WKContentView _shouldAvoidScrollingWhenFocusedContentIsVisible]):
     19        * WebProcess/WebPage/ios/WebPageIOS.mm:
     20        (WebKit::WebPage::getFocusedElementInformation):
     21
    1222019-07-23  Alex Christensen  <achristensen@webkit.org>
    223
  • trunk/Source/WebKit/Shared/FocusedElementInformation.cpp

    r246931 r247746  
    108108    encoder << isSpellCheckingEnabled;
    109109    encoder << shouldAvoidResizingWhenInputViewBoundsChange;
     110    encoder << shouldAvoidScrollingWhenFocusedContentIsVisible;
    110111}
    111112
     
    235236        return false;
    236237
     238    if (!decoder.decode(result.shouldAvoidScrollingWhenFocusedContentIsVisible))
     239        return false;
     240
    237241    return true;
    238242}
  • trunk/Source/WebKit/Shared/FocusedElementInformation.h

    r246931 r247746  
    140140    bool isSpellCheckingEnabled { true };
    141141    bool shouldAvoidResizingWhenInputViewBoundsChange { false };
     142    bool shouldAvoidScrollingWhenFocusedContentIsVisible { false };
    142143
    143144    FocusedElementIdentifier focusedElementIdentifier { 0 };
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r247658 r247746  
    24232423
    24242424    BOOL selectionRectIsNotNull = !selectionRectInDocumentCoordinates.isZero();
    2425     if (!forceScroll) {
     2425    BOOL doNotScrollWhenContentIsAlreadyVisible = !forceScroll || [_contentView _shouldAvoidScrollingWhenFocusedContentIsVisible];
     2426    if (doNotScrollWhenContentIsAlreadyVisible) {
    24262427        CGRect currentlyVisibleRegionInWebViewCoordinates;
    24272428        currentlyVisibleRegionInWebViewCoordinates.origin = unobscuredScrollViewRectInWebViewCoordinates.origin;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r247687 r247746  
    539539@property (nonatomic, readonly) BOOL _shouldUseContextMenus;
    540540@property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange;
     541@property (nonatomic, readonly) BOOL _shouldAvoidScrollingWhenFocusedContentIsVisible;
    541542
    542543@end
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r247704 r247746  
    54015401    _focusedElementInformation.shouldSynthesizeKeyEventsForEditing = false;
    54025402    _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange = false;
     5403    _focusedElementInformation.shouldAvoidScrollingWhenFocusedContentIsVisible = false;
    54035404    _inputPeripheral = nil;
    54045405    _focusRequiresStrongPasswordAssistance = NO;
     
    63506351{
    63516352    return _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange;
     6353}
     6354
     6355- (BOOL)_shouldAvoidScrollingWhenFocusedContentIsVisible
     6356{
     6357    return _focusedElementInformation.shouldAvoidScrollingWhenFocusedContentIsVisible;
    63526358}
    63536359
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r247679 r247746  
    30543054    }
    30553055
    3056     information.shouldAvoidResizingWhenInputViewBoundsChange = m_focusedElement->document().quirks().shouldAvoidResizingWhenInputViewBoundsChange();
     3056    auto& quirks = m_focusedElement->document().quirks();
     3057    information.shouldAvoidResizingWhenInputViewBoundsChange = quirks.shouldAvoidResizingWhenInputViewBoundsChange();
     3058    information.shouldAvoidScrollingWhenFocusedContentIsVisible = quirks.shouldAvoidScrollingWhenFocusedContentIsVisible();
    30573059}
    30583060
Note: See TracChangeset for help on using the changeset viewer.