Title: [247773] branches/safari-608-branch/Source
Revision
247773
Author
[email protected]
Date
2019-07-24 10:14:30 -0700 (Wed, 24 Jul 2019)

Log Message

Cherry-pick r247746. rdar://problem/53483297

    [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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247746 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (247772 => 247773)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-24 17:14:30 UTC (rev 247773)
@@ -1,5 +1,65 @@
 2019-07-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r247746. rdar://problem/53483297
+
+    [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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-23  Zalan Bujtas  <[email protected]>
+
+            [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.
+
+            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:
+
+2019-07-24  Alan Coon  <[email protected]>
+
         Cherry-pick r247674. rdar://problem/53483189
 
     [iOS] Fast and complex text codepaths disagree about how to lay out bopomofo with tone marks

Modified: branches/safari-608-branch/Source/WebCore/page/Quirks.cpp (247772 => 247773)


--- branches/safari-608-branch/Source/WebCore/page/Quirks.cpp	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebCore/page/Quirks.cpp	2019-07-24 17:14:30 UTC (rev 247773)
@@ -424,4 +424,12 @@
 #endif
 }
 
+bool Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible() const
+{
+    if (!needsQuirks())
+        return false;
+
+    return equalLettersIgnoringASCIICase(m_document->url().host(), "www.zillow.com");
 }
+
+}

Modified: branches/safari-608-branch/Source/WebCore/page/Quirks.h (247772 => 247773)


--- branches/safari-608-branch/Source/WebCore/page/Quirks.h	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebCore/page/Quirks.h	2019-07-24 17:14:30 UTC (rev 247773)
@@ -62,6 +62,7 @@
     WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
     WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
     WEBCORE_EXPORT bool shouldAvoidResizingWhenInputViewBoundsChange() const;
+    WEBCORE_EXPORT bool shouldAvoidScrollingWhenFocusedContentIsVisible() const;
 
     WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
 

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-07-24 17:14:30 UTC (rev 247773)
@@ -1,5 +1,67 @@
 2019-07-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r247746. rdar://problem/53483297
+
+    [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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-23  Zalan Bujtas  <[email protected]>
+
+            [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.
+
+            * 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):
+
+2019-07-24  Alan Coon  <[email protected]>
+
         Revert r247700. rdar://problem/53456070
 
 2019-07-23  Alan Coon  <[email protected]>

Modified: branches/safari-608-branch/Source/WebKit/Shared/FocusedElementInformation.cpp (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/Shared/FocusedElementInformation.cpp	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/Shared/FocusedElementInformation.cpp	2019-07-24 17:14:30 UTC (rev 247773)
@@ -107,6 +107,7 @@
     encoder << shouldSynthesizeKeyEventsForEditing;
     encoder << isSpellCheckingEnabled;
     encoder << shouldAvoidResizingWhenInputViewBoundsChange;
+    encoder << shouldAvoidScrollingWhenFocusedContentIsVisible;
 }
 
 bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInformation& result)
@@ -234,6 +235,9 @@
     if (!decoder.decode(result.shouldAvoidResizingWhenInputViewBoundsChange))
         return false;
 
+    if (!decoder.decode(result.shouldAvoidScrollingWhenFocusedContentIsVisible))
+        return false;
+
     return true;
 }
 #endif

Modified: branches/safari-608-branch/Source/WebKit/Shared/FocusedElementInformation.h (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/Shared/FocusedElementInformation.h	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/Shared/FocusedElementInformation.h	2019-07-24 17:14:30 UTC (rev 247773)
@@ -139,6 +139,7 @@
     bool shouldSynthesizeKeyEventsForEditing { false };
     bool isSpellCheckingEnabled { true };
     bool shouldAvoidResizingWhenInputViewBoundsChange { false };
+    bool shouldAvoidScrollingWhenFocusedContentIsVisible { false };
 
     FocusedElementIdentifier focusedElementIdentifier { 0 };
 

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-07-24 17:14:30 UTC (rev 247773)
@@ -2417,7 +2417,8 @@
     focusedElementRectInNewScale.moveBy([_contentView frame].origin);
 
     BOOL selectionRectIsNotNull = !selectionRectInDocumentCoordinates.isZero();
-    if (!forceScroll) {
+    BOOL doNotScrollWhenContentIsAlreadyVisible = !forceScroll || [_contentView _shouldAvoidScrollingWhenFocusedContentIsVisible];
+    if (doNotScrollWhenContentIsAlreadyVisible) {
         CGRect currentlyVisibleRegionInWebViewCoordinates;
         currentlyVisibleRegionInWebViewCoordinates.origin = unobscuredScrollViewRectInWebViewCoordinates.origin;
         currentlyVisibleRegionInWebViewCoordinates.origin.y += visibleOffsetFromTop;

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-07-24 17:14:30 UTC (rev 247773)
@@ -535,6 +535,7 @@
 
 @property (nonatomic, readonly) BOOL _shouldUseContextMenus;
 @property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange;
+@property (nonatomic, readonly) BOOL _shouldAvoidScrollingWhenFocusedContentIsVisible;
 
 @end
 

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-24 17:14:30 UTC (rev 247773)
@@ -5376,6 +5376,7 @@
     _focusedElementInformation.elementType = WebKit::InputType::None;
     _focusedElementInformation.shouldSynthesizeKeyEventsForEditing = false;
     _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange = false;
+    _focusedElementInformation.shouldAvoidScrollingWhenFocusedContentIsVisible = false;
     _inputPeripheral = nil;
     _focusRequiresStrongPasswordAssistance = NO;
 
@@ -6306,6 +6307,11 @@
     return _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange;
 }
 
+- (BOOL)_shouldAvoidScrollingWhenFocusedContentIsVisible
+{
+    return _focusedElementInformation.shouldAvoidScrollingWhenFocusedContentIsVisible;
+}
+
 - (UIView *)containerViewForTargetedPreviews
 {
     return self.unscaledView ?: self;

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (247772 => 247773)


--- branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-07-24 17:14:25 UTC (rev 247772)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-07-24 17:14:30 UTC (rev 247773)
@@ -3051,7 +3051,9 @@
         information.isAutocorrect = false;
     }
 
-    information.shouldAvoidResizingWhenInputViewBoundsChange = m_focusedElement->document().quirks().shouldAvoidResizingWhenInputViewBoundsChange();
+    auto& quirks = m_focusedElement->document().quirks();
+    information.shouldAvoidResizingWhenInputViewBoundsChange = quirks.shouldAvoidResizingWhenInputViewBoundsChange();
+    information.shouldAvoidScrollingWhenFocusedContentIsVisible = quirks.shouldAvoidScrollingWhenFocusedContentIsVisible();
 }
 
 void WebPage::autofillLoginCredentials(const String& username, const String& password)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to