Bug 707092 - Add a null check and return proper constants on failure from GetTopLevelWindowActiveState, r=bbondy.

This commit is contained in:
Jim Mathies 2011-12-02 10:23:55 -06:00
parent 0a87853a4e
commit d58e948c0c

View File

@ -89,9 +89,11 @@ static PRInt32 GetTopLevelWindowActiveState(nsIFrame *aFrame)
// until it finds a real window.
nsIWidget* widget = aFrame->GetNearestWidget();
nsWindow * window = static_cast<nsWindow*>(widget);
if (!window)
return mozilla::widget::themeconst::FS_INACTIVE;
if (widget && !window->IsTopLevelWidget() &&
!(window = window->GetParentWindow(false)))
return false;
return mozilla::widget::themeconst::FS_INACTIVE;
if (window->GetWindowHandle() == ::GetActiveWindow())
return mozilla::widget::themeconst::FS_ACTIVE;