Bug 452385 Bookmark This Page panel hangs Firefox when -moz-border-radius is used r=ere, sr=vlad

This commit is contained in:
Masayuki Nakano 2008-09-10 02:22:12 +09:00
Родитель 60f6886e85
Коммит bfdfb7624f
2 изменённых файлов: 56 добавлений и 25 удалений

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

@ -429,6 +429,10 @@ static PRBool is_vk_down(int vk)
#endif // #ifndef APPCOMMAND_BROWSER_BACKWARD
#define VERIFY_WINDOW_STYLE(s) \
NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
"WS_POPUP and WS_CHILD are mutually exclusive")
/* This object maintains a correlation between attention timers and the
windows to which they belong. It's lighter than a hashtable (expected usage
is really just one at a time) and allows nsWindow::GetNSWindowPtr
@ -542,21 +546,21 @@ private:
static nsAttentionTimerMonitor *gAttentionTimerMonitor = 0;
HWND nsWindow::GetTopLevelHWND(HWND aWnd, PRBool aStopOnFirstTopLevel)
HWND nsWindow::GetTopLevelHWND(HWND aWnd, PRBool aStopOnDialogOrPopup)
{
HWND curWnd = aWnd;
HWND topWnd = NULL;
while (curWnd)
{
while (curWnd) {
topWnd = curWnd;
#ifndef WINCE
if (aStopOnFirstTopLevel)
{
if (aStopOnDialogOrPopup) {
DWORD style = ::GetWindowLongW(curWnd, GWL_STYLE);
if (!(style & WS_CHILDWINDOW)) // first top-level window
VERIFY_WINDOW_STYLE(style);
if (!(style & WS_CHILD)) // first top-level window
break;
}
#endif
@ -1516,18 +1520,18 @@ NS_IMETHODIMP nsWindow::SetParent(nsIWidget *aNewParent)
//-------------------------------------------------------------------------
nsIWidget* nsWindow::GetParent(void)
{
return GetParent(PR_TRUE);
return GetParentWindow();
}
// XXX does anyone pass false for aStopOnFirstTopLevel?
nsWindow* nsWindow::GetParent(PRBool aStopOnFirstTopLevel)
nsWindow* nsWindow::GetParentWindow()
{
if (mIsTopWidgetWindow && aStopOnFirstTopLevel) {
if (mIsTopWidgetWindow) {
// Must use a flag instead of mWindowType to tell if the window is the
// owned by the topmost widget, because a child window can be embedded inside
// a HWND which is not associated with a nsIWidget.
return nsnull;
}
// If this widget has already been destroyed, pretend we have no parent.
// This corresponds to code in Destroy which removes the destroyed
// widget from its parent's child list.
@ -2626,6 +2630,7 @@ NS_IMETHODIMP nsWindow::HideWindowChrome(PRBool aShouldHide)
exStyle = mOldExStyle;
}
VERIFY_WINDOW_STYLE(style);
::SetWindowLongW(hwnd, GWL_STYLE, style);
::SetWindowLongW(hwnd, GWL_EXSTYLE, exStyle);
@ -5548,6 +5553,7 @@ DWORD nsWindow::WindowStyle()
if (mBorderStyle == eBorderStyle_none || !(mBorderStyle & eBorderStyle_title)) {
style &= ~WS_DLGFRAME;
style |= WS_POPUP;
style &= ~WS_CHILD;
}
if (mBorderStyle == eBorderStyle_none || !(mBorderStyle & eBorderStyle_close))
@ -5573,6 +5579,7 @@ DWORD nsWindow::WindowStyle()
style &= ~WS_MAXIMIZEBOX;
}
#endif // WINCE
VERIFY_WINDOW_STYLE(style);
return style;
}
@ -5963,7 +5970,7 @@ static PRBool IsTopLevelMouseExit(HWND aWnd)
// GetTopLevelHWND will return a HWND for the window frame (which includes
// the non-client area). If the mouse has moved into the non-client area,
// we should treat it as a top-level exit.
HWND mouseTopLevel = nsWindow::GetTopLevelHWND(mouseWnd, false);
HWND mouseTopLevel = nsWindow::GetTopLevelHWND(mouseWnd);
if (mouseWnd == mouseTopLevel)
return PR_TRUE;
@ -6335,7 +6342,11 @@ PRBool ChildWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, LPARA
//-------------------------------------------------------------------------
DWORD ChildWindow::WindowStyle()
{
return WS_CHILD | WS_CLIPCHILDREN | nsWindow::WindowStyle();
DWORD style = WS_CLIPCHILDREN | nsWindow::WindowStyle();
if (!(style & WS_POPUP))
style |= WS_CHILD; // WS_POPUP and WS_CHILD are mutually exclusive.
VERIFY_WINDOW_STYLE(style);
return style;
}
NS_METHOD nsWindow::SetTitle(const nsAString& aTitle)
@ -7159,7 +7170,9 @@ PRBool nsWindow::OnIMEQueryCharPosition(LPARAM aData, LRESULT *oResult)
}
nsRect screenRect;
ResolveIMECaretPos(GetTopLevelWindow(), r, nsnull, screenRect);
// We always need top level window that is owner window of the popup window
// even if the content of the popup window has focus.
ResolveIMECaretPos(GetTopLevelWindow(PR_FALSE), r, nsnull, screenRect);
pCharPosition->pt.x = screenRect.x;
pCharPosition->pt.y = screenRect.y;
@ -7986,18 +7999,25 @@ STDMETHODIMP_(LRESULT) nsWindow::LresultFromObject(REFIID riid, WPARAM wParam, L
#ifdef MOZ_XUL
nsWindow* nsWindow::GetTopLevelWindow()
nsWindow* nsWindow::GetTopLevelWindow(PRBool aStopOnDialogOrPopup)
{
nsWindow* curWindow = this;
while (PR_TRUE)
{
nsWindow* parentWindow = curWindow->GetParent(PR_TRUE);
while (PR_TRUE) {
if (aStopOnDialogOrPopup) {
switch (curWindow->mWindowType) {
case eWindowType_dialog:
case eWindowType_popup:
return curWindow;
}
}
if (parentWindow)
curWindow = parentWindow;
else
nsWindow* parentWindow = curWindow->GetParentWindow();
if (!parentWindow)
return curWindow;
curWindow = parentWindow;
}
}
@ -8020,12 +8040,12 @@ void nsWindow::ResizeTranslucentWindow(PRInt32 aNewWidth, PRInt32 aNewHeight, PR
nsTransparencyMode nsWindow::GetTransparencyMode()
{
return GetTopLevelWindow()->GetWindowTranslucencyInner();
return GetTopLevelWindow(PR_TRUE)->GetWindowTranslucencyInner();
}
void nsWindow::SetTransparencyMode(nsTransparencyMode aMode)
{
GetTopLevelWindow()->SetWindowTranslucencyInner(aMode);
GetTopLevelWindow(PR_TRUE)->SetWindowTranslucencyInner(aMode);
}
void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
@ -8055,6 +8075,7 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
topWindow->mTransparencyMode = aMode;
break;
}
VERIFY_WINDOW_STYLE(style);
::SetWindowLongW(hWnd, GWL_STYLE, style);
::SetWindowLongW(hWnd, GWL_EXSTYLE, exStyle);

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

@ -211,7 +211,12 @@ public:
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
NS_IMETHOD GetLastInputEventTime(PRUint32& aTime);
nsWindow* GetTopLevelWindow();
// Note that the result of GetTopLevelWindow method can be different from the
// result of GetTopLevelHWND method. The result can be non-floating window.
// Because our top level window may be contained in another window which is
// not managed by us.
nsWindow* GetTopLevelWindow(PRBool aStopOnDialogOrPopup);
gfxASurface *GetThebesSurface();
@ -287,7 +292,7 @@ protected:
static nsWindow* GetNSWindowPtr(HWND aWnd);
static BOOL SetNSWindowPtr(HWND aWnd, nsWindow * ptr);
nsWindow* GetParent(PRBool aStopOnFirstTopLevel);
nsWindow* GetParentWindow();
void DispatchPendingEvents();
virtual PRBool ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue);
@ -520,7 +525,12 @@ protected:
public:
static void GlobalMsgWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static HWND GetTopLevelHWND(HWND aWnd, PRBool aStopOnFirstTopLevel = PR_FALSE);
// Note that the result of GetTopLevelHWND can be different from the result
// of GetTopLevelWindow method. Because this is checking whether the window
// is top level only in Win32 window system. Therefore, the result window
// may not be managed by us.
static HWND GetTopLevelHWND(HWND aWnd,
PRBool aStopOnDialogOrPopup = PR_FALSE);
};
//