Title: [280145] branches/safari-612.1.24.0-branch/Source/WebKit
Revision
280145
Author
[email protected]
Date
2021-07-21 10:03:04 -0700 (Wed, 21 Jul 2021)

Log Message

Cherry-pick r280119. rdar://problem/80902802

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

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

Modified Paths

Diff

Modified: branches/safari-612.1.24.0-branch/Source/WebKit/ChangeLog (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/ChangeLog	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/ChangeLog	2021-07-21 17:03:04 UTC (rev 280145)
@@ -1,3 +1,82 @@
+2021-07-21  Alan Coon  <[email protected]>
+
+        Cherry-pick r280119. rdar://problem/80902802
+
+    [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:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280119 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-19  Russell Epstein  <[email protected]>
 
         Cherry-pick r280019. rdar://problem/80788628

Modified: branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-07-21 17:03:04 UTC (rev 280145)
@@ -2518,6 +2518,11 @@
     return true;
 }
 
+- (BOOL)_needsSiteSpecificQuirks
+{
+    return _page && _page->needsSiteSpecificQuirks();
+}
+
 - (pid_t)_webProcessIdentifier
 {
     if (![self _isValid])

Modified: branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2021-07-21 17:03:04 UTC (rev 280145)
@@ -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: branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-21 17:03:04 UTC (rev 280145)
@@ -7627,6 +7627,8 @@
         if (auto* automationSession = process().processPool().automationSession())
             automationSession->terminate();
     }
+
+    m_needsSiteSpecificQuirks = true;
 }
 
 void WebPageProxy::provisionalProcessDidTerminate()

Modified: branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.h (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-21 17:03:04 UTC (rev 280145)
@@ -1958,6 +1958,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();
@@ -3071,6 +3074,8 @@
 #if ENABLE(IMAGE_ANALYSIS) && PLATFORM(MAC)
     RetainPtr<WKQuickLookPreviewController> m_quickLookPreviewController;
 #endif
+
+    bool m_needsSiteSpecificQuirks { true };
 };
 
 #ifdef __OBJC__

Modified: branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-21 17:03:04 UTC (rev 280145)
@@ -415,6 +415,8 @@
     ShowDataDetectorsUIForPositionInformation(struct WebKit::InteractionInformationAtPosition information)
 #endif
 
+    SetNeedsSiteSpecificQuirks(bool needsSiteSpecificQuirks)
+
     DidChangeInspectorFrontendCount(uint64_t count)
 
     CreateInspectorTarget(String targetId, enum:uint8_t Inspector::InspectorTargetType type)

Modified: branches/safari-612.1.24.0-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-21 17:03:04 UTC (rev 280145)
@@ -6266,6 +6266,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: branches/safari-612.1.24.0-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (280144 => 280145)


--- branches/safari-612.1.24.0-branch/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-21 17:01:47 UTC (rev 280144)
+++ branches/safari-612.1.24.0-branch/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-21 17:03:04 UTC (rev 280145)
@@ -2382,6 +2382,8 @@
 #if ENABLE(APP_HIGHLIGHTS)
     WebCore::HighlightVisibility m_appHighlightsVisible { false };
 #endif
+
+    bool m_needsSiteSpecificQuirks { true };
 };
 
 #if !PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to