- Revision
- 246931
- Author
- wenson_hs...@apple.com
- Date
- 2019-06-28 13:12:45 -0700 (Fri, 28 Jun 2019)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246930 => 246931)
--- trunk/Source/WebCore/ChangeLog 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebCore/ChangeLog 2019-06-28 20:12:45 UTC (rev 246931)
@@ -1,3 +1,17 @@
+2019-06-28 Wenson Hsieh <wenson_hs...@apple.com>
+
+ 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.
+
+ 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:
+
2019-06-28 Konstantin Tokarev <annu...@yandex.ru>
Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733
Modified: trunk/Source/WebCore/page/Quirks.cpp (246930 => 246931)
--- trunk/Source/WebCore/page/Quirks.cpp 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebCore/page/Quirks.cpp 2019-06-28 20:12:45 UTC (rev 246931)
@@ -298,6 +298,15 @@
}
#endif
+bool Quirks::shouldAvoidResizingWhenInputViewBoundsChange() const
+{
+ if (!needsQuirks())
+ return false;
+
+ auto host = m_document->topDocument().url().host();
+ return equalLettersIgnoringASCIICase(host, "live.com") || host.endsWithIgnoringASCIICase(".live.com");
+}
+
bool Quirks::shouldDisablePointerEventsQuirk() const
{
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/page/Quirks.h (246930 => 246931)
--- trunk/Source/WebCore/page/Quirks.h 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebCore/page/Quirks.h 2019-06-28 20:12:45 UTC (rev 246931)
@@ -60,6 +60,7 @@
WEBCORE_EXPORT bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const;
WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
+ WEBCORE_EXPORT bool shouldAvoidResizingWhenInputViewBoundsChange() const;
bool needsGMailOverflowScrollQuirk() const;
bool needsYouTubeOverflowScrollQuirk() const;
Modified: trunk/Source/WebKit/ChangeLog (246930 => 246931)
--- trunk/Source/WebKit/ChangeLog 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/ChangeLog 2019-06-28 20:12:45 UTC (rev 246931)
@@ -1,3 +1,36 @@
+2019-06-28 Wenson Hsieh <wenson_hs...@apple.com>
+
+ 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.
+
+ 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):
+
2019-06-28 Jer Noble <jer.no...@apple.com>
Add new -[WKWebView _closeAllMediaPresentations] SPI
Modified: trunk/Source/WebKit/Shared/FocusedElementInformation.cpp (246930 => 246931)
--- trunk/Source/WebKit/Shared/FocusedElementInformation.cpp 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/Shared/FocusedElementInformation.cpp 2019-06-28 20:12:45 UTC (rev 246931)
@@ -106,6 +106,7 @@
#endif
encoder << shouldSynthesizeKeyEventsForEditing;
encoder << isSpellCheckingEnabled;
+ encoder << shouldAvoidResizingWhenInputViewBoundsChange;
}
bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInformation& result)
@@ -230,6 +231,9 @@
if (!decoder.decode(result.isSpellCheckingEnabled))
return false;
+ if (!decoder.decode(result.shouldAvoidResizingWhenInputViewBoundsChange))
+ return false;
+
return true;
}
#endif
Modified: trunk/Source/WebKit/Shared/FocusedElementInformation.h (246930 => 246931)
--- trunk/Source/WebKit/Shared/FocusedElementInformation.h 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/Shared/FocusedElementInformation.h 2019-06-28 20:12:45 UTC (rev 246931)
@@ -138,6 +138,7 @@
#endif
bool shouldSynthesizeKeyEventsForEditing { false };
bool isSpellCheckingEnabled { true };
+ bool shouldAvoidResizingWhenInputViewBoundsChange { false };
FocusedElementIdentifier focusedElementIdentifier { 0 };
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (246930 => 246931)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-06-28 20:12:45 UTC (rev 246931)
@@ -1425,6 +1425,11 @@
return self._currentContentView.isFirstResponder;
}
+- (BOOL)_shouldAvoidResizingWhenInputViewBoundsChange
+{
+ return [_contentView _shouldAvoidResizingWhenInputViewBoundsChange];
+}
+
- (_WKDragInteractionPolicy)_dragInteractionPolicy
{
return _dragInteractionPolicy;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (246930 => 246931)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2019-06-28 20:12:45 UTC (rev 246931)
@@ -272,6 +272,7 @@
@property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter;
@property (nonatomic, setter=_setDragInteractionPolicy:) _WKDragInteractionPolicy _dragInteractionPolicy WK_API_AVAILABLE(ios(11.0));
+@property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)_beginInteractiveObscuredInsetsChange;
- (void)_endInteractiveObscuredInsetsChange;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (246930 => 246931)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2019-06-28 20:12:45 UTC (rev 246931)
@@ -525,7 +525,8 @@
- (void)_didStartProvisionalLoadForMainFrame;
-@property (nonatomic, readonly, getter=_shouldUseContextMenus) BOOL _shouldUseContextMenus;
+@property (nonatomic, readonly) BOOL _shouldUseContextMenus;
+@property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange;
@end
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (246930 => 246931)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-06-28 20:12:45 UTC (rev 246931)
@@ -5300,6 +5300,7 @@
_focusedElementInformation.elementType = WebKit::InputType::None;
_focusedElementInformation.shouldSynthesizeKeyEventsForEditing = false;
+ _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange = false;
_inputPeripheral = nil;
_focusRequiresStrongPasswordAssistance = NO;
@@ -6221,6 +6222,11 @@
return NO;
}
+- (BOOL)_shouldAvoidResizingWhenInputViewBoundsChange
+{
+ return _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange;
+}
+
- (UIView *)containerViewForTargetedPreviews
{
return self.unscaledView ?: self;
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (246930 => 246931)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-28 20:00:37 UTC (rev 246930)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-28 20:12:45 UTC (rev 246931)
@@ -2969,6 +2969,8 @@
information.autocapitalizeType = AutocapitalizeTypeNone;
information.isAutocorrect = false;
}
+
+ information.shouldAvoidResizingWhenInputViewBoundsChange = m_focusedElement->document().quirks().shouldAvoidResizingWhenInputViewBoundsChange();
}
void WebPage::autofillLoginCredentials(const String& username, const String& password)