Bug 506103 - Remove mDeferredPositioner and related code. r=roc

This commit is contained in:
Jim Mathies 2009-07-27 12:27:35 -05:00
Родитель bbf7eeb77a
Коммит 6e51c59578
15 изменённых файлов: 33 добавлений и 256 удалений

Просмотреть файл

@ -102,9 +102,10 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
#endif
// {5F8D1A5E-C380-4c60-978A-030335BE1D6A}
#define NS_IWIDGET_IID \
{ 0x9b8d70bd, 0x068e, 0x4465, \
{ 0x8a, 0xd2, 0x4c, 0xf7, 0x96, 0x67, 0xe4, 0xfc } }
{ 0x5f8d1a5e, 0xc380, 0x4c60, \
{ 0x97, 0x8a, 0x03, 0x03, 0x35, 0xbe, 0x1d, 0x6a } }
/*
* Window shadow styles
@ -781,24 +782,6 @@ class nsIWidget : public nsISupports {
virtual nsIntPoint WidgetToScreenOffset() = 0;
/**
* When adjustments are to made to a whole set of child widgets, call this
* before resizing/positioning the child windows to minimize repaints. Must
* be followed by EndResizingChildren() after child windows have been
* adjusted.
*
*/
NS_IMETHOD BeginResizingChildren(void) = 0;
/**
* Call this when finished adjusting child windows. Must be preceded by
* BeginResizingChildren().
*
*/
NS_IMETHOD EndResizingChildren(void) = 0;
/**
* Dispatches an event to the widget
*

Просмотреть файл

@ -329,20 +329,6 @@ nsWindow::~nsWindow()
NS_IF_RELEASE(mFontMetrics);
}
NS_METHOD nsWindow::BeginResizingChildren(void)
{
// HideKids(PR_TRUE) may be used here
NS_NOTYETIMPLEMENTED("BeginResizingChildren not yet implemented"); // to be implemented
return NS_OK;
}
NS_METHOD nsWindow::EndResizingChildren(void)
{
// HideKids(PR_FALSE) may be used here
NS_NOTYETIMPLEMENTED("EndResizingChildren not yet implemented"); // to be implemented
return NS_OK;
}
NS_METHOD nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
{
BPoint point;
@ -1629,8 +1615,6 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
mIsScrolling = PR_TRUE;
//Preventing main view invalidation loop-chain when children are moving
//by by hiding children nsWidgets.
//Maybe this method must be used wider, in move and resize chains
// and implemented in BeginResizingChildren or in Reset*Visibility() methods
//Children will be unhidden in ::Update() when called by other than gkview::Scroll() method.
HideKids(PR_TRUE);
if (mView && mView->LockLooper())

Просмотреть файл

@ -165,8 +165,6 @@ public:
NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_FAILURE; }
NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);

Просмотреть файл

@ -354,8 +354,6 @@ public:
const nsIntRect& aSource,
const nsTArray<Configuration>& aConfigurations);
virtual nsIntPoint WidgetToScreenOffset();
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect);
static PRBool ConvertStatus(nsEventStatus aStatus)

Просмотреть файл

@ -1186,17 +1186,6 @@ NS_IMETHODIMP nsChildView::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt3
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP nsChildView::BeginResizingChildren(void)
{
return NS_OK;
}
NS_IMETHODIMP nsChildView::EndResizingChildren(void)
{
return NS_OK;
}
static const PRInt32 resizeIndicatorWidth = 15;
static const PRInt32 resizeIndicatorHeight = 15;
PRBool nsChildView::ShowsResizeIndicator(nsIntRect* aResizerRect)

Просмотреть файл

@ -230,8 +230,6 @@ public:
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
virtual void Scroll(const nsIntPoint& aDelta, const nsIntRect& aSource,
const nsTArray<Configuration>& aConfigurations);
NS_IMETHOD BeginResizingChildren(void) { return NS_OK; }
NS_IMETHOD EndResizingChildren(void) { return NS_OK; }
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) ;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);

Просмотреть файл

@ -1906,18 +1906,6 @@ nsWindow::WidgetToScreenOffset()
return nsIntPoint(x, y);
}
NS_IMETHODIMP
nsWindow::BeginResizingChildren(void)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWindow::EndResizingChildren(void)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWindow::EnableDragDrop(PRBool aEnable)
{

Просмотреть файл

@ -194,8 +194,6 @@ public:
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
virtual nsIntPoint WidgetToScreenOffset();
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aWidgetInitData);
NS_IMETHOD CaptureMouse(PRBool aCapture);

Просмотреть файл

@ -313,59 +313,6 @@ NS_METHOD nsWindow::CaptureMouse(PRBool aCapture)
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Deferred Window positioning
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::BeginResizingChildren(void)
{
if( !mSWPs)
{
mlHave = 10;
mlUsed = 0;
mSWPs = (PSWP) malloc( 10 * sizeof( SWP));
}
return NS_OK;
}
void nsWindow::DeferPosition( HWND hwnd, HWND hwndInsertBehind,
long x, long y, long cx, long cy, ULONG flags)
{
if( mSWPs)
{
if( mlHave == mlUsed) // need more swps
{
mlHave += 10;
mSWPs = (PSWP) realloc( mSWPs, mlHave * sizeof( SWP));
}
mSWPs[ mlUsed].hwnd = hwnd;
mSWPs[ mlUsed].hwndInsertBehind = hwndInsertBehind;
mSWPs[ mlUsed].x = x;
mSWPs[ mlUsed].y = y;
mSWPs[ mlUsed].cx = cx;
mSWPs[ mlUsed].cy = cy;
mSWPs[ mlUsed].fl = flags;
mSWPs[ mlUsed].ulReserved1 = 0;
mSWPs[ mlUsed].ulReserved2 = 0;
mlUsed++;
}
}
NS_METHOD nsWindow::EndResizingChildren(void)
{
if( nsnull != mSWPs)
{
WinSetMultWindowPos( 0/*hab*/, mSWPs, mlUsed);
free( mSWPs);
mSWPs = nsnull;
mlUsed = mlHave = 0;
}
return NS_OK;
}
nsIntPoint nsWindow::WidgetToScreenOffset()
{
POINTL point = { 0, 0 };

Просмотреть файл

@ -154,8 +154,6 @@ class nsWindow : public nsBaseWidget,
NS_IMETHOD CaptureMouse(PRBool aCapture);
NS_IMETHOD BeginResizingChildren();
NS_IMETHOD EndResizingChildren();
virtual nsIntPoint WidgetToScreenOffset();
NS_IMETHOD DispatchEvent( struct nsGUIEvent *event, nsEventStatus &aStatus);
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);

