Bug 1598312 Comment 3 Edit History

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

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](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/dom/interfaces/base/nsIDOMWindowUtils.idl#1922) called `setResizableMargin`. `SetResizableMargin` takes in margin values for changing the horizontal/vertical resizer margin: `aHResizerSize` and `aVResizerSize`.

* Create an implementation for `SetResizableMargin` like [SetChromeMargin](https://searchfox.org/mozilla-central/source/dom/base/nsDOMWindowUtils.cpp#4152). This function will be responsible for calling a method on [nsWindow](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.h#96) 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](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.cpp#2785) 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](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.cpp#2783-2801).

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. 

* Create some local variable called "minResizableBorder" whose value is initialized to `kResizableBorderMinSize`.
* Do a check for whether or not the window is a PiP window. I believe this is currently available by checking `mAlwaysOnTop` in `nsWindow`.  
If we're using PiP, then reassigns `minResizableBorder` to some other pixel value that would increase the border size significantly. 
* Replace uses of `kResizableBorderMinSize` with `minResizableBorder` here: https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.cpp#6419-6427 

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.
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](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/dom/interfaces/base/nsIDOMWindowUtils.idl#1922) called `setResizableMargin`. `SetResizableMargin` takes in margin values for changing the horizontal/vertical resizer margin: `aHResizerSize` and `aVResizerSize`.

* Create an implementation for `SetResizableMargin` like [SetChromeMargin](https://searchfox.org/mozilla-central/source/dom/base/nsDOMWindowUtils.cpp#4152). This function will be responsible for calling a method on [nsWindow](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.h#96) 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](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.cpp#2785) 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](https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.cpp#2783-2801).

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. 

* Create some local variable called "minResizableBorder" whose value is initialized to `kResizableBorderMinSize`.
* Do a check for whether or not the window is a PiP window. I believe this is currently available by checking `mAlwaysOnTop` in `nsWindow`.  
If we're using PiP, then reassigns `minResizableBorder` to some other pixel value that would increase the border size significantly. 
* Replace uses of `kResizableBorderMinSize` with `minResizableBorder` here: https://searchfox.org/mozilla-central/rev/26330a08b1f9d06938faa0aa5e0f8c7a58064aa2/widget/windows/nsWindow.cpp#6419-6427 

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.

Back to Bug 1598312 Comment 3