зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1583575: Retain window size between instances and use it to set the size when opening a new window; r=snorp
This obviously only improves the situation when a subsequent window is the same size as the last window that was opened. Differential Revision: https://phabricator.services.mozilla.com/D50527 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bdd872d6c8
Коммит
4d0bd40e2e
|
@ -131,6 +131,18 @@ static const int32_t INPUT_RESULT_HANDLED =
|
|||
static const int32_t INPUT_RESULT_HANDLED_CONTENT =
|
||||
java::PanZoomController::INPUT_RESULT_HANDLED_CONTENT;
|
||||
|
||||
/**
|
||||
* Width and height from the last nsWindow::Resize call, used for setting
|
||||
* dimensions of a new window under the heuristic that a new window is likely
|
||||
* to be the same size as a previous window.
|
||||
*
|
||||
* A default size of 1x1 confuses MobileViewportManager, so we use 0x0 instead.
|
||||
* This is also a little more fitting since we don't yet have a surface yet
|
||||
* (and therefore a valid size) and 0x0 is usually recognized as invalid.
|
||||
*/
|
||||
static int32_t gLastWidth = 0;
|
||||
static int32_t gLastHeight = 0;
|
||||
|
||||
template <typename Lambda, bool IsStatic, typename InstanceType, class Impl>
|
||||
class nsWindow::WindowEvent : public Runnable {
|
||||
bool IsStaleCall() {
|
||||
|
@ -1498,11 +1510,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
|||
mParent = parent;
|
||||
}
|
||||
|
||||
// A default size of 1x1 confuses MobileViewportManager, so
|
||||
// use 0x0 instead. This is also a little more fitting since
|
||||
// we don't yet have a surface yet (and therefore a valid size)
|
||||
// and 0x0 is usually recognized as invalid.
|
||||
Resize(0, 0, false);
|
||||
Resize(gLastWidth, gLastHeight, false);
|
||||
|
||||
CreateLayerManager();
|
||||
|
||||
|
@ -1702,8 +1710,8 @@ void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
|||
|
||||
mBounds.x = NSToIntRound(aX);
|
||||
mBounds.y = NSToIntRound(aY);
|
||||
mBounds.width = NSToIntRound(aWidth);
|
||||
mBounds.height = NSToIntRound(aHeight);
|
||||
mBounds.width = gLastWidth = NSToIntRound(aWidth);
|
||||
mBounds.height = gLastHeight = NSToIntRound(aHeight);
|
||||
|
||||
if (needSizeDispatch) {
|
||||
OnSizeChanged(gfx::IntSize::Truncate(aWidth, aHeight));
|
||||
|
|
Загрузка…
Ссылка в новой задаче