5

It's hard to resize the Picture-in-Picture video window

 2 years ago
source link: https://bugzilla.mozilla.org/show_bug.cgi?id=1598312
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
It's hard to resize the Picture-in-Picture video window

It seems that the Picture-in-Picture window has a hit-area for resizing about one pixel wide around its edges, which makes it very tricky to resize it, especially diagonally. It would be nice if we could increase the hit area a bit to make it a bit easier to grab the window edges for resizing with a mouse/touchpad.

Component: Audio/Video → Video/Audio Controls
Product: Core → Toolkit

It is a lot easier in Chrome/Edge to do this.

Assignee: nobody → chenggu3
Status: NEW → ASSIGNED

To get started on this, we can look at this window utility called setChromeMargin. This allows us to adjust the chrome size on each side of the window.

This method utility should be available on the PiP window we open at: https://searchfox.org/mozilla-central/rev/a6db3bd67367aa9ddd9505690cab09b47e65a762/toolkit/components/pictureinpicture/PictureInPicture.jsm#410-416. I believe we'll want to call this setChromeMargin around this area of the code.

Updates on this:

It doesn't look like setChromeMargin is what we want here. This looks like it's going to require some fiddling with the platform code to get working:

We have 2 approaches for this:

1. The first looks at having a way to set the resizable margin from the WindowUtils. To do this, we'll need to do the following:

  • Expose a method on WindowUtils called setResizableMargin. SetResizableMargin takes in margin values for changing the horizontal/vertical resizer margin: aHResizerSize and aVResizerSize.

  • Create an implementation for SetResizableMargin like SetChromeMargin. This function will be responsible for calling a method on nsWindow that is responsible for modifying these values mHorResizeMargin and mVertResizeMargin with aHResizerSize and aVResizerSize, respectively.

  • Create a method on nsWindow called SetWindowResizerSize. As described above, it sets mHorResizeMargin and mVertResizeMargin and then calls UpdateNonClientMargins to apply other "window-y" things it needs.

  • Now we need a way to prevent UpdateNonClientMargins from overwriting what we set mHorResizeMargin and mVertResizeMargin to. Right now, we should do this by storing creating another member variables on nsWindow, perhaps called mUseResizeMarginOverrides, and use this to prevent executing this code.

After all this, we should be able to do something like: pipWindow.windowUtils.setWindowResizableMargin(x, y) to increase the resizer size.

2. The second approach looks at changing what min-resize border value we use.

I believe the first approach is what we should be exploring first due to the fact we can reuse it for other feature windows and that it seems to be using the correct variables to ensure the resizer works on different desktop resolutions, plus any other calculations nsWindow needs.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK