Right now, if you want to set a window's size taking into account the title bar (the entire window), the caller has to special case and account for title bar sizes. So on Mac OS X, if you want a window to be 300 pixels tall, you need to set its height to 278 pixes (22 pixel title bar). This is difficult on Linux because it would be hard to get the title bar height. However, since this is a desired piece of functionality, we should have a way to make a best guess attempt at resizing an entire window correctly available to callers so that attempts can be consistent. For example, we could hard-code 22 as a title bar height for Mac OS X and guess 28 pixels for Linux (like we do in browser.js right now). I don't know what would be a good guessing mechanism on Windows, maybe we can just ask the OS.
Johnny suggested such functionality might at least go through nsGlobalChromeWindow.
What about the following APIs: * set the *content* size of the window (i.e. size of browser area), which needs to be specific about whether the scrollbars are included. * set the position of the window as the top-left of the window frame. That way no-one has to deal with measuring title bars, other than the platform-specific code.
josh: the issue is, if you want your window to be full height with maybe 5 pixels on top and bottom spacer, how do you calculate that window height for sizeTo()? josh: you can't, without hacking in some value for the title bar josh: we do it, so we might as well have an offical way of guessing so the guesses are consistent smfr: gotcha So smfr's suggested APIs don't fix the problem. Sorry if I was unclear about what level I'm talking about.
Also note that if you want to create a window relative to the screen size, then you need to know the chrome dimensions.
Summary: add mechanism for resizing windows taking title bar (entire window) into account → Add mechanism for XUL/JS window resizing taking title bar (entire window) into account
You need to log in before you can comment on or make changes to this bug.