Bug 1742358 - Use non-blank paint rather than contentful paint to fix test_drawWindow_widget_layers.html, which relies on transparent clear.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 09 Jan 2022 04:27:22 +0100
changeset 604023 c4d886e0717aeff4a1607287f2e824767a8c8a06
parent 604022 7e3cdb88790d2ddf7a3797a4374cf38f106b86d0
child 604024 280a48ed3e34060477bf9099486bc2dcb33e7dc7
push id39132
push usermlaza@mozilla.com
push dateSun, 09 Jan 2022 21:55:39 +0000
treeherdermozilla-central@32aa34742b28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1742358
milestone97.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1742358 - Use non-blank paint rather than contentful paint to fix test_drawWindow_widget_layers.html, which relies on transparent clear. MANUAL PUSH: Orange fix CLOSED TREE
layout/base/nsPresContext.cpp
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/nsIWidget.h
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2585,37 +2585,37 @@ void nsPresContext::NotifyNonBlankPaint(
   if (IsRootContentDocumentCrossProcess()) {
     RefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
     if (timing && !IsPrintingOrPrintPreview()) {
       timing->NotifyNonBlankPaintForRootContentDocument();
     }
 
     mFirstNonBlankPaintTime = TimeStamp::Now();
   }
+  if (IsChrome() && IsRoot()) {
+    if (nsCOMPtr<nsIWidget> rootWidget = GetRootWidget()) {
+      rootWidget->DidGetNonBlankPaint();
+    }
+  }
 }
 
 void nsPresContext::NotifyContentfulPaint() {
   if (mHadContentfulPaint) {
     return;
   }
   nsRootPresContext* rootPresContext = GetRootPresContext();
   if (!rootPresContext) {
     return;
   }
   if (!mHadNonTickContentfulPaint) {
 #ifdef MOZ_WIDGET_ANDROID
     (new AsyncEventDispatcher(mDocument, u"MozFirstContentfulPaint"_ns,
                               CanBubble::eYes, ChromeOnlyDispatch::eYes))
         ->PostDOMEvent();
 #endif
-    if (rootPresContext == this && IsChrome()) {
-      if (nsCOMPtr<nsIWidget> rootWidget = GetRootWidget()) {
-        rootWidget->DidGetContentfulPaint();
-      }
-    }
   }
   if (!rootPresContext->RefreshDriver()->IsInRefresh()) {
     if (!mHadNonTickContentfulPaint) {
       rootPresContext->RefreshDriver()
           ->AddForceNotifyContentfulPaintPresContext(this);
       mHadNonTickContentfulPaint = true;
     }
     return;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -411,17 +411,17 @@ nsWindow::nsWindow()
       mPopupMatchesLayout(false),
       mPopupChanged(false),
       mPopupTemporaryHidden(false),
       mPopupClosed(false),
       mPopupUseMoveToRect(false),
       mPreferredPopupRectFlushed(false),
       mWaitingForMoveToRectCallback(false),
       mConfiguredClearColor(false),
-      mGotContentfulPaint(false) {
+      mGotNonBlankPaint(false) {
   mWindowType = eWindowType_child;
   mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
 
   if (!gGlobalsInitialized) {
     gGlobalsInitialized = true;
 
     // It's OK if either of these fail, but it may not be one day.
     initialize_prefs();
@@ -8371,21 +8371,21 @@ nsIWidget::WindowRenderer* nsWindow::Get
     // LayerManager/Compositor during shutdown. Just return what we currently
     // have, which is most likely null.
     return mWindowRenderer;
   }
 
   return nsBaseWidget::GetWindowRenderer();
 }
 
-void nsWindow::DidGetContentfulPaint() {
-  if (mGotContentfulPaint) {
-    return;
-  }
-  mGotContentfulPaint = true;
+void nsWindow::DidGetNonBlankPaint() {
+  if (mGotNonBlankPaint) {
+    return;
+  }
+  mGotNonBlankPaint = true;
   if (!mConfiguredClearColor) {
     // Nothing to do, we hadn't overridden the clear color.
     mConfiguredClearColor = true;
     return;
   }
   // Reset the clear color set in the expose event to transparent.
   GetWindowRenderer()->AsWebRender()->WrBridge()->SendSetDefaultClearColor(
       NS_TRANSPARENT);
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -687,19 +687,19 @@ class nsWindow final : public nsBaseWidg
    *
    * If another position/resize request comes between move-to-rect call and
    * move-to-rect callback we set mNewBoundsAfterMoveToRect.
    */
   bool mWaitingForMoveToRectCallback : 1;
 
   // Whether we've configured default clear color already.
   bool mConfiguredClearColor : 1;
-  // Whether we've received a contentful paint in which case we can reset the
+  // Whether we've received a non-blank paint in which case we can reset the
   // clear color to transparent.
-  bool mGotContentfulPaint : 1;
+  bool mGotNonBlankPaint : 1;
 
   // This bitmap tracks which pixels are transparent. We don't support
   // full translucency at this time; each pixel is either fully opaque
   // or fully transparent.
   gchar* mTransparencyBitmap = nullptr;
   int32_t mTransparencyBitmapWidth = 0;
   int32_t mTransparencyBitmapHeight = 0;
 
@@ -719,17 +719,17 @@ class nsWindow final : public nsBaseWidg
   // When window widget gets mapped/unmapped we need to configure
   // underlying GdkWindow properly. Otherwise we'll end up with
   // rendering to released window.
   void ConfigureGdkWindow();
   void ReleaseGdkWindow();
 
   // nsBaseWidget
   WindowRenderer* GetWindowRenderer() override;
-  void DidGetContentfulPaint() override;
+  void DidGetNonBlankPaint() override;
 
   void SetCompositorWidgetDelegate(CompositorWidgetDelegate* delegate) override;
 
   void CleanLayerManagerRecursive();
 
   int32_t RoundsWidgetCoordinatesTo() override;
 
   void UpdateMozWindowActive();
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -529,19 +529,19 @@ class nsIWidget : public nsISupports {
    */
   virtual void SetAttachedWidgetListener(nsIWidgetListener* aListener) = 0;
   virtual nsIWidgetListener* GetAttachedWidgetListener() const = 0;
   virtual void SetPreviouslyAttachedWidgetListener(
       nsIWidgetListener* aListener) = 0;
   virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() = 0;
 
   /**
-   * Notifies the root widget of a contentful paint.
+   * Notifies the root widget of a non-blank paint.
    */
-  virtual void DidGetContentfulPaint() {}
+  virtual void DidGetNonBlankPaint() {}
 
   /**
    * Accessor functions to get and set the listener which handles various
    * actions for the widget.
    */
   //@{
   virtual nsIWidgetListener* GetWidgetListener() const = 0;
   virtual void SetWidgetListener(nsIWidgetListener* alistener) = 0;