feat: enable innerWidth and innerHeight for window open#46749
Conversation
612bdf6 to
6b01c06
Compare
shell/browser/native_window_mac.mm
Outdated
| if (inner_width) | ||
| width = (inner_width < 100) ? 100 : inner_width; | ||
| if (inner_height) | ||
| height = (inner_height < 100) ? 100 : inner_height; |
There was a problem hiding this comment.
-
Better to use
foo = std::max(100, inner_foo)here -
We're still allowing a value of <100 to be inherited from either
widthorheightviaoptions::kWidth. Is that OK? -
Maybe we should update the docs to point out that a minimum of 100 is required?
There was a problem hiding this comment.
It's also not clear to me why 100 is being used here?
There was a problem hiding this comment.
@codebytere it's in the spec:
https://developer.mozilla.org/en-US/docs/Web/API/Window/open#width
Specifies the width of the content area, including scrollbars. The minimum required value is 100.
But you're right, that's not clear unless one reads the spec or this thread. Maybe a symbolic constant name could be used to make it clearer, e.g.
constexpr int kMinSizeReqdBySpec = 100;There was a problem hiding this comment.
ah cool - ty! perhaps a comment with spec link?
There was a problem hiding this comment.
I think since this is supposed to be inline with the window.open spec, our docs do not need to also state that it adheres to this requirement specifically. Although, I think linking to the spec in the code is helpful to understand what might seem like an arbitrary value at first glance.
requested changes have been made
* feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
* feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
|
I have automatically backported this PR to "36-x-y", please check out #47038 |
|
I have automatically backported this PR to "37-x-y", please check out #47039 |
* feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews
|
@mlaurencin has manually backported this PR to "35-x-y", please check out #47045 |
feat: enable innerWidth and innerHeight for window open (#46749) * feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
) * feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews
feat: enable innerWidth and innerHeight for window open (#46749) * feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
* feat: enable innerWidth and innerHeight for window open * update comment for added special innerWidth and innerHeight * update 100 min spec requirement handling * update testing to include getContentSize * update macOS min requirement handling * adjust refactored consts * update const values from nativewindowviews
Description of Change
Closes #45816
Previously, our implementation of window.open did not allow for
innerWidthandinnerHeightas available options for the window.open features string. As per the spec, these options should be available and should also be equivalent to setting thewidthandheightoptions: https://developer.mozilla.org/en-US/docs/Web/API/Window/open#widthThis PR specifically adds in the
innerWidthandinnerHeightoptions to set the innerWidth and innerHeight of the window respectively. A follow-up PR will be required to make thewidthandheightoptions match this functionality, as this will be a breaking change (they currently equate to settingouterWidthandouterHeightrespectively).Checklist
npm testpassesRelease Notes
Notes: added
innerWidthandinnerHeightoptions for window.open