зеркало из https://github.com/mozilla/gecko-dev.git
Bug #179740. [gtk2] problems with iframes - make sure that all the windows that are supposed to be listening for resize events actually are doing so. Not part of the default build.
This commit is contained in:
Родитель
0405546462
Коммит
306c1a8c87
|
@ -67,11 +67,10 @@ nsCommonWidget::GetParent(void)
|
|||
}
|
||||
|
||||
void
|
||||
nsCommonWidget::CommonCreate(nsIWidget *aParent, nsNativeWidget aNativeParent)
|
||||
nsCommonWidget::CommonCreate(nsIWidget *aParent, PRBool aListenForResizes)
|
||||
{
|
||||
mParent = aParent;
|
||||
if (aNativeParent)
|
||||
mListenForResizes = PR_TRUE;
|
||||
mListenForResizes = aListenForResizes;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -387,13 +386,15 @@ nsCommonWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
|||
// If the widget hasn't been shown, mark the widget as needing to be
|
||||
// resized before it is shown.
|
||||
else {
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
if (mListenForResizes)
|
||||
if (AreBoundsSane() && mListenForResizes) {
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
NativeResize(aWidth, aHeight, aRepaint);
|
||||
else
|
||||
}
|
||||
else {
|
||||
mNeedsResize = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// synthesize a resize event if this isn't a toplevel
|
||||
|
@ -445,13 +446,15 @@ nsCommonWidget::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
|
|||
// If the widget hasn't been shown, mark the widget as needing to be
|
||||
// resized before it is shown
|
||||
else {
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
if (mListenForResizes)
|
||||
if (AreBoundsSane() && mListenForResizes){
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
else
|
||||
}
|
||||
else {
|
||||
mNeedsResize = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsTopLevel || mListenForResizes) {
|
||||
|
@ -525,7 +528,7 @@ nsCommonWidget::OnDestroy(void)
|
|||
PRBool
|
||||
nsCommonWidget::AreBoundsSane(void)
|
||||
{
|
||||
if (mBounds.width > 1 && mBounds.height > 1)
|
||||
if (mBounds.width > 0 && mBounds.height > 0)
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
virtual nsIWidget *GetParent(void);
|
||||
|
||||
void CommonCreate(nsIWidget *aParent, nsNativeWidget aNativeParent);
|
||||
void CommonCreate(nsIWidget *aParent, PRBool aListenForResizes);
|
||||
|
||||
// event handling code
|
||||
void InitPaintEvent(nsPaintEvent &aEvent);
|
||||
|
|
|
@ -130,12 +130,12 @@ nsScrollbar::ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY)
|
|||
NS_IMETHODIMP
|
||||
nsScrollbar::Move(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
if (aX == mBounds.x && aY == mBounds.y)
|
||||
return NS_OK;
|
||||
|
||||
LOG(("nsScrollbar::Move [%p] %d %d\n", (void *)this,
|
||||
aX, aY));
|
||||
|
||||
if (aX == mBounds.x && aY == mBounds.y)
|
||||
return NS_OK;
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
|
||||
|
@ -415,8 +415,13 @@ nsScrollbar::NativeCreate(nsIWidget *aParent,
|
|||
BaseCreate(aParent, aRect, aHandleEventFunction, aContext,
|
||||
aAppShell, aToolkit, aInitData);
|
||||
|
||||
// Do we need to listen for resizes?
|
||||
PRBool listenForResizes;
|
||||
if (aNativeParent || aInitData->mListenForResizes)
|
||||
listenForResizes = PR_TRUE;
|
||||
|
||||
// and do our common creation
|
||||
CommonCreate(aParent, aNativeParent);
|
||||
CommonCreate(aParent, listenForResizes);
|
||||
|
||||
// save our bounds
|
||||
mBounds = aRect;
|
||||
|
|
|
@ -494,12 +494,16 @@ nsWindow::ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY)
|
|||
NS_IMETHODIMP
|
||||
nsWindow::Move(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
if (aX == mBounds.x && aY == mBounds.y)
|
||||
return NS_OK;
|
||||
|
||||
LOG(("nsWindow::Move [%p] %d %d\n", (void *)this,
|
||||
aX, aY));
|
||||
|
||||
// Since a popup window's x/y coordinates are in relation to to
|
||||
// the parent, the parent might have moved so we always move a
|
||||
// popup window.
|
||||
if (aX == mBounds.x && aY == mBounds.y &&
|
||||
mWindowType != eWindowType_popup)
|
||||
return NS_OK;
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
|
||||
|
@ -1964,8 +1968,13 @@ nsWindow::NativeCreate(nsIWidget *aParent,
|
|||
BaseCreate(baseParent, aRect, aHandleEventFunction, aContext,
|
||||
aAppShell, aToolkit, aInitData);
|
||||
|
||||
// Do we need to listen for resizes?
|
||||
PRBool listenForResizes;
|
||||
if (aNativeParent || aInitData->mListenForResizes)
|
||||
listenForResizes = PR_TRUE;
|
||||
|
||||
// and do our common creation
|
||||
CommonCreate(aParent, aNativeParent);
|
||||
CommonCreate(aParent, listenForResizes);
|
||||
|
||||
// save our bounds
|
||||
mBounds = aRect;
|
||||
|
|
Загрузка…
Ссылка в новой задаче