Bug 1547351 - Use offset relative to reference frame for nsDisplayRenderRoot r=mattwoodrow
authorDoug Thayer <dothayer@mozilla.com>
Tue, 14 May 2019 22:43:40 +0000
changeset 532964 cb6320b272f90d23a044a22d6ee738f7e6bf9d24
parent 532963 888907b9ffc32bbe63f0966a77c4fc8cfa2e7d52
child 532965 ca120c3031d2db4c2d9bff03a1334ee25e8c8502
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1547351
milestone68.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 1547351 - Use offset relative to reference frame for nsDisplayRenderRoot r=mattwoodrow Please advise if there is a better alternative. After ensuring that extension popups are wired up to create an nsDisplayRenderRoot, the bottom bit of the popup's content is cut off. This fixes that issue, but I'm not certain if it is the most robust option. Differential Revision: https://phabricator.services.mozilla.com/D31007
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -6594,33 +6594,29 @@ void nsDisplayOwnLayer::WriteDebugInfo(s
 nsDisplayRenderRoot::nsDisplayRenderRoot(
     nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
     const ActiveScrolledRoot* aActiveScrolledRoot, wr::RenderRoot aRenderRoot)
     : nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, true),
       mRenderRoot(aRenderRoot),
       mBuiltWRCommands(false) {
   MOZ_ASSERT(aRenderRoot != wr::RenderRoot::Default);
   MOZ_ASSERT(gfxPrefs::WebRenderSplitRenderRoots());
-  mozilla::LayoutDeviceRect rect = mozilla::LayoutDeviceRect::FromAppUnits(
-      mFrame->GetRect(), mFrame->PresContext()->AppUnitsPerDevPixel());
-  aBuilder->ExpandRenderRootRect(rect, mRenderRoot);
+  ExpandDisplayListBuilderRenderRootRect(aBuilder);
   MOZ_COUNT_CTOR(nsDisplayRenderRoot);
 }
 
 void nsDisplayRenderRoot::Destroy(nsDisplayListBuilder* aBuilder) {
   if (mBuiltWRCommands && aBuilder) {
     aBuilder->SetNeedsDisplayListBuild(mRenderRoot);
   }
   nsDisplayWrapList::Destroy(aBuilder);
 }
 
 void nsDisplayRenderRoot::NotifyUsed(nsDisplayListBuilder* aBuilder) {
-  mozilla::LayoutDeviceRect rect = mozilla::LayoutDeviceRect::FromAppUnits(
-      mFrame->GetRect(), mFrame->PresContext()->AppUnitsPerDevPixel());
-  aBuilder->ExpandRenderRootRect(rect, mRenderRoot);
+  ExpandDisplayListBuilderRenderRootRect(aBuilder);
   nsDisplayWrapList::SetReused(aBuilder);
 }
 
 void nsDisplayRenderRoot::InvalidateCachedChildInfo(
     nsDisplayListBuilder* aBuilder) {
   if (mBuiltWRCommands && aBuilder) {
     aBuilder->SetNeedsDisplayListBuild(mRenderRoot);
     mBuiltWRCommands = false;
@@ -6691,16 +6687,24 @@ bool nsDisplayRenderRoot::CreateWebRende
       nsDisplayWrapList::CreateWebRenderCommands(builder, resources, sc,
                                                  aManager, aDisplayListBuilder);
     }
     mBuiltWRCommands = true;
   }
   return true;
 }
 
+void nsDisplayRenderRoot::ExpandDisplayListBuilderRenderRootRect(
+    nsDisplayListBuilder* aBuilder) {
+  mozilla::LayoutDeviceRect rect = mozilla::LayoutDeviceRect::FromAppUnits(
+      mFrame->GetRectRelativeToSelf() + ToReferenceFrame(),
+      mFrame->PresContext()->AppUnitsPerDevPixel());
+  aBuilder->ExpandRenderRootRect(rect, mRenderRoot);
+}
+
 nsDisplaySubDocument::nsDisplaySubDocument(nsDisplayListBuilder* aBuilder,
                                            nsIFrame* aFrame,
                                            nsSubDocumentFrame* aSubDocFrame,
                                            nsDisplayList* aList,
                                            nsDisplayOwnLayerFlags aFlags)
     : nsDisplayOwnLayer(aBuilder, aFrame, aList,
                         aBuilder->CurrentActiveScrolledRoot(), aFlags),
       mScrollParentId(aBuilder->GetCurrentScrollParentId()),
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -6000,16 +6000,18 @@ class nsDisplayRenderRoot : public nsDis
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       mozilla::layers::RenderRootStateManager* aManager,
       nsDisplayListBuilder* aDisplayListBuilder) override;
 
  protected:
+  void ExpandDisplayListBuilderRenderRootRect(nsDisplayListBuilder* aBuilder);
+
   mozilla::wr::RenderRoot mRenderRoot;
   bool mBuiltWRCommands;
   mozilla::Maybe<mozilla::layers::RenderRootBoundary> mBoundary;
 };
 
 /**
  * A display item for subdocuments. This is more or less the same as
  * nsDisplayOwnLayer, except that it always populates the FrameMetrics instance