Bug 758048 - Move PopupType from the Windows widget implementation to the cross platform base class and use it to determine when to accelerate windows. r=bbondy

This commit is contained in:
Nicolas Silva 2012-05-31 13:52:09 -04:00
parent b49a6607bc
commit dbe233d2e7
4 changed files with 10 additions and 6 deletions

View File

@ -326,7 +326,6 @@ nsWindow::nsWindow() : nsBaseWidget()
mPickerDisplayCount = 0;
mWindowType = eWindowType_child;
mBorderStyle = eBorderStyle_default;
mPopupType = ePopupTypeAny;
mOldSizeMode = nsSizeMode_Normal;
mLastSizeMode = nsSizeMode_Normal;
mLastPoint.x = 0;
@ -466,7 +465,6 @@ nsWindow::Create(nsIWidget *aParent,
WinUtils::GetNSWindowPtr((HWND)aNativeParent) : nsnull;
}
mPopupType = aInitData->mPopupHint;
mIsRTL = aInitData->mRTL;
DWORD style = WindowStyle();

View File

@ -449,8 +449,6 @@ protected:
static void ActivateOtherWindowHelper(HWND aWnd);
void ClearCachedResources();
nsPopupType PopupType() { return mPopupType; }
protected:
nsCOMPtr<nsIWidget> mParent;
nsIntSize mLastSize;
@ -476,7 +474,6 @@ protected:
InputContext mInputContext;
nsNativeDragTarget* mNativeDragTarget;
HKL mLastKeyboardLayout;
nsPopupType mPopupType;
nsSizeMode mOldSizeMode;
nsSizeMode mLastSizeMode;
WindowHook mWindowHook;

View File

@ -98,6 +98,7 @@ nsBaseWidget::nsBaseWidget()
, mZIndex(0)
, mSizeMode(nsSizeMode_Normal)
, mPopupLevel(ePopupLevelTop)
, mPopupType(ePopupTypeAny)
{
#ifdef NOISY_WIDGET_LEAKS
gNumWidgets++;
@ -209,6 +210,7 @@ void nsBaseWidget::BaseCreate(nsIWidget *aParent,
mWindowType = aInitData->mWindowType;
mBorderStyle = aInitData->mBorderStyle;
mPopupLevel = aInitData->mPopupLevel;
mPopupType = aInitData->mPopupHint;
}
if (aParent) {
@ -806,8 +808,12 @@ nsBaseWidget::GetShouldAccelerate()
bool accelerateByDefault = false;
#endif
// We don't want to accelerate small popup windows like menu, but we still
// want to accelerate xul panels that may contain arbitrarily complex content.
bool isSmallPopup = ((mWindowType == eWindowType_popup) &&
(mPopupType != ePopupTypePanel));
// we should use AddBoolPrefVarCache
bool disableAcceleration = (mWindowType == eWindowType_popup) ||
bool disableAcceleration = isSmallPopup ||
Preferences::GetBool("layers.acceleration.disabled", false);
mForceLayersAcceleration =
Preferences::GetBool("layers.acceleration.force-enabled", false);

View File

@ -265,6 +265,8 @@ protected:
BasicLayerManager* CreateBasicLayerManager();
nsPopupType PopupType() const { return mPopupType; }
protected:
/**
* Starts the OMTC compositor destruction sequence.
@ -304,6 +306,7 @@ protected:
PRInt32 mZIndex;
nsSizeMode mSizeMode;
nsPopupLevel mPopupLevel;
nsPopupType mPopupType;
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
// so it can be cleared automatically.