⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276490 in webkit


Ignore:
Timestamp:
Apr 23, 2021, 12:16:49 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Implement PageClient::makeViewBlank()
https://bugs.webkit.org/show_bug.cgi?id=224236

Reviewed by Chris Dumez.

Make most of the changes in r275485 cross platform and implement PageClient::makeViewBlank() for the GTK port.

  • UIProcess/API/glib/WebKitUIClient.cpp:
  • UIProcess/API/gtk/PageClientImpl.cpp:

(WebKit::PageClientImpl::makeViewBlank):

  • UIProcess/API/gtk/PageClientImpl.h:
  • UIProcess/API/gtk/WebKitWebViewBase.cpp:

(webkitWebViewBaseSnapshot):
(webkitWebViewBaseDraw):
(webkitWebViewBaseMakeBlank):

  • UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
(WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit):
(WebKit::WebPageProxy::didCommitLoadForFrame):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): Deleted.

  • WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:

(WebKit::CompositingCoordinator::flushPendingLayerChanges):

  • WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:

(WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
(WebKit::DrawingAreaCoordinatedGraphics::display):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::didUpdateRendering):
(WebKit::WebPage::didCommitLoad):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::didUpdateRendering): Deleted.

Location:
trunk/Source/WebKit
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r276482 r276490  
     12021-04-23  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Implement PageClient::makeViewBlank()
     4        https://bugs.webkit.org/show_bug.cgi?id=224236
     5
     6        Reviewed by Chris Dumez.
     7
     8        Make most of the changes in r275485 cross platform and implement PageClient::makeViewBlank() for the GTK port.
     9
     10        * UIProcess/API/glib/WebKitUIClient.cpp:
     11        * UIProcess/API/gtk/PageClientImpl.cpp:
     12        (WebKit::PageClientImpl::makeViewBlank):
     13        * UIProcess/API/gtk/PageClientImpl.h:
     14        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     15        (webkitWebViewBaseSnapshot):
     16        (webkitWebViewBaseDraw):
     17        (webkitWebViewBaseMakeBlank):
     18        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
     21        (WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
     22        (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit):
     23        (WebKit::WebPageProxy::didCommitLoadForFrame):
     24        * UIProcess/WebPageProxy.h:
     25        * UIProcess/WebPageProxy.messages.in:
     26        * UIProcess/mac/WebPageProxyMac.mm:
     27        (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): Deleted.
     28        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
     29        (WebKit::CompositingCoordinator::flushPendingLayerChanges):
     30        * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
     31        (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
     32        (WebKit::DrawingAreaCoordinatedGraphics::display):
     33        * WebProcess/WebPage/WebPage.cpp:
     34        (WebKit::WebPage::didUpdateRendering):
     35        (WebKit::WebPage::didCommitLoad):
     36        * WebProcess/WebPage/WebPage.h:
     37        * WebProcess/WebPage/mac/WebPageMac.mm:
     38        (WebKit::WebPage::didUpdateRendering): Deleted.
     39
    1402021-04-22  Jer Noble  <jer.noble@apple.com>
    241
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp

    r273075 r276490  
    8181    }
    8282
    83     void runJavaScriptAlert(WebPageProxy&, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void()>&& completionHandler) final
    84     {
     83    void runJavaScriptAlert(WebPageProxy& page, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void()>&& completionHandler) final
     84    {
     85        page.makeViewBlankIfUnpaintedSinceLastLoadCommit();
    8586        webkitWebViewRunJavaScriptAlert(m_webView, message.utf8(), WTFMove(completionHandler));
    8687    }
    8788
    88     void runJavaScriptConfirm(WebPageProxy&, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(bool)>&& completionHandler) final
    89     {
     89    void runJavaScriptConfirm(WebPageProxy& page, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(bool)>&& completionHandler) final
     90    {
     91        page.makeViewBlankIfUnpaintedSinceLastLoadCommit();
    9092        webkitWebViewRunJavaScriptConfirm(m_webView, message.utf8(), WTFMove(completionHandler));
    9193    }
    9294
    93     void runJavaScriptPrompt(WebPageProxy&, const String& message, const String& defaultValue, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(const String&)>&& completionHandler) final
    94     {
     95    void runJavaScriptPrompt(WebPageProxy& page, const String& message, const String& defaultValue, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(const String&)>&& completionHandler) final
     96    {
     97        page.makeViewBlankIfUnpaintedSinceLastLoadCommit();
    9598        webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8(), WTFMove(completionHandler));
    9699    }
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp

    r276448 r276490  
    642642}
    643643
     644void PageClientImpl::makeViewBlank(bool makeBlank)
     645{
     646    webkitWebViewBaseMakeBlank(WEBKIT_WEB_VIEW_BASE(m_viewWidget), makeBlank);
     647}
     648
    644649} // namespace WebKit
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h

    r276448 r276490  
    178178    String themeName() const override;
    179179
     180    void makeViewBlank(bool) override;
     181
    180182    // Members of PageClientImpl class
    181183    GtkWidget* m_viewWidget;
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r274815 r276490  
    284284    IntSize contentsSize;
    285285    Optional<MotionEvent> lastMotionEvent;
     286    bool isBlank;
    286287
    287288    GtkWindow* toplevelOnScreenWindow { nullptr };
     
    746747        return;
    747748
    748     ASSERT(drawingArea->isInAcceleratedCompositingMode());
    749     webViewBase->priv->acceleratedBackingStore->snapshot(snapshot);
     749    if (!webViewBase->priv->isBlank) {
     750        ASSERT(drawingArea->isInAcceleratedCompositingMode());
     751        webViewBase->priv->acceleratedBackingStore->snapshot(snapshot);
     752    }
    750753
    751754    if (webViewBase->priv->inspectorView)
     
    767770        return FALSE;
    768771
    769     bool showingNavigationSnapshot = webViewBase->priv->pageProxy->isShowingNavigationGestureSnapshot();
    770     if (showingNavigationSnapshot)
    771         cairo_push_group(cr);
    772 
    773     if (drawingArea->isInAcceleratedCompositingMode()) {
    774         ASSERT(webViewBase->priv->acceleratedBackingStore);
    775         webViewBase->priv->acceleratedBackingStore->paint(cr, clipRect);
    776     } else {
    777         WebCore::Region unpaintedRegion; // This is simply unused.
    778         drawingArea->paint(cr, clipRect, unpaintedRegion);
    779     }
    780 
    781     if (showingNavigationSnapshot) {
    782         RefPtr<cairo_pattern_t> group = adoptRef(cairo_pop_group(cr));
    783         if (auto* controller = webkitWebViewBaseViewGestureController(webViewBase))
    784             controller->draw(cr, group.get());
     772    if (!webViewBase->priv->isBlank) {
     773        bool showingNavigationSnapshot = webViewBase->priv->pageProxy->isShowingNavigationGestureSnapshot();
     774        if (showingNavigationSnapshot)
     775            cairo_push_group(cr);
     776
     777        if (drawingArea->isInAcceleratedCompositingMode()) {
     778            ASSERT(webViewBase->priv->acceleratedBackingStore);
     779            webViewBase->priv->acceleratedBackingStore->paint(cr, clipRect);
     780        } else {
     781            WebCore::Region unpaintedRegion; // This is simply unused.
     782            drawingArea->paint(cr, clipRect, unpaintedRegion);
     783        }
     784
     785        if (showingNavigationSnapshot) {
     786            RefPtr<cairo_pattern_t> group = adoptRef(cairo_pop_group(cr));
     787            if (auto* controller = webkitWebViewBaseViewGestureController(webViewBase))
     788                controller->draw(cr, group.get());
     789        }
    785790    }
    786791
     
    27782783        delta, wheelTicks, toWebKitWheelEventPhase(phase), toWebKitWheelEventPhase(momentumPhase)));
    27792784}
     2785
     2786void webkitWebViewBaseMakeBlank(WebKitWebViewBase* webViewBase, bool makeBlank)
     2787{
     2788    WebKitWebViewBasePrivate* priv = webViewBase->priv;
     2789    if (priv->isBlank == makeBlank)
     2790        return;
     2791
     2792    priv->isBlank = makeBlank;
     2793    gtk_widget_queue_draw(GTK_WIDGET(webViewBase));
     2794}
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

    r274815 r276490  
    121121WebKitInputMethodContext* webkitWebViewBaseGetInputMethodContext(WebKitWebViewBase*);
    122122void webkitWebViewBaseSynthesizeCompositionKeyPress(WebKitWebViewBase*, const String& text, Optional<Vector<WebCore::CompositionUnderline>>&&, Optional<WebKit::EditingRange>&&);
     123
     124void webkitWebViewBaseMakeBlank(WebKitWebViewBase*, bool);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r276306 r276490  
    24692469#endif
    24702470
     2471void WebPageProxy::didUpdateRenderingAfterCommittingLoad()
     2472{
     2473    if (m_hasUpdatedRenderingAfterDidCommitLoad)
     2474        return;
     2475
     2476    m_hasUpdatedRenderingAfterDidCommitLoad = true;
     2477    stopMakingViewBlankDueToLackOfRenderingUpdate();
     2478}
     2479
    24712480void WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate()
    24722481{
    2473 #if PLATFORM(COCOA)
    24742482    ASSERT(m_hasUpdatedRenderingAfterDidCommitLoad);
    24752483    RELEASE_LOG_IF_ALLOWED(Process, "stopMakingViewBlankDueToLackOfRenderingUpdate:");
    24762484    pageClient().makeViewBlank(false);
    2477 #endif
    24782485}
    24792486
     
    24832490void WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit()
    24842491{
     2492    if (!m_hasUpdatedRenderingAfterDidCommitLoad) {
    24852493#if PLATFORM(COCOA)
    2486     if (!m_hasUpdatedRenderingAfterDidCommitLoad) {
    24872494        static bool shouldMakeViewBlank = linkedOnOrAfter(WebCore::SDKVersion::FirstWithBlankViewOnJSPrompt);
     2495#else
     2496        static bool shouldMakeViewBlank = true;
     2497#endif
    24882498        if (shouldMakeViewBlank) {
    24892499            RELEASE_LOG_IF_ALLOWED(Process, "makeViewBlankIfUnpaintedSinceLastLoadCommit: Making the view blank because of a JS prompt before the first paint for its page");
     
    24912501        }
    24922502    }
    2493 #endif
    24942503}
    24952504
     
    46944703    m_process->didCommitProvisionalLoad();
    46954704
    4696 #if PLATFORM(COCOA)
    46974705    if (frame->isMainFrame()) {
    46984706        m_hasUpdatedRenderingAfterDidCommitLoad = false;
     
    47014709#endif
    47024710    }
    4703 #endif
    47044711
    47054712    auto transaction = m_pageLoadState.transaction();
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r276347 r276490  
    22372237
    22382238    void didReceiveEvent(uint32_t opaqueType, bool handled);
     2239    void didUpdateRenderingAfterCommittingLoad();
    22392240#if PLATFORM(MAC)
    2240     void didUpdateRenderingAfterCommittingLoad();
    22412241    void fontAtSelectionCallback(const FontInfo&, double, bool, CallbackID);
    22422242#endif
     
    26722672    bool m_isPerformingDOMPrintOperation { false };
    26732673
    2674 #if PLATFORM(COCOA)
    26752674    bool m_hasUpdatedRenderingAfterDidCommitLoad { true };
    2676 #endif
    26772675
    26782676    WebCore::ResourceRequest m_decidePolicyForResponseRequest;
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r276181 r276490  
    376376
    377377    SetEditableElementIsFocused(bool editableElementIsFocused)
     378#endif
     379
    378380    DidUpdateRenderingAfterCommittingLoad()
    379 #endif
    380381
    381382#if USE(DICTATION_ALTERNATIVES)
  • trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r275485 r276490  
    661661}
    662662
    663 void WebPageProxy::didUpdateRenderingAfterCommittingLoad()
    664 {
    665     if (m_hasUpdatedRenderingAfterDidCommitLoad)
    666         return;
    667 
    668     m_hasUpdatedRenderingAfterDidCommitLoad = true;
    669     stopMakingViewBlankDueToLackOfRenderingUpdate();
    670 }
    671 
    672663#if ENABLE(UI_PROCESS_PDF_HUD)
    673664
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp

    r266000 r276490  
    174174    }
    175175
     176    m_page.didUpdateRendering();
     177
    176178    return true;
    177179}
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp

    r274869 r276490  
    425425        m_webPage.flushPendingEditorStateUpdate();
    426426        m_webPage.scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
     427        m_webPage.didUpdateRendering();
    427428
    428429        if (m_layerTreeHost)
     
    821822#endif
    822823
     824    m_webPage.didUpdateRendering();
     825
    823826    // Layout can trigger more calls to setNeedsDisplay and we don't want to process them
    824827    // until the UI process has painted the update, so we stop the timer here.
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r276473 r276490  
    40874087}
    40884088
     4089void WebPage::didUpdateRendering()
     4090{
     4091    if (m_didUpdateRenderingAfterCommittingLoad)
     4092        return;
     4093
     4094    m_didUpdateRenderingAfterCommittingLoad = true;
     4095    send(Messages::WebPageProxy::DidUpdateRenderingAfterCommittingLoad());
     4096}
     4097
    40894098void WebPage::finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags> flags)
    40904099{
     
    62396248    }
    62406249
    6241 #if PLATFORM(MAC)
    62426250    m_didUpdateRenderingAfterCommittingLoad = false;
    6243 #endif
     6251
    62446252#if PLATFORM(IOS_FAMILY)
    62456253    m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r276347 r276490  
    634634#endif
    635635
     636    void didUpdateRendering();
     637
    636638#if PLATFORM(MAC)
    637639    void setTopOverhangImage(WebImage*);
    638640    void setBottomOverhangImage(WebImage*);
    639641
    640     void didUpdateRendering();
    641    
    642642    void setUseSystemAppearance(bool);
    643643
     
    23012301    bool m_canUseCredentialStorage { true };
    23022302
    2303 #if PLATFORM(MAC)
    23042303    bool m_didUpdateRenderingAfterCommittingLoad { false };
    2305 #endif
    23062304
    23072305    Vector<String> m_corsDisablingPatterns;
  • trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm

    r276303 r276490  
    10261026}
    10271027
    1028 void WebPage::didUpdateRendering()
    1029 {
    1030     if (m_didUpdateRenderingAfterCommittingLoad)
    1031         return;
    1032 
    1033     m_didUpdateRenderingAfterCommittingLoad = true;
    1034     send(Messages::WebPageProxy::DidUpdateRenderingAfterCommittingLoad());
    1035 }
    1036 
    10371028#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
    10381029void WebPage::playbackTargetSelected(PlaybackTargetClientContextIdentifier contextId, WebCore::MediaPlaybackTargetContext&& targetContext) const
Note: See TracChangeset for help on using the changeset viewer.