зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1525720, part 9 - Fill out implementations of BrowserHost and BrowserBridgeHost. r=nika
This commit implements the RemoteBrowser interface for BrowserHost and BrowserBridgeHost. For BrowserHost, most methods delegate to the root BrowserParent. In the future, we should move these over to BrowserHost. For BrowserBridgeHost, most methods are taken from BrowserBridgeParent. Differential Revision: https://phabricator.services.mozilla.com/D31439 --HG-- extra : rebase_source : e049abd08cbf969efee536ce6b73ac061248add3 extra : histedit_source : 3e7d0b623066ae60a2d3e197ea54b80b4c701d5e
This commit is contained in:
Родитель
f89c2fdb2e
Коммит
419e34e131
|
@ -26,38 +26,6 @@ BrowserBridgeChild::BrowserBridgeChild(nsFrameLoader* aFrameLoader,
|
||||||
|
|
||||||
BrowserBridgeChild::~BrowserBridgeChild() {}
|
BrowserBridgeChild::~BrowserBridgeChild() {}
|
||||||
|
|
||||||
void BrowserBridgeChild::UpdateDimensions(const nsIntRect& aRect,
|
|
||||||
const mozilla::ScreenIntSize& aSize) {
|
|
||||||
MOZ_DIAGNOSTIC_ASSERT(mIPCOpen);
|
|
||||||
|
|
||||||
RefPtr<Element> owner = mFrameLoader->GetOwnerContent();
|
|
||||||
nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForContent(owner);
|
|
||||||
if (!widget) {
|
|
||||||
widget = nsContentUtils::WidgetForDocument(owner->OwnerDoc());
|
|
||||||
}
|
|
||||||
MOZ_DIAGNOSTIC_ASSERT(widget);
|
|
||||||
|
|
||||||
CSSToLayoutDeviceScale widgetScale = widget->GetDefaultScale();
|
|
||||||
|
|
||||||
LayoutDeviceIntRect devicePixelRect = ViewAs<LayoutDevicePixel>(
|
|
||||||
aRect, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
|
|
||||||
LayoutDeviceIntSize devicePixelSize = ViewAs<LayoutDevicePixel>(
|
|
||||||
aSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
|
|
||||||
|
|
||||||
// XXX What are clientOffset and chromeOffset used for? Are they meaningful
|
|
||||||
// for nested iframes with transforms?
|
|
||||||
LayoutDeviceIntPoint clientOffset;
|
|
||||||
LayoutDeviceIntPoint chromeOffset;
|
|
||||||
|
|
||||||
CSSRect unscaledRect = devicePixelRect / widgetScale;
|
|
||||||
CSSSize unscaledSize = devicePixelSize / widgetScale;
|
|
||||||
hal::ScreenOrientation orientation = hal::eScreenOrientation_Default;
|
|
||||||
DimensionInfo di(unscaledRect, unscaledSize, orientation, clientOffset,
|
|
||||||
chromeOffset);
|
|
||||||
|
|
||||||
Unused << SendUpdateDimensions(di);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BrowserBridgeChild::NavigateByKey(bool aForward,
|
void BrowserBridgeChild::NavigateByKey(bool aForward,
|
||||||
bool aForDocumentNavigation) {
|
bool aForDocumentNavigation) {
|
||||||
Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
|
Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
|
||||||
|
|
|
@ -29,15 +29,13 @@ class BrowserBridgeChild : public PBrowserBridgeChild {
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::layers::LayersId GetLayersId() { return mLayersId; }
|
mozilla::layers::LayersId GetLayersId() { return mLayersId; }
|
||||||
|
nsFrameLoader* GetFrameLoader() const { return mFrameLoader; }
|
||||||
|
|
||||||
BrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
|
BrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
|
||||||
|
|
||||||
// XXX(nika): We should have a load context here. (bug 1532664)
|
// XXX(nika): We should have a load context here. (bug 1532664)
|
||||||
nsILoadContext* GetLoadContext() { return nullptr; }
|
nsILoadContext* GetLoadContext() { return nullptr; }
|
||||||
|
|
||||||
void UpdateDimensions(const nsIntRect& aRect,
|
|
||||||
const mozilla::ScreenIntSize& aSize);
|
|
||||||
|
|
||||||
void NavigateByKey(bool aForward, bool aForDocumentNavigation);
|
void NavigateByKey(bool aForward, bool aForDocumentNavigation);
|
||||||
|
|
||||||
void Activate();
|
void Activate();
|
||||||
|
|
|
@ -13,29 +13,80 @@ BrowserBridgeHost::BrowserBridgeHost(BrowserBridgeChild* aChild)
|
||||||
: mBridge(aChild) {}
|
: mBridge(aChild) {}
|
||||||
|
|
||||||
mozilla::layers::LayersId BrowserBridgeHost::GetLayersId() const {
|
mozilla::layers::LayersId BrowserBridgeHost::GetLayersId() const {
|
||||||
return LayersId{0};
|
return mBridge->GetLayersId();
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowsingContext* BrowserBridgeHost::GetBrowsingContext() const {
|
BrowsingContext* BrowserBridgeHost::GetBrowsingContext() const {
|
||||||
return nullptr;
|
return mBridge->GetBrowsingContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsILoadContext* BrowserBridgeHost::GetLoadContext() const { return nullptr; }
|
nsILoadContext* BrowserBridgeHost::GetLoadContext() const {
|
||||||
|
return mBridge->GetLoadContext();
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserBridgeHost::LoadURL(nsIURI* aURI) {}
|
void BrowserBridgeHost::LoadURL(nsIURI* aURI) {
|
||||||
|
nsAutoCString spec;
|
||||||
|
aURI->GetSpec(spec);
|
||||||
|
Unused << mBridge->SendLoadURL(spec);
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserBridgeHost::ResumeLoad(uint64_t aPendingSwitchId) {}
|
void BrowserBridgeHost::ResumeLoad(uint64_t aPendingSwitchId) {
|
||||||
|
Unused << mBridge->SendResumeLoad(aPendingSwitchId);
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserBridgeHost::DestroyStart() {}
|
void BrowserBridgeHost::DestroyStart() { DestroyComplete(); }
|
||||||
|
|
||||||
void BrowserBridgeHost::DestroyComplete() {}
|
void BrowserBridgeHost::DestroyComplete() {
|
||||||
|
if (!mBridge) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Unused << mBridge->Send__delete__(mBridge);
|
||||||
|
mBridge = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool BrowserBridgeHost::Show(const ScreenIntSize& aSize, bool aParentIsActive) {
|
bool BrowserBridgeHost::Show(const ScreenIntSize& aSize, bool aParentIsActive) {
|
||||||
|
RefPtr<Element> owner = mBridge->GetFrameLoader()->GetOwnerContent();
|
||||||
|
nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForContent(owner);
|
||||||
|
if (!widget) {
|
||||||
|
widget = nsContentUtils::WidgetForDocument(owner->OwnerDoc());
|
||||||
|
}
|
||||||
|
MOZ_DIAGNOSTIC_ASSERT(widget);
|
||||||
|
nsSizeMode sizeMode = widget ? widget->SizeMode() : nsSizeMode_Normal;
|
||||||
|
|
||||||
|
Unused << mBridge->SendShow(aSize, aParentIsActive, sizeMode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserBridgeHost::UpdateDimensions(const nsIntRect& aRect,
|
void BrowserBridgeHost::UpdateDimensions(const nsIntRect& aRect,
|
||||||
const ScreenIntSize& aSize) {}
|
const ScreenIntSize& aSize) {
|
||||||
|
RefPtr<Element> owner = mBridge->GetFrameLoader()->GetOwnerContent();
|
||||||
|
nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForContent(owner);
|
||||||
|
if (!widget) {
|
||||||
|
widget = nsContentUtils::WidgetForDocument(owner->OwnerDoc());
|
||||||
|
}
|
||||||
|
MOZ_DIAGNOSTIC_ASSERT(widget);
|
||||||
|
|
||||||
|
CSSToLayoutDeviceScale widgetScale = widget->GetDefaultScale();
|
||||||
|
|
||||||
|
LayoutDeviceIntRect devicePixelRect = ViewAs<LayoutDevicePixel>(
|
||||||
|
aRect, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
|
||||||
|
LayoutDeviceIntSize devicePixelSize = ViewAs<LayoutDevicePixel>(
|
||||||
|
aSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
|
||||||
|
|
||||||
|
// XXX What are clientOffset and chromeOffset used for? Are they meaningful
|
||||||
|
// for nested iframes with transforms?
|
||||||
|
LayoutDeviceIntPoint clientOffset;
|
||||||
|
LayoutDeviceIntPoint chromeOffset;
|
||||||
|
|
||||||
|
CSSRect unscaledRect = devicePixelRect / widgetScale;
|
||||||
|
CSSSize unscaledSize = devicePixelSize / widgetScale;
|
||||||
|
hal::ScreenOrientation orientation = hal::eScreenOrientation_Default;
|
||||||
|
DimensionInfo di(unscaledRect, unscaledSize, orientation, clientOffset,
|
||||||
|
chromeOffset);
|
||||||
|
|
||||||
|
Unused << mBridge->SendUpdateDimensions(di);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -15,27 +15,43 @@ namespace dom {
|
||||||
BrowserHost::BrowserHost(BrowserParent* aParent) : mRoot(aParent) {}
|
BrowserHost::BrowserHost(BrowserParent* aParent) : mRoot(aParent) {}
|
||||||
|
|
||||||
mozilla::layers::LayersId BrowserHost::GetLayersId() const {
|
mozilla::layers::LayersId BrowserHost::GetLayersId() const {
|
||||||
return LayersId{0};
|
return mRoot->GetRenderFrame()->GetLayersId();
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowsingContext* BrowserHost::GetBrowsingContext() const { return nullptr; }
|
BrowsingContext* BrowserHost::GetBrowsingContext() const {
|
||||||
|
return mRoot->GetBrowsingContext();
|
||||||
|
}
|
||||||
|
|
||||||
nsILoadContext* BrowserHost::GetLoadContext() const { return nullptr; }
|
nsILoadContext* BrowserHost::GetLoadContext() const {
|
||||||
|
RefPtr<nsILoadContext> loadContext = mRoot->GetLoadContext();
|
||||||
|
return loadContext;
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserHost::LoadURL(nsIURI* aURI) {}
|
void BrowserHost::LoadURL(nsIURI* aURI) { mRoot->LoadURL(aURI); }
|
||||||
|
|
||||||
void BrowserHost::ResumeLoad(uint64_t aPendingSwitchId) {}
|
void BrowserHost::ResumeLoad(uint64_t aPendingSwitchId) {
|
||||||
|
mRoot->ResumeLoad(aPendingSwitchId);
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserHost::DestroyStart() {}
|
void BrowserHost::DestroyStart() { mRoot->Destroy(); }
|
||||||
|
|
||||||
void BrowserHost::DestroyComplete() {}
|
void BrowserHost::DestroyComplete() {
|
||||||
|
if (!mRoot) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mRoot->SetOwnerElement(nullptr);
|
||||||
|
mRoot->Destroy();
|
||||||
|
mRoot = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool BrowserHost::Show(const ScreenIntSize& aSize, bool aParentIsActive) {
|
bool BrowserHost::Show(const ScreenIntSize& aSize, bool aParentIsActive) {
|
||||||
return true;
|
return mRoot->Show(aSize, aParentIsActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserHost::UpdateDimensions(const nsIntRect& aRect,
|
void BrowserHost::UpdateDimensions(const nsIntRect& aRect,
|
||||||
const ScreenIntSize& aSize) {}
|
const ScreenIntSize& aSize) {
|
||||||
|
mRoot->UpdateDimensions(aRect, aSize);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
Загрузка…
Ссылка в новой задаче