Bug 1807825 Comment 13 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

So the source of this issue appears to be that we get an [incorrect backing scale factor of 1.0f instead of 2.0f to compute `deskBounds`](https://searchfox.org/mozilla-central/source/widget/nsBaseWidget.cpp#2012). This is because we appear to be using an instance of `PuppetWidget` to obtain the backing scale factor. This is confirmed by the following stack, which shows that we're using the base implementation `nsBaseWidget::GetWidgetScreen` instead of one of the platform overrides, such as `nsCocoaWindow::GetDesktopToDeviceScale` or `nsChildView::GetDesktopToDeviceScale`.

``
0   libmozglue.dylib              	       0x1005f7ebc mozalloc_abort + 68
1   libmozglue.dylib              	       0x1005f7ea8 mozalloc_abort + 48
2   libmozglue.dylib              	       0x1005f7ed8 abort + 20
3   XUL                           	       0x11204d32c nsBaseWidget::GetWidgetScreen() + 456
4   XUL                           	       0x10fee4b98 nsDeviceContext::ComputeFullAreaUsingScreen(nsRect*) + 80
5   XUL                           	       0x10fee4c78 nsDeviceContext::GetRect(nsRect&) + 44
6   XUL                           	       0x110495528 nsScreen::GetRect(mozilla::gfx::IntRectTyped<mozilla::CSSPixel>&) + 396
7   XUL                           	       0x11096184c mozilla::dom::Screen_Binding::get_top(JSContext*, JS::Handle<JSObject*>, void*, JSJitGetterCallArgs) + 184
8   XUL                           	       0x110eaaa1c bool mozilla::dom::binding_detail::GenericGetter<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) + 264
9   XUL                           	       0x1134293bc js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) + 608
10  XUL                           	       0x113429c04 js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) + 244
11  XUL                           	       0x11370c5d8 js::DebuggerObject::call(JSContext*, JS::Handle<js::DebuggerObject*>, JS::Handle<JS::Value>, JS::Handle<JS::GCVector<JS::Value, 0ul, js::TempAllocPolicy> >) + 1100
12  XUL                           	       0x11370bfb0 js::DebuggerObject::CallData::callMethod() + 336
13  XUL                           	       0x113715a24 bool js::DebuggerObject::CallData::ToNative<&(js::DebuggerObject::CallData::callMethod())>(JSContext*, unsigned int, JS::Value*) + 384
[...]
``
It isn't clear to me right now why we'd be using a `PuppetWidget` here. The only other widget implementation using the base implementation of `GetDesktopToDeviceScale` is `HeadlessWidget`.
So the source of this issue appears to be that we get an [incorrect backing scale factor of 1.0f instead of 2.0f to compute `deskBounds`](https://searchfox.org/mozilla-central/source/widget/nsBaseWidget.cpp#2012). This is because we appear to be using an instance of `PuppetWidget` to obtain the backing scale factor. This is confirmed by the following stack, which shows that we're using the base implementation `nsBaseWidget::GetWidgetScreen` instead of one of the platform overrides, such as `nsCocoaWindow::GetDesktopToDeviceScale` or `nsChildView::GetDesktopToDeviceScale`.


``
0   libmozglue.dylib              	       0x1005f7ebc mozalloc_abort + 68
1   libmozglue.dylib              	       0x1005f7ea8 mozalloc_abort + 48
2   libmozglue.dylib              	       0x1005f7ed8 abort + 20
3   XUL                           	       0x11204d32c nsBaseWidget::GetWidgetScreen() + 456
4   XUL                           	       0x10fee4b98 nsDeviceContext::ComputeFullAreaUsingScreen(nsRect*) + 80
5   XUL                           	       0x10fee4c78 nsDeviceContext::GetRect(nsRect&) + 44
6   XUL                           	       0x110495528 nsScreen::GetRect(mozilla::gfx::IntRectTyped<mozilla::CSSPixel>&) + 396
7   XUL                           	       0x11096184c mozilla::dom::Screen_Binding::get_top(JSContext*, JS::Handle<JSObject*>, void*, JSJitGetterCallArgs) + 184
8   XUL                           	       0x110eaaa1c bool mozilla::dom::binding_detail::GenericGetter<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) + 264
9   XUL                           	       0x1134293bc js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) + 608
10  XUL                           	       0x113429c04 js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) + 244
11  XUL                           	       0x11370c5d8 js::DebuggerObject::call(JSContext*, JS::Handle<js::DebuggerObject*>, JS::Handle<JS::Value>, JS::Handle<JS::GCVector<JS::Value, 0ul, js::TempAllocPolicy> >) + 1100
12  XUL                           	       0x11370bfb0 js::DebuggerObject::CallData::callMethod() + 336
13  XUL                           	       0x113715a24 bool js::DebuggerObject::CallData::ToNative<&(js::DebuggerObject::CallData::callMethod())>(JSContext*, unsigned int, JS::Value*) + 384
[...]
``


It isn't clear to me right now why we'd be using a `PuppetWidget` here. The only other widget implementation using the base implementation of `GetDesktopToDeviceScale` is `HeadlessWidget`.
So the source of this issue appears to be that we get an [incorrect backing scale factor of 1.0f instead of 2.0f to compute `deskBounds`](https://searchfox.org/mozilla-central/source/widget/nsBaseWidget.cpp#2012). This is because we appear to be using an instance of `PuppetWidget` to obtain the backing scale factor. This is confirmed by the following stack, which shows that we're using the base implementation `nsBaseWidget::GetWidgetScreen` instead of one of the platform overrides, such as `nsCocoaWindow::GetDesktopToDeviceScale` or `nsChildView::GetDesktopToDeviceScale`.


```
0   libmozglue.dylib              	       0x1005f7ebc mozalloc_abort + 68
1   libmozglue.dylib              	       0x1005f7ea8 mozalloc_abort + 48
2   libmozglue.dylib              	       0x1005f7ed8 abort + 20
3   XUL                           	       0x11204d32c nsBaseWidget::GetWidgetScreen() + 456
4   XUL                           	       0x10fee4b98 nsDeviceContext::ComputeFullAreaUsingScreen(nsRect*) + 80
5   XUL                           	       0x10fee4c78 nsDeviceContext::GetRect(nsRect&) + 44
6   XUL                           	       0x110495528 nsScreen::GetRect(mozilla::gfx::IntRectTyped<mozilla::CSSPixel>&) + 396
7   XUL                           	       0x11096184c mozilla::dom::Screen_Binding::get_top(JSContext*, JS::Handle<JSObject*>, void*, JSJitGetterCallArgs) + 184
8   XUL                           	       0x110eaaa1c bool mozilla::dom::binding_detail::GenericGetter<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) + 264
9   XUL                           	       0x1134293bc js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) + 608
10  XUL                           	       0x113429c04 js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) + 244
11  XUL                           	       0x11370c5d8 js::DebuggerObject::call(JSContext*, JS::Handle<js::DebuggerObject*>, JS::Handle<JS::Value>, JS::Handle<JS::GCVector<JS::Value, 0ul, js::TempAllocPolicy> >) + 1100
12  XUL                           	       0x11370bfb0 js::DebuggerObject::CallData::callMethod() + 336
13  XUL                           	       0x113715a24 bool js::DebuggerObject::CallData::ToNative<&(js::DebuggerObject::CallData::callMethod())>(JSContext*, unsigned int, JS::Value*) + 384
[...]
```


It isn't clear to me right now why we'd be using a `PuppetWidget` here. The only other widget implementation using the base implementation of `GetDesktopToDeviceScale` is `HeadlessWidget`.

Back to Bug 1807825 Comment 13