- Revision
- 280119
- Author
- [email protected]
- Date
- 2021-07-20 17:51:27 -0700 (Tue, 20 Jul 2021)
Log Message
[iOS] Add SPI for internal clients to consult whether or not viewport quirks should be enabled
https://bugs.webkit.org/show_bug.cgi?id=228123
rdar://80397679
Reviewed by Tim Horton.
Add support for an SPI property on WKWebView that indicates whether site-specific quirks should be enabled.
For now, this flag is only updated whenever we commit a mainframe load, which is sufficient for the purposes of
Safari to determine whether or not to use quirked viewport behaviors for tab pill behavior.
If needed in the future, this property should probably:
1. Support KVO, and...
2. Change eagerly when the option is toggled via Web Inspector.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _needsSiteSpecificQuirks]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetStateAfterProcessTermination):
Maintain a corresponding flag on the WebPageProxy in the UI process, which starts out as `true` and is reset
if the web process terminates.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
Add plumbing to propagate changes in the boolean flag to the UI process.
(WebKit::WebPage::didCommitLoad):
Update the flag on WebPage.
* WebProcess/WebPage/WebPage.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (280118 => 280119)
--- trunk/Source/WebKit/ChangeLog 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/ChangeLog 2021-07-21 00:51:27 UTC (rev 280119)
@@ -1,3 +1,40 @@
+2021-07-20 Wenson Hsieh <[email protected]>
+
+ [iOS] Add SPI for internal clients to consult whether or not viewport quirks should be enabled
+ https://bugs.webkit.org/show_bug.cgi?id=228123
+ rdar://80397679
+
+ Reviewed by Tim Horton.
+
+ Add support for an SPI property on WKWebView that indicates whether site-specific quirks should be enabled.
+ For now, this flag is only updated whenever we commit a mainframe load, which is sufficient for the purposes of
+ Safari to determine whether or not to use quirked viewport behaviors for tab pill behavior.
+
+ If needed in the future, this property should probably:
+ 1. Support KVO, and...
+ 2. Change eagerly when the option is toggled via Web Inspector.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _needsSiteSpecificQuirks]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::resetStateAfterProcessTermination):
+
+ Maintain a corresponding flag on the WebPageProxy in the UI process, which starts out as `true` and is reset
+ if the web process terminates.
+
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebPage/WebPage.cpp:
+
+ Add plumbing to propagate changes in the boolean flag to the UI process.
+
+ (WebKit::WebPage::didCommitLoad):
+
+ Update the flag on WebPage.
+
+ * WebProcess/WebPage/WebPage.h:
+
2021-07-20 Kyle Piddington <[email protected]>
REGRESSION(ANGLE+METAL): WebGL2 content low frame rate
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (280118 => 280119)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-07-21 00:51:27 UTC (rev 280119)
@@ -2518,6 +2518,11 @@
return true;
}
+- (BOOL)_needsSiteSpecificQuirks
+{
+ return _page && _page->needsSiteSpecificQuirks();
+}
+
- (pid_t)_webProcessIdentifier
{
if (![self _isValid])
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (280118 => 280119)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2021-07-21 00:51:27 UTC (rev 280119)
@@ -412,6 +412,8 @@
- (void)_suspendPage:(void (^)(BOOL))completionHandler WK_API_AVAILABLE(macos(12.0), ios(15.0));
- (void)_resumePage:(void (^)(BOOL))completionHandler WK_API_AVAILABLE(macos(12.0), ios(15.0));
+@property (nonatomic, readonly) BOOL _needsSiteSpecificQuirks WK_API_AVAILABLE(macos(12.0), ios(15.0));
+
@end
#if TARGET_OS_IPHONE
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (280118 => 280119)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-07-21 00:51:27 UTC (rev 280119)
@@ -7639,6 +7639,8 @@
if (auto* automationSession = process().processPool().automationSession())
automationSession->terminate();
}
+
+ m_needsSiteSpecificQuirks = true;
}
void WebPageProxy::provisionalProcessDidTerminate()
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (280118 => 280119)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-07-21 00:51:27 UTC (rev 280119)
@@ -1960,6 +1960,9 @@
WKQuickLookPreviewController *quickLookPreviewController() const { return m_quickLookPreviewController.get(); }
#endif
+ bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
+ void setNeedsSiteSpecificQuirks(bool value) { m_needsSiteSpecificQuirks = value; }
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&);
void platformInitialize();
@@ -3076,6 +3079,8 @@
#if ENABLE(IMAGE_ANALYSIS) && PLATFORM(MAC)
RetainPtr<WKQuickLookPreviewController> m_quickLookPreviewController;
#endif
+
+ bool m_needsSiteSpecificQuirks { true };
};
#ifdef __OBJC__
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (280118 => 280119)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-07-21 00:51:27 UTC (rev 280119)
@@ -413,6 +413,8 @@
ShowDataDetectorsUIForPositionInformation(struct WebKit::InteractionInformationAtPosition information)
#endif
+ SetNeedsSiteSpecificQuirks(bool needsSiteSpecificQuirks)
+
DidChangeInspectorFrontendCount(uint64_t count)
CreateInspectorTarget(String targetId, enum:uint8_t Inspector::InspectorTargetType type)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (280118 => 280119)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-07-21 00:51:27 UTC (rev 280119)
@@ -6273,6 +6273,12 @@
if (!frame->isMainFrame())
return;
+ bool needsSiteSpecificQuirks = frame->coreFrame()->settings().needsSiteSpecificQuirks();
+ if (m_needsSiteSpecificQuirks != needsSiteSpecificQuirks) {
+ m_needsSiteSpecificQuirks = needsSiteSpecificQuirks;
+ send(Messages::WebPageProxy::SetNeedsSiteSpecificQuirks(needsSiteSpecificQuirks));
+ }
+
if (m_drawingArea)
m_drawingArea->sendEnterAcceleratedCompositingModeIfNeeded();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (280118 => 280119)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-07-21 00:37:42 UTC (rev 280118)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-07-21 00:51:27 UTC (rev 280119)
@@ -2378,6 +2378,8 @@
#if ENABLE(APP_HIGHLIGHTS)
WebCore::HighlightVisibility m_appHighlightsVisible { false };
#endif
+
+ bool m_needsSiteSpecificQuirks { true };
};
#if !PLATFORM(IOS_FAMILY)