Просмотреть файл

@ -157,18 +157,6 @@ public:
NS_IMETHOD WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
NS_IMETHOD ScreenToWidget(const nsRect &aOldRect, nsRect &aNewRect);
inline NS_IMETHOD BeginResizingChildren(void)
{
PtHold();
return NS_OK;
}
inline NS_IMETHOD EndResizingChildren(void)
{
PtRelease();
return NS_OK;
}
// Use this to set the name of a widget for normal widgets.. not the same as the nsWindow version
inline NS_IMETHOD SetTitle(const nsAString& aTitle) { return NS_OK; }

Просмотреть файл

@ -799,18 +799,6 @@ nsWindow::WidgetToScreenOffset()
return nsIntPoint(origin.x(), origin.y());
}
NS_IMETHODIMP
nsWindow::BeginResizingChildren(void)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWindow::EndResizingChildren(void)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWindow::EnableDragDrop(PRBool aEnable)
{

Просмотреть файл

@ -179,8 +179,6 @@ public:
NS_IMETHOD SetTitle(const nsAString& aTitle);
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
virtual nsIntPoint WidgetToScreenOffset();
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &aStatus);
NS_IMETHOD EnableDragDrop(PRBool aEnable);

Просмотреть файл

@ -318,7 +318,6 @@ nsWindow::nsWindow() : nsBaseWidget()
mWnd = nsnull;
mPaintDC = nsnull;
mPrevWndProc = nsnull;
mDeferredPositioner = nsnull;
mOldIMC = nsnull;
mNativeDragTarget = nsnull;
mInDtor = PR_FALSE;
@ -1271,25 +1270,10 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY)
}
}
#endif
nsIWidget *par = GetParent();
HDWP deferrer = NULL;
if (nsnull != par) {
deferrer = ((nsWindow *)par)->mDeferredPositioner;
}
if (NULL != deferrer) {
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
mWnd, NULL, aX, aY, 0, 0,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
}
else {
ClearThemeRegion();
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
SetThemeRegion();
}
ClearThemeRegion();
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
SetThemeRegion();
}
return NS_OK;
}
@ -1310,29 +1294,17 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
mBounds.height = aHeight;
if (mWnd) {
nsIWidget *par = GetParent();
HDWP deferrer = NULL;
if (nsnull != par) {
deferrer = ((nsWindow *)par)->mDeferredPositioner;
}
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE;
#ifndef WINCE
if (!aRepaint) {
flags |= SWP_NOREDRAW;
}
#endif
if (NULL != deferrer) {
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
}
else {
ClearThemeRegion();
VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
SetThemeRegion();
}
ClearThemeRegion();
VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
SetThemeRegion();
}
if (aRepaint)
@ -1359,13 +1331,6 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeig
mBounds.height = aHeight;
if (mWnd) {
nsIWidget *par = GetParent();
HDWP deferrer = NULL;
if (nsnull != par) {
deferrer = ((nsWindow *)par)->mDeferredPositioner;
}
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE;
#ifndef WINCE
if (!aRepaint) {
@ -1373,15 +1338,9 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeig
}
#endif
if (NULL != deferrer) {
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
}
else {
ClearThemeRegion();
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
SetThemeRegion();
}
ClearThemeRegion();
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
SetThemeRegion();
}
if (aRepaint)
@ -2542,51 +2501,6 @@ nsIntPoint nsWindow::WidgetToScreenOffset()
return nsIntPoint(point.x, point.y);
}
/**************************************************************
*
* SECTION: Deferred window positioning.
*
* nsIWidget::BeginResizingChildren,
* nsIWidget::EndResizingChildren
*
* Filters child paint events during a resize operation.
*
**************************************************************/
NS_METHOD nsWindow::BeginResizingChildren(void)
{
if (NULL == mDeferredPositioner)
mDeferredPositioner = ::BeginDeferWindowPos(1);
return NS_OK;
}
NS_METHOD nsWindow::EndResizingChildren(void)
{
if (NULL != mDeferredPositioner) {
::EndDeferWindowPos(mDeferredPositioner);
mDeferredPositioner = NULL;
}
return NS_OK;
}
LPARAM nsWindow::lParamToScreen(LPARAM lParam)
{
POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
::ClientToScreen(mWnd, &pt);
return MAKELPARAM(pt.x, pt.y);
}
LPARAM nsWindow::lParamToClient(LPARAM lParam)
{
POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
::ScreenToClient(mWnd, &pt);
return MAKELPARAM(pt.x, pt.y);
}
/**************************************************************
*
* SECTION: nsIWidget::EnableDragDrop
@ -5698,13 +5612,6 @@ void nsWindow::OnDestroy()
mtrailer->SetCaptureWindow(nsnull);
}
// If we were in the middle of deferred window positioning then free the memory for the
// multiple-window position structure.
if (mDeferredPositioner) {
VERIFY(::EndDeferWindowPos(mDeferredPositioner));
mDeferredPositioner = NULL;
}
// Free GDI window class objects
if (mBrush) {
VERIFY(::DeleteObject(mBrush));
@ -6637,6 +6544,24 @@ PRBool nsWindow::CanTakeFocus()
return PR_FALSE;
}
LPARAM nsWindow::lParamToScreen(LPARAM lParam)
{
POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
::ClientToScreen(mWnd, &pt);
return MAKELPARAM(pt.x, pt.y);
}
LPARAM nsWindow::lParamToClient(LPARAM lParam)
{
POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
::ScreenToClient(mWnd, &pt);
return MAKELPARAM(pt.x, pt.y);
}
/**************************************************************
**************************************************************
**
@ -6688,4 +6613,4 @@ DWORD ChildWindow::WindowStyle()
style |= WS_CHILD; // WS_POPUP and WS_CHILD are mutually exclusive.
VERIFY_WINDOW_STYLE(style);
return style;
}
}

Просмотреть файл

@ -154,8 +154,6 @@ public:
NS_IMETHOD SetTitle(const nsAString& aTitle);
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
virtual nsIntPoint WidgetToScreenOffset();
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD CaptureMouse(PRBool aCapture);
@ -432,7 +430,6 @@ protected:
PRUint32 mBlurSuppressLevel;
nsContentType mContentType;
PRInt32 mMenuCmdId;
HDWP mDeferredPositioner;
DWORD_PTR mOldStyle;
DWORD_PTR mOldExStyle;
HIMC mOldIMC;