Closed Bug 1683366 Opened 4 years ago Closed 1 month ago

Picture-in-picture window moves slightly up and to the left, when activated or at random, with Windows custom display scaling used

Categories

(Toolkit :: Picture-in-Picture, defect, P3)

x86_64
Windows 10
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mokkat, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

I upgraded to Firefox 84. Both my desktop and laptop PCs were upgraded to 84, and both display this issue. Windows 10 with latest updates.
Both PCs are using custom 115% display scaling.

Actual results:

In Firefox 84 the size and position of the PiP window is saved.
When PiP is activated, the window appears slightly to the left and up of where it was the last time it was closed. This behavior also happens at random sometime, without me interacting with the window.

The window moves 3-4mm left and up on my 32" 1440p monitor, 1-2mm on my 1080p 16.1" laptop. Not sure how many pixels.

Expected results:

The window should stay where it is.
It behaves like it should with regular Windows scaling, like 100% or 125%

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core
Blocks: videopip
Component: Graphics: WebRender → Video/Audio Controls
OS: Unspecified → Windows 10
Product: Core → Toolkit
Hardware: Unspecified → x86_64

I can reproduce this on Windows when set to 115% DPI. I believe the bug is in PIctureInPicture.jsm's fitToScreen method.

Severity: -- → S4
Priority: -- → P3

I think this happens every time the source video stream reinitializes/changes. If you are watching a Twitch stream in picture-in-picture, the stream source/quality may change often (I can tell that the video quality improves/degrades when this happens). Each time this happens, the picture-in-picture window will recalculate its size. Since this happens often, it slowly creeps up to the top left and becomes smaller—even if you start with the window covering much of the screen. It seems to be something like rounding error as certain exact sizes/positions sometimes seem to avoid the issue(?).

I suspect there are two approaches to solving this:

  • Have the video letterbox itself instead of resizing the picture-in-picture window when the video source reinitializes. Not reestablishing the dimensions when the video source changes should avoid this.
  • Have the picture-in-picture save the last position/size set by the user and use this for its calculations instead of using the current size/position when recalculating its new size/position after the video source changes.
See Also: → 1701380

I use a display scaling setting of 175% and I experience the issue. If I set the scaling to 100% I don’t see the issue happening—the window becomes wider and skinnier in response to the source video size changing but does not seem to tend to get smaller and it doesn’t change location.

The source video switches between resolutions such as 1920×x1080 and 1280×720 and the creep happens at that time.

Component: Video/Audio Controls → Picture-in-Picture
Version: Firefox 84 → Trunk

This also happens on macOS. I'm on macOS 12.5, on a new M1 Max, and have precisely the same problem.

I leave multiple pip windows on the screen. Usually, I can double-click one to go full-screen, and double-click again to return it to its place.
But when this bug triggers (i.e. the stream changes somehow), the window leaves the full-screen state, moves up and left a bit, but continues with the same size as the full-screen one! It's very annoying because a double-click now does not return it to its place, only makes it full-screen again, so I have to manually resize and re-position it where it was.....
And this happens a lot..... Thank you!

I've not seen this behavior in a while. Can anyone reproduce it?

Flags: needinfo?(mokkat)

(In reply to braiamp from comment #7)

I've not seen this behavior in a while. Can anyone reproduce it?

I used to experience this bug, but I had forgotten about it as I also haven't seen it for a while. I still use picture-in-picture to watch Twitch which triggered this a lot, but the window seems to stay in place lately.

What I wonder about but haven't tried recently is how the picture-in-picture window handles aspect ratio changes. I suspect (I'll try to remember to test and report back) that the current behavior will result in black borders if the asect ratio changes after the picture-in-picture window is opened. This isn't ideal. But if that is what it takes to avoid the window creeping around, it's worth it.

(In reply to Nathan Phillip Brink (binki) from comment #8)

What I wonder about but haven't tried recently is how the picture-in-picture window handles aspect ratio changes. I suspect (I'll try to remember to test and report back) that the current behavior will result in black borders if the asect ratio changes after the picture-in-picture window is opened. This isn't ideal. But if that is what it takes to avoid the window creeping around, it's worth it.

I tested this and it handles the aspect ratio change very well. The window resizes but the upper-left corner stays perfectly still, at least on my 2560×1600 at 125% zoom Windows laptop running Windows 11 (build 27758.1000) or on my 3840×2400 at 175% zoom Windows laptop running Windows 11 (build 27758.1000).

Redirect a needinfo that is pending on an inactive user to the triage owner.
:mconley, since the bug has recent activity, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(mokkat) → needinfo?(mconley)

It sounds like this cannot be reproduced in recent versions. If somebody is still experiencing this, please let us know, and we can re-open this bug.

Status: UNCONFIRMED → RESOLVED
Closed: 1 month ago
Flags: needinfo?(mconley)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.