Bug 1362462: Fallback to main document widget for frames which haven't been inserted yet. r=mconley
authorKris Maglione <maglione.k@gmail.com>
Mon, 29 May 2017 13:16:23 -0700
changeset 410228 63cc19a2300f356abf1fa03884a9ac3d4792ef57
parent 410227 72a455b224e63335c4cf6cce7588d2b9c9de7a5f
child 410229 3226b56675ffdb2af7790e13a5a4b927ceb0b063
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1362462
milestone55.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 1362462: Fallback to main document widget for frames which haven't been inserted yet. r=mconley MozReview-Commit-ID: Ayr2kQ9KqbW
dom/ipc/TabParent.cpp
layout/ipc/RenderFrameParent.cpp
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2514,16 +2514,19 @@ TabParent::TryCacheDPIAndScale()
 
 already_AddRefed<nsIWidget>
 TabParent::GetWidget() const
 {
   if (!mFrameElement) {
     return nullptr;
   }
   nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForContent(mFrameElement);
+  if (!widget) {
+    widget = nsContentUtils::WidgetForDocument(mFrameElement->OwnerDoc());
+  }
   return widget.forget();
 }
 
 void
 TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
                                        uint64_t* aOutInputBlockId,
                                        nsEventStatus* aOutApzResponse)
 {
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -212,16 +212,19 @@ RenderFrameParent::AttachLayerManager()
 {
   RefPtr<LayerManager> lm;
 
   if (mFrameLoader) {
     nsIContent* content = mFrameLoader->GetOwnerContent();
     if (content) {
       lm = nsContentUtils::LayerManagerForContent(content);
     }
+    if (!lm) {
+      lm = GetFrom(mFrameLoader);
+    }
   }
 
   // Perhaps the document containing this frame currently has no presentation?
   if (lm && lm->GetCompositorBridgeChild() && lm != mLayerManager) {
     mLayersConnected = lm->GetCompositorBridgeChild()->SendAdoptChild(mLayersId);
     FrameLayerBuilder::InvalidateAllLayers(lm);
   }