Bug 1418361 - push GTK window background color rect for WR. r=nical
authorLee Salzman <lsalzman@mozilla.com>
Mon, 22 Jan 2018 08:01:09 -0500
changeset 400232 bd692ac007bd27b9c08ca138f3f615886ac92c88
parent 400231 49ff2faf3b6b8cc714b89748e7dc4fa8d191c350
child 400233 c421439e0b7012faf1c9ec0b55e5de7b7f6b2673
push id33299
push userrgurzau@mozilla.com
push dateTue, 23 Jan 2018 00:22:17 +0000
treeherdermozilla-central@c4ebc8c28a33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1418361
milestone59.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 1418361 - push GTK window background color rect for WR. r=nical MozReview-Commit-ID: DUiFHtFGwQF
widget/gtk/nsNativeThemeGTK.cpp
widget/gtk/nsNativeThemeGTK.h
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -1165,16 +1165,43 @@ nsNativeThemeGTK::DrawWidgetBackground(g
     if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) {
       NS_WARNING("unable to animate widget!");
     }
   }
 
   return NS_OK;
 }
 
+bool
+nsNativeThemeGTK::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBuilder& aBuilder,
+                                                   mozilla::wr::IpcResourceUpdateQueue& aResources,
+                                                   const mozilla::layers::StackingContextHelper& aSc,
+                                                   mozilla::layers::WebRenderLayerManager* aManager,
+                                                   nsIFrame* aFrame,
+                                                   uint8_t aWidgetType,
+                                                   const nsRect& aRect)
+{
+  nsPresContext* presContext = aFrame->PresContext();
+  wr::LayoutRect bounds = aSc.ToRelativeLayoutRect(
+    LayoutDeviceRect::FromAppUnits(aRect, presContext->AppUnitsPerDevPixel()));
+
+  switch (aWidgetType) {
+  case NS_THEME_WINDOW:
+  case NS_THEME_DIALOG:
+    aBuilder.PushRect(bounds, bounds, true,
+                      wr::ToColorF(Color::FromABGR(
+                        LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground,
+                                              NS_RGBA(0, 0, 0, 0)))));
+    return true;
+
+  default:
+    return false;
+  }
+}
+
 WidgetNodeType
 nsNativeThemeGTK::NativeThemeToGtkTheme(uint8_t aWidgetType, nsIFrame* aFrame)
 {
   WidgetNodeType gtkWidgetType;
   gint unusedFlags;
 
   if (!GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, nullptr,
                             &unusedFlags))
--- a/widget/gtk/nsNativeThemeGTK.h
+++ b/widget/gtk/nsNativeThemeGTK.h
@@ -25,16 +25,24 @@ public:
   NS_DECL_NSIOBSERVER
 
   // The nsITheme interface.
   NS_IMETHOD DrawWidgetBackground(gfxContext* aContext,
                                   nsIFrame* aFrame, uint8_t aWidgetType,
                                   const nsRect& aRect,
                                   const nsRect& aDirtyRect) override;
 
+  bool CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBuilder& aBuilder,
+                                        mozilla::wr::IpcResourceUpdateQueue& aResources,
+                                        const mozilla::layers::StackingContextHelper& aSc,
+                                        mozilla::layers::WebRenderLayerManager* aManager,
+                                        nsIFrame* aFrame,
+                                        uint8_t aWidgetType,
+                                        const nsRect& aRect) override;
+
   NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
                              uint8_t aWidgetType,
                              nsIntMargin* aResult) override;
 
   virtual bool GetWidgetPadding(nsDeviceContext* aContext,
                                 nsIFrame* aFrame,
                                 uint8_t aWidgetType,
                                 nsIntMargin* aResult) override;