mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1550800 - Make PuppetWidget::WidgetToScreenOffset work in out-of-process iframes. r=hsivonen,emilio
A mochitest for this change will be landed in bug 1614268 which needs a work to make Element.focus() work in OOP iframes (bug 1556627). Differential Revision: https://phabricator.services.mozilla.com/D62191 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
796e6049b6
commit
48f45a3d02
@ -1140,6 +1140,14 @@ LayoutDeviceIntPoint PuppetWidget::GetChromeOffset() {
|
|||||||
return GetOwningBrowserChild()->GetChromeOffset();
|
return GetOwningBrowserChild()->GetChromeOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LayoutDeviceIntPoint PuppetWidget::WidgetToScreenOffset() {
|
||||||
|
auto positionRalativeToWindow =
|
||||||
|
WidgetToTopLevelWidgetTransform().TransformPoint(LayoutDevicePoint());
|
||||||
|
|
||||||
|
return GetWindowPosition() +
|
||||||
|
LayoutDeviceIntPoint::Round(positionRalativeToWindow);
|
||||||
|
}
|
||||||
|
|
||||||
LayoutDeviceIntPoint PuppetWidget::GetWindowPosition() {
|
LayoutDeviceIntPoint PuppetWidget::GetWindowPosition() {
|
||||||
if (!GetOwningBrowserChild()) {
|
if (!GetOwningBrowserChild()) {
|
||||||
return LayoutDeviceIntPoint();
|
return LayoutDeviceIntPoint();
|
||||||
|
@ -132,9 +132,7 @@ class PuppetWidget : public nsBaseWidget,
|
|||||||
virtual mozilla::LayoutDeviceToLayoutDeviceMatrix4x4
|
virtual mozilla::LayoutDeviceToLayoutDeviceMatrix4x4
|
||||||
WidgetToTopLevelWidgetTransform() override;
|
WidgetToTopLevelWidgetTransform() override;
|
||||||
|
|
||||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override {
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||||
return GetWindowPosition() + GetChromeOffset();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual LayoutDeviceIntPoint TopLevelWidgetToScreenOffset() override {
|
virtual LayoutDeviceIntPoint TopLevelWidgetToScreenOffset() override {
|
||||||
return GetWindowPosition();
|
return GetWindowPosition();
|
||||||
@ -235,6 +233,10 @@ class PuppetWidget : public nsBaseWidget,
|
|||||||
nsIntSize GetScreenDimensions();
|
nsIntSize GetScreenDimensions();
|
||||||
|
|
||||||
// Get the offset to the chrome of the window that this tab belongs to.
|
// Get the offset to the chrome of the window that this tab belongs to.
|
||||||
|
//
|
||||||
|
// NOTE: In OOP iframes this value is zero. You should use
|
||||||
|
// WidgetToTopLevelWidgetTransform instead which is already including the
|
||||||
|
// chrome offset.
|
||||||
LayoutDeviceIntPoint GetChromeOffset();
|
LayoutDeviceIntPoint GetChromeOffset();
|
||||||
|
|
||||||
// Get the screen position of the application window.
|
// Get the screen position of the application window.
|
||||||
|
Loading…
Reference in New Issue
Block a user