Diff
Modified: trunk/Source/WebKit/ChangeLog (276489 => 276490)
--- trunk/Source/WebKit/ChangeLog 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/ChangeLog 2021-04-23 07:16:49 UTC (rev 276490)
@@ -1,3 +1,42 @@
+2021-04-23 Carlos Garcia Campos <[email protected]>
+
+ [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.
+
2021-04-22 Jer Noble <[email protected]>
[Mac] CMBaseClass object pointers can become unaligned on x86
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -80,18 +80,21 @@
webkitWebViewClosePage(m_webView);
}
- void runJavaScriptAlert(WebPageProxy&, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void()>&& completionHandler) final
+ void runJavaScriptAlert(WebPageProxy& page, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void()>&& completionHandler) final
{
+ page.makeViewBlankIfUnpaintedSinceLastLoadCommit();
webkitWebViewRunJavaScriptAlert(m_webView, message.utf8(), WTFMove(completionHandler));
}
- void runJavaScriptConfirm(WebPageProxy&, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(bool)>&& completionHandler) final
+ void runJavaScriptConfirm(WebPageProxy& page, const String& message, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(bool)>&& completionHandler) final
{
+ page.makeViewBlankIfUnpaintedSinceLastLoadCommit();
webkitWebViewRunJavaScriptConfirm(m_webView, message.utf8(), WTFMove(completionHandler));
}
- void runJavaScriptPrompt(WebPageProxy&, const String& message, const String& defaultValue, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(const String&)>&& completionHandler) final
+ void runJavaScriptPrompt(WebPageProxy& page, const String& message, const String& defaultValue, WebFrameProxy*, WebKit::FrameInfoData&&, Function<void(const String&)>&& completionHandler) final
{
+ page.makeViewBlankIfUnpaintedSinceLastLoadCommit();
webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8(), WTFMove(completionHandler));
}
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -641,4 +641,9 @@
return name;
}
+void PageClientImpl::makeViewBlank(bool makeBlank)
+{
+ webkitWebViewBaseMakeBlank(WEBKIT_WEB_VIEW_BASE(m_viewWidget), makeBlank);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2021-04-23 07:16:49 UTC (rev 276490)
@@ -177,6 +177,8 @@
String themeName() const override;
+ void makeViewBlank(bool) override;
+
// Members of PageClientImpl class
GtkWidget* m_viewWidget;
DefaultUndoController m_undoController;
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -283,6 +283,7 @@
TouchEventsMap touchEvents;
IntSize contentsSize;
Optional<MotionEvent> lastMotionEvent;
+ bool isBlank;
GtkWindow* toplevelOnScreenWindow { nullptr };
#if USE(GTK4)
@@ -745,8 +746,10 @@
if (!drawingArea)
return;
- ASSERT(drawingArea->isInAcceleratedCompositingMode());
- webViewBase->priv->acceleratedBackingStore->snapshot(snapshot);
+ if (!webViewBase->priv->isBlank) {
+ ASSERT(drawingArea->isInAcceleratedCompositingMode());
+ webViewBase->priv->acceleratedBackingStore->snapshot(snapshot);
+ }
if (webViewBase->priv->inspectorView)
gtk_widget_snapshot_child(widget, webViewBase->priv->inspectorView, snapshot);
@@ -766,22 +769,24 @@
if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
return FALSE;
- bool showingNavigationSnapshot = webViewBase->priv->pageProxy->isShowingNavigationGestureSnapshot();
- if (showingNavigationSnapshot)
- cairo_push_group(cr);
+ if (!webViewBase->priv->isBlank) {
+ bool showingNavigationSnapshot = webViewBase->priv->pageProxy->isShowingNavigationGestureSnapshot();
+ if (showingNavigationSnapshot)
+ cairo_push_group(cr);
- if (drawingArea->isInAcceleratedCompositingMode()) {
- ASSERT(webViewBase->priv->acceleratedBackingStore);
- webViewBase->priv->acceleratedBackingStore->paint(cr, clipRect);
- } else {
- WebCore::Region unpaintedRegion; // This is simply unused.
- drawingArea->paint(cr, clipRect, unpaintedRegion);
- }
+ if (drawingArea->isInAcceleratedCompositingMode()) {
+ ASSERT(webViewBase->priv->acceleratedBackingStore);
+ webViewBase->priv->acceleratedBackingStore->paint(cr, clipRect);
+ } else {
+ WebCore::Region unpaintedRegion; // This is simply unused.
+ drawingArea->paint(cr, clipRect, unpaintedRegion);
+ }
- if (showingNavigationSnapshot) {
- RefPtr<cairo_pattern_t> group = adoptRef(cairo_pop_group(cr));
- if (auto* controller = webkitWebViewBaseViewGestureController(webViewBase))
- controller->draw(cr, group.get());
+ if (showingNavigationSnapshot) {
+ RefPtr<cairo_pattern_t> group = adoptRef(cairo_pop_group(cr));
+ if (auto* controller = webkitWebViewBaseViewGestureController(webViewBase))
+ controller->draw(cr, group.get());
+ }
}
GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->draw(widget, cr);
@@ -2777,3 +2782,13 @@
priv->pageProxy->handleWheelEvent(NativeWebWheelEvent({ x, y }, widgetRootCoords(GTK_WIDGET(webViewBase), x, y),
delta, wheelTicks, toWebKitWheelEventPhase(phase), toWebKitWheelEventPhase(momentumPhase)));
}
+
+void webkitWebViewBaseMakeBlank(WebKitWebViewBase* webViewBase, bool makeBlank)
+{
+ WebKitWebViewBasePrivate* priv = webViewBase->priv;
+ if (priv->isBlank == makeBlank)
+ return;
+
+ priv->isBlank = makeBlank;
+ gtk_widget_queue_draw(GTK_WIDGET(webViewBase));
+}
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2021-04-23 07:16:49 UTC (rev 276490)
@@ -120,3 +120,5 @@
void webkitWebViewBaseSetInputMethodContext(WebKitWebViewBase*, WebKitInputMethodContext*);
WebKitInputMethodContext* webkitWebViewBaseGetInputMethodContext(WebKitWebViewBase*);
void webkitWebViewBaseSynthesizeCompositionKeyPress(WebKitWebViewBase*, const String& text, Optional<Vector<WebCore::CompositionUnderline>>&&, Optional<WebKit::EditingRange>&&);
+
+void webkitWebViewBaseMakeBlank(WebKitWebViewBase*, bool);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -2468,13 +2468,20 @@
}
#endif
+void WebPageProxy::didUpdateRenderingAfterCommittingLoad()
+{
+ if (m_hasUpdatedRenderingAfterDidCommitLoad)
+ return;
+
+ m_hasUpdatedRenderingAfterDidCommitLoad = true;
+ stopMakingViewBlankDueToLackOfRenderingUpdate();
+}
+
void WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate()
{
-#if PLATFORM(COCOA)
ASSERT(m_hasUpdatedRenderingAfterDidCommitLoad);
RELEASE_LOG_IF_ALLOWED(Process, "stopMakingViewBlankDueToLackOfRenderingUpdate:");
pageClient().makeViewBlank(false);
-#endif
}
// If we have not painted yet since the last load commit, then we are likely still displaying the previous page.
@@ -2482,15 +2489,17 @@
// until the next paint in such case.
void WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit()
{
+ if (!m_hasUpdatedRenderingAfterDidCommitLoad) {
#if PLATFORM(COCOA)
- if (!m_hasUpdatedRenderingAfterDidCommitLoad) {
static bool shouldMakeViewBlank = linkedOnOrAfter(WebCore::SDKVersion::FirstWithBlankViewOnJSPrompt);
+#else
+ static bool shouldMakeViewBlank = true;
+#endif
if (shouldMakeViewBlank) {
RELEASE_LOG_IF_ALLOWED(Process, "makeViewBlankIfUnpaintedSinceLastLoadCommit: Making the view blank because of a JS prompt before the first paint for its page");
pageClient().makeViewBlank(true);
}
}
-#endif
}
void WebPageProxy::discardQueuedMouseEvents()
@@ -4693,7 +4702,6 @@
m_hasCommittedAnyProvisionalLoads = true;
m_process->didCommitProvisionalLoad();
-#if PLATFORM(COCOA)
if (frame->isMainFrame()) {
m_hasUpdatedRenderingAfterDidCommitLoad = false;
#if PLATFORM(IOS_FAMILY)
@@ -4700,7 +4708,6 @@
m_firstLayerTreeTransactionIdAfterDidCommitLoad = downcast<RemoteLayerTreeDrawingAreaProxy>(*drawingArea()).nextLayerTreeTransactionID();
#endif
}
-#endif
auto transaction = m_pageLoadState.transaction();
Ref<WebCertificateInfo> webCertificateInfo = WebCertificateInfo::create(certificateInfo);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-04-23 07:16:49 UTC (rev 276490)
@@ -2236,8 +2236,8 @@
void discardQueuedMouseEvents();
void didReceiveEvent(uint32_t opaqueType, bool handled);
+ void didUpdateRenderingAfterCommittingLoad();
#if PLATFORM(MAC)
- void didUpdateRenderingAfterCommittingLoad();
void fontAtSelectionCallback(const FontInfo&, double, bool, CallbackID);
#endif
#if PLATFORM(IOS_FAMILY)
@@ -2671,9 +2671,7 @@
bool m_isInPrintingMode { false };
bool m_isPerformingDOMPrintOperation { false };
-#if PLATFORM(COCOA)
bool m_hasUpdatedRenderingAfterDidCommitLoad { true };
-#endif
WebCore::ResourceRequest m_decidePolicyForResponseRequest;
bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-04-23 07:16:49 UTC (rev 276490)
@@ -375,9 +375,10 @@
RecordAutocorrectionResponse(int32_t response, String replacedString, String replacementString);
SetEditableElementIsFocused(bool editableElementIsFocused)
- DidUpdateRenderingAfterCommittingLoad()
#endif
+ DidUpdateRenderingAfterCommittingLoad()
+
#if USE(DICTATION_ALTERNATIVES)
ShowDictationAlternativeUI(WebCore::FloatRect boundingBoxOfDictatedText, WebCore::DictationContext dictationContext)
RemoveDictationAlternatives(WebCore::DictationContext dictationContext)
Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (276489 => 276490)
--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2021-04-23 07:16:49 UTC (rev 276490)
@@ -660,15 +660,6 @@
return m_preferences->store().getBoolValueForKey(WebPreferencesKey::useiTunesAVOutputContextKey());
}
-void WebPageProxy::didUpdateRenderingAfterCommittingLoad()
-{
- if (m_hasUpdatedRenderingAfterDidCommitLoad)
- return;
-
- m_hasUpdatedRenderingAfterDidCommitLoad = true;
- stopMakingViewBlankDueToLackOfRenderingUpdate();
-}
-
#if ENABLE(UI_PROCESS_PDF_HUD)
void WebPageProxy::createPDFHUD(PDFPluginIdentifier identifier, const WebCore::IntRect& rect)
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (276489 => 276490)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -173,6 +173,8 @@
m_shouldSyncFrame = false;
}
+ m_page.didUpdateRendering();
+
return true;
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (276489 => 276490)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -424,6 +424,7 @@
m_webPage.finalizeRenderingUpdate({ });
m_webPage.flushPendingEditorStateUpdate();
m_webPage.scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
+ m_webPage.didUpdateRendering();
if (m_layerTreeHost)
m_layerTreeHost->sizeDidChange(m_webPage.size());
@@ -820,6 +821,8 @@
bitmap->leakSharedResource(); // It will be destroyed in the UIProcess.
#endif
+ m_webPage.didUpdateRendering();
+
// Layout can trigger more calls to setNeedsDisplay and we don't want to process them
// until the UI process has painted the update, so we stop the timer here.
m_displayTimer.stop();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (276489 => 276490)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-04-23 07:16:49 UTC (rev 276490)
@@ -4086,6 +4086,15 @@
m_page->updateRendering();
}
+void WebPage::didUpdateRendering()
+{
+ if (m_didUpdateRenderingAfterCommittingLoad)
+ return;
+
+ m_didUpdateRenderingAfterCommittingLoad = true;
+ send(Messages::WebPageProxy::DidUpdateRenderingAfterCommittingLoad());
+}
+
void WebPage::finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags> flags)
{
m_page->finalizeRenderingUpdate(flags);
@@ -6238,9 +6247,8 @@
scalePage(1, IntPoint());
}
-#if PLATFORM(MAC)
m_didUpdateRenderingAfterCommittingLoad = false;
-#endif
+
#if PLATFORM(IOS_FAMILY)
m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
m_hasRestoredExposedContentRectAfterDidCommitLoad = false;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (276489 => 276490)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-04-23 07:16:49 UTC (rev 276490)
@@ -633,12 +633,12 @@
void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
#endif
+ void didUpdateRendering();
+
#if PLATFORM(MAC)
void setTopOverhangImage(WebImage*);
void setBottomOverhangImage(WebImage*);
- void didUpdateRendering();
-
void setUseSystemAppearance(bool);
void didEndMagnificationGesture();
@@ -2300,9 +2300,7 @@
bool m_canUseCredentialStorage { true };
-#if PLATFORM(MAC)
bool m_didUpdateRenderingAfterCommittingLoad { false };
-#endif
Vector<String> m_corsDisablingPatterns;
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (276489 => 276490)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2021-04-23 05:42:30 UTC (rev 276489)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2021-04-23 07:16:49 UTC (rev 276490)
@@ -1025,15 +1025,6 @@
{
}
-void WebPage::didUpdateRendering()
-{
- if (m_didUpdateRenderingAfterCommittingLoad)
- return;
-
- m_didUpdateRenderingAfterCommittingLoad = true;
- send(Messages::WebPageProxy::DidUpdateRenderingAfterCommittingLoad());
-}
-
#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
void WebPage::playbackTargetSelected(PlaybackTargetClientContextIdentifier contextId, WebCore::MediaPlaybackTargetContext&& targetContext) const
{