зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1500257 part 8 - Remove dependency on RenderFrame from nsDisplayRemote. r=aosmond
This commit removes the dependency on RenderFrame from nsDisplayRemote so that it can work in child processes with remote subframes. Instead nsDisplayRemote now works with an nsFrameLoader, which will return the LayerId from either the RenderFrame (for top-level remote browsers), or from RemoteFrameChild (for remote subframes). Differential Revision: https://phabricator.services.mozilla.com/D17448 --HG-- extra : rebase_source : c16611bf63b8fcb2e5de6a9cb8f54155f992fc32 extra : histedit_source : 6323f7756c5d3ebfbbe55148cb81503c512b9afb
This commit is contained in:
Родитель
fc71962023
Коммит
1834509eeb
|
@ -2623,11 +2623,12 @@ mozilla::dom::PBrowserParent* nsFrameLoader::GetRemoteBrowser() const {
|
|||
return mRemoteBrowser;
|
||||
}
|
||||
|
||||
RenderFrame* nsFrameLoader::GetCurrentRenderFrame() const {
|
||||
mozilla::layers::LayersId nsFrameLoader::GetLayersId() const {
|
||||
MOZ_ASSERT(mRemoteFrame);
|
||||
if (mRemoteBrowser) {
|
||||
return mRemoteBrowser->GetRenderFrame();
|
||||
return mRemoteBrowser->GetRenderFrame()->GetLayersId();
|
||||
}
|
||||
return nullptr;
|
||||
return mRemoteFrameChild->GetLayersId();
|
||||
}
|
||||
|
||||
void nsFrameLoader::ActivateRemoteFrame(ErrorResult& aRv) {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ParentSHistory.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "Units.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -286,20 +287,11 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
|||
PBrowserParent* GetRemoteBrowser() const;
|
||||
|
||||
/**
|
||||
* The "current" render frame is the one on which the most recent
|
||||
* remote layer-tree transaction was executed. If no content has
|
||||
* been drawn yet, or the remote browser doesn't have any drawn
|
||||
* content for whatever reason, return nullptr. The returned render
|
||||
* frame has an associated shadow layer tree.
|
||||
* Returns the layers ID that this remote frame is using to render.
|
||||
*
|
||||
* Note that the returned render frame might not be a frame
|
||||
* constructed for this->GetURL(). This can happen, e.g., if the
|
||||
* <browser> was just navigated to a new URL, but hasn't painted the
|
||||
* new page yet. A render frame for the previous page may be
|
||||
* returned. (In-process <browser> behaves similarly, and this
|
||||
* behavior seems desirable.)
|
||||
* This must only be called if this is a remote frame.
|
||||
*/
|
||||
RenderFrame* GetCurrentRenderFrame() const;
|
||||
mozilla::layers::LayersId GetLayersId() const;
|
||||
|
||||
mozilla::dom::ChromeMessageSender* GetFrameMessageManager() {
|
||||
return mMessageManager;
|
||||
|
|
|
@ -301,10 +301,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
if (!IsVisibleForPainting()) return;
|
||||
|
||||
nsFrameLoader* frameLoader = FrameLoader();
|
||||
RenderFrame* rf = nullptr;
|
||||
if (frameLoader) {
|
||||
rf = frameLoader->GetCurrentRenderFrame();
|
||||
}
|
||||
bool isRemoteFrame = frameLoader && frameLoader->IsRemoteFrame();
|
||||
|
||||
// If we are pointer-events:none then we don't need to HitTest background
|
||||
bool pointerEventsNone =
|
||||
|
@ -312,7 +309,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
if (!aBuilder->IsForEventDelivery() || !pointerEventsNone) {
|
||||
nsDisplayListCollection decorations(aBuilder);
|
||||
DisplayBorderBackgroundOutline(aBuilder, decorations);
|
||||
if (rf) {
|
||||
if (isRemoteFrame) {
|
||||
// Wrap background colors of <iframe>s with remote subdocuments in their
|
||||
// own layer so we generate a ColorLayer. This is helpful for optimizing
|
||||
// compositing; we can skip compositing the ColorLayer when the
|
||||
|
@ -335,7 +332,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
return;
|
||||
}
|
||||
|
||||
if (rf) {
|
||||
if (isRemoteFrame) {
|
||||
// We're the subdoc for <browser remote="true"> and it has
|
||||
// painted content. Display its shadow layer tree.
|
||||
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
|
||||
|
@ -998,10 +995,6 @@ nsFrameLoader* nsSubDocumentFrame::FrameLoader() const {
|
|||
return mFrameLoader;
|
||||
}
|
||||
|
||||
mozilla::layout::RenderFrame* nsSubDocumentFrame::GetRenderFrame() const {
|
||||
return FrameLoader() ? FrameLoader()->GetCurrentRenderFrame() : nullptr;
|
||||
}
|
||||
|
||||
// XXX this should be called ObtainDocShell or something like that,
|
||||
// to indicate that it could have side effects
|
||||
nsIDocShell* nsSubDocumentFrame::GetDocShell() {
|
||||
|
|
|
@ -118,7 +118,7 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
|
|||
}
|
||||
}
|
||||
|
||||
mozilla::layout::RenderFrame* GetRenderFrame() const;
|
||||
nsFrameLoader* FrameLoader() const;
|
||||
|
||||
protected:
|
||||
friend class AsyncFrameInit;
|
||||
|
@ -126,8 +126,6 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
|
|||
// Helper method to look up the HTML marginwidth & marginheight attributes.
|
||||
mozilla::CSSIntSize GetMarginAttributes();
|
||||
|
||||
nsFrameLoader* FrameLoader() const;
|
||||
|
||||
bool IsInline() { return mIsInline; }
|
||||
|
||||
nscoord GetIntrinsicISize();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/RemoteFrameChild.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
#include "mozilla/layers/LayerTransactionParent.h"
|
||||
|
@ -168,10 +169,10 @@ nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
|
|||
mEventRegionsOverride |= EventRegionsOverride::ForceDispatchToContent;
|
||||
}
|
||||
|
||||
nsFrameLoader* frameLoader = GetRenderFrame()->GetFrameLoader();
|
||||
if (frameLoader) {
|
||||
TabParent* browser = TabParent::GetFrom(frameLoader);
|
||||
if (browser) {
|
||||
if (nsFrameLoader* frameLoader = GetFrameLoader()) {
|
||||
// TODO: We need to handle acquiring a TabId in the remote sub-frame case
|
||||
// for fission.
|
||||
if (TabParent* browser = TabParent::GetFrom(frameLoader)) {
|
||||
mTabId = browser->GetTabId();
|
||||
}
|
||||
}
|
||||
|
@ -188,13 +189,12 @@ mozilla::LayerState nsDisplayRemote::GetLayerState(
|
|||
|
||||
bool nsDisplayRemote::HasDeletedFrame() const {
|
||||
// RenderFrame might change without invalidating nsSubDocumentFrame.
|
||||
return !GetRenderFrame() || nsDisplayItem::HasDeletedFrame();
|
||||
return !GetFrameLoader() || nsDisplayItem::HasDeletedFrame();
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> nsDisplayRemote::BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters) {
|
||||
MOZ_ASSERT(GetRenderFrame());
|
||||
MOZ_ASSERT(mFrame, "Makes no sense to have a shadow tree without a frame");
|
||||
|
||||
if (IsTempLayerManager(aManager)) {
|
||||
|
@ -210,7 +210,7 @@ already_AddRefed<Layer> nsDisplayRemote::BuildLayer(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
LayersId remoteId = GetRenderFrame()->GetLayersId();
|
||||
LayersId remoteId = GetRemoteLayersId();
|
||||
|
||||
if (!remoteId.IsValid()) {
|
||||
return nullptr;
|
||||
|
@ -295,11 +295,12 @@ bool nsDisplayRemote::UpdateScrollData(
|
|||
}
|
||||
|
||||
LayersId nsDisplayRemote::GetRemoteLayersId() const {
|
||||
MOZ_ASSERT(GetRenderFrame());
|
||||
return GetRenderFrame()->GetLayersId();
|
||||
nsFrameLoader* frameLoader = GetFrameLoader();
|
||||
MOZ_ASSERT(frameLoader && frameLoader->IsRemoteFrame());
|
||||
return frameLoader->GetLayersId();
|
||||
}
|
||||
|
||||
mozilla::layout::RenderFrame* nsDisplayRemote::GetRenderFrame() const {
|
||||
return mFrame ? static_cast<nsSubDocumentFrame*>(mFrame)->GetRenderFrame()
|
||||
nsFrameLoader* nsDisplayRemote::GetFrameLoader() const {
|
||||
return mFrame ? static_cast<nsSubDocumentFrame*>(mFrame)->FrameLoader()
|
||||
: nullptr;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class nsDisplayRemote final : public nsDisplayItem {
|
|||
|
||||
private:
|
||||
LayersId GetRemoteLayersId() const;
|
||||
RenderFrame* GetRenderFrame() const;
|
||||
nsFrameLoader* GetFrameLoader() const;
|
||||
|
||||
TabId mTabId;
|
||||
LayoutDeviceIntPoint mOffset;
|
||||
|
|
Загрузка…
Ссылка в новой задаче