mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 769998 - Make nsIWidget::IsVisible return bool, r=roc, f=ms2ger
This commit is contained in:
parent
2e09b6b8d9
commit
bf92974758
@ -1626,10 +1626,7 @@ AccessibleWrap::GetHWNDFor(Accessible* aAccessible)
|
||||
nsIFrame* frame = aAccessible->GetFrame();
|
||||
if (frame) {
|
||||
nsIWidget* widget = frame->GetNearestWidget();
|
||||
if (widget) {
|
||||
bool isVisible = false;
|
||||
widget->IsVisible(isVisible);
|
||||
if (isVisible) {
|
||||
if (widget && widget->IsVisible()) {
|
||||
nsIPresShell* shell = document->PresShell();
|
||||
nsIViewManager* vm = shell->GetViewManager();
|
||||
if (vm) {
|
||||
@ -1643,7 +1640,6 @@ AccessibleWrap::GetHWNDFor(Accessible* aAccessible)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<HWND>(document->GetNativeWindow());
|
||||
}
|
||||
|
@ -3873,7 +3873,7 @@ CheckForDisabledWindows()
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
baseWin->GetMainWidget(getter_AddRefs(widget));
|
||||
if (widget && !widget->GetParent() &&
|
||||
NS_SUCCEEDED(widget->IsVisible(aFlag)) && aFlag == true &&
|
||||
widget->IsVisible() &&
|
||||
NS_SUCCEEDED(widget->IsEnabled(&aFlag)) && aFlag == false) {
|
||||
nsIWidget * child = widget->GetFirstChild();
|
||||
bool enable = true;
|
||||
|
@ -646,17 +646,13 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent,
|
||||
// where we can't shut down because an invisible window is open. If
|
||||
// someone tries to do this, throw.
|
||||
if (!hasChromeParent && (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)) {
|
||||
bool parentVisible = true;
|
||||
nsCOMPtr<nsIBaseWindow> parentWindow(do_GetInterface(parentTreeOwner));
|
||||
nsCOMPtr<nsIWidget> parentWidget;
|
||||
if (parentWindow)
|
||||
parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
|
||||
if (parentWidget)
|
||||
parentWidget->IsVisible(parentVisible);
|
||||
if (!parentVisible) {
|
||||
if (parentWidget && !parentWidget->IsVisible())
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(mWindowCreator,
|
||||
"attempted to open a new window with no WindowCreator");
|
||||
|
@ -442,10 +442,7 @@ nsViewManager::InvalidateWidgetArea(nsView *aWidgetView,
|
||||
#endif
|
||||
|
||||
// If the widget is hidden, it don't cover nothing
|
||||
if (widget) {
|
||||
bool visible;
|
||||
widget->IsVisible(visible);
|
||||
if (!visible)
|
||||
if (widget && !widget->IsVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -466,11 +463,9 @@ nsViewManager::InvalidateWidgetArea(nsView *aWidgetView,
|
||||
childWidget = childWidget->GetNextSibling()) {
|
||||
nsView* view = nsView::GetViewFor(childWidget);
|
||||
NS_ASSERTION(view != aWidgetView, "will recur infinitely");
|
||||
bool visible;
|
||||
childWidget->IsVisible(visible);
|
||||
nsWindowType type;
|
||||
childWidget->GetWindowType(type);
|
||||
if (view && visible && type != eWindowType_popup) {
|
||||
if (view && childWidget->IsVisible() && type != eWindowType_popup) {
|
||||
NS_ASSERTION(type == eWindowType_plugin,
|
||||
"Only plugin or popup widgets can be children!");
|
||||
|
||||
|
@ -384,11 +384,10 @@ nsWindow::SetModal(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::IsVisible(bool& aState)
|
||||
bool
|
||||
nsWindow::IsVisible() const
|
||||
{
|
||||
aState = mIsVisible;
|
||||
return NS_OK;
|
||||
return mIsVisible;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
virtual float GetDPI();
|
||||
NS_IMETHOD Show(bool aState);
|
||||
NS_IMETHOD SetModal(bool aModal);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
PRInt32 *aX,
|
||||
PRInt32 *aY);
|
||||
|
@ -395,7 +395,7 @@ public:
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
NS_IMETHOD IsVisible(bool& outState);
|
||||
virtual bool IsVisible() const;
|
||||
|
||||
NS_IMETHOD SetParent(nsIWidget* aNewParent);
|
||||
virtual nsIWidget* GetParent(void);
|
||||
|
@ -526,26 +526,20 @@ void nsChildView::SetTransparencyMode(nsTransparencyMode aMode)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::IsVisible(bool& outState)
|
||||
bool nsChildView::IsVisible() const
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
if (!mVisible) {
|
||||
outState = mVisible;
|
||||
return mVisible;
|
||||
}
|
||||
else {
|
||||
|
||||
// mVisible does not accurately reflect the state of a hidden tabbed view
|
||||
// so verify that the view has a window as well
|
||||
outState = ([mView window] != nil);
|
||||
// now check native widget hierarchy visibility
|
||||
if (outState && NSIsEmptyRect([mView visibleRect])) {
|
||||
outState = false;
|
||||
}
|
||||
}
|
||||
// then check native widget hierarchy visibility
|
||||
return ([mView window] != nil) && !NSIsEmptyRect([mView visibleRect]);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
void nsChildView::HidePlugin()
|
||||
@ -976,9 +970,7 @@ NS_IMETHODIMP nsChildView::GetPluginClipRect(nsIntRect& outClipRect, nsIntPoint&
|
||||
outOrigin.x = -NSToIntRound(viewOrigin.x);
|
||||
outOrigin.y = -NSToIntRound(viewOrigin.y);
|
||||
|
||||
bool isVisible;
|
||||
IsVisible(isVisible);
|
||||
if (isVisible && [mView window] != nil) {
|
||||
if (IsVisible() && [mView window] != nil) {
|
||||
outClipRect.width = NSToIntRound(visibleBounds.origin.x + visibleBounds.size.width) - NSToIntRound(visibleBounds.origin.x);
|
||||
outClipRect.height = NSToIntRound(visibleBounds.origin.y + visibleBounds.size.height) - NSToIntRound(visibleBounds.origin.y);
|
||||
|
||||
@ -2484,9 +2476,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
|
||||
{
|
||||
SAMPLE_LABEL("widget", "ChildView::drawRect");
|
||||
bool isVisible;
|
||||
if (!mGeckoChild || NS_FAILED(mGeckoChild->IsVisible(isVisible)) ||
|
||||
!isVisible)
|
||||
if (!mGeckoChild || !mGeckoChild->IsVisible())
|
||||
return;
|
||||
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
|
@ -214,7 +214,7 @@ public:
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
NS_IMETHOD IsEnabled(bool *aState);
|
||||
NS_IMETHOD SetModal(bool aState);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD SetFocus(bool aState=false);
|
||||
virtual nsIntPoint WidgetToScreenOffset();
|
||||
virtual nsIntPoint GetClientOffset();
|
||||
|
@ -545,14 +545,13 @@ void* nsCocoaWindow::GetNativeData(PRUint32 aDataType)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSNULL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::IsVisible(bool & aState)
|
||||
bool nsCocoaWindow::IsVisible() const
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
aState = (mWindow && ([mWindow isVisible] || mSheetNeedsShow));
|
||||
return NS_OK;
|
||||
return (mWindow && ([mWindow isVisible] || mSheetNeedsShow));
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
|
@ -319,11 +319,10 @@ nsWindow::Show(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::IsVisible(bool & aState)
|
||||
bool
|
||||
nsWindow::IsVisible() const
|
||||
{
|
||||
aState = mVisible;
|
||||
return NS_OK;
|
||||
return mVisible;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
NS_IMETHOD Destroy(void);
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
PRInt32 *aX,
|
||||
PRInt32 *aY);
|
||||
|
@ -908,11 +908,10 @@ nsWindow::SetModal(bool aModal)
|
||||
}
|
||||
|
||||
// nsIWidget method, which means IsShown.
|
||||
NS_IMETHODIMP
|
||||
nsWindow::IsVisible(bool& aState)
|
||||
bool
|
||||
nsWindow::IsVisible() const
|
||||
{
|
||||
aState = mIsShown;
|
||||
return NS_OK;
|
||||
return mIsShown;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
virtual float GetDPI();
|
||||
virtual nsresult SetParent(nsIWidget* aNewParent);
|
||||
NS_IMETHOD SetModal(bool aModal);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
PRInt32 *aX,
|
||||
PRInt32 *aY);
|
||||
|
@ -609,7 +609,7 @@ class nsIWidget : public nsISupports {
|
||||
* Returns whether the window is visible
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsVisible(bool & aState) = 0;
|
||||
virtual bool IsVisible() const = 0;
|
||||
|
||||
/**
|
||||
* Perform platform-dependent sanity check on a potential window position.
|
||||
|
@ -585,9 +585,7 @@ NS_METHOD nsWindow::Show(bool aState)
|
||||
// don't try to show new windows (e.g. the Bookmark menu)
|
||||
// during a native dragover because they'll remain invisible;
|
||||
if (CheckDragStatus(ACTION_SHOW, 0)) {
|
||||
bool isVisible;
|
||||
IsVisible(isVisible);
|
||||
if (!isVisible) {
|
||||
if (!IsVisible()) {
|
||||
PlaceBehind(eZPlacementTop, 0, false);
|
||||
}
|
||||
WinShowWindow(mWnd, true);
|
||||
@ -602,10 +600,9 @@ NS_METHOD nsWindow::Show(bool aState)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWindow::IsVisible(bool& aState)
|
||||
bool nsWindow::IsVisible() const
|
||||
{
|
||||
aState = WinIsWindowVisible(GetMainWindow()) ? true : false;
|
||||
return NS_OK;
|
||||
return WinIsWindowVisible(GetMainWindow());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
NS_IMETHOD IsEnabled(bool* aState);
|
||||
NS_IMETHOD Show(bool aState);
|
||||
NS_IMETHOD IsVisible(bool& aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD SetFocus(bool aRaise);
|
||||
NS_IMETHOD Invalidate(const nsIntRect& aRect);
|
||||
gfxASurface* GetThebesSurface();
|
||||
|
@ -475,11 +475,10 @@ nsWindow::SetModal(bool aModal)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::IsVisible(bool & aState)
|
||||
bool
|
||||
nsWindow::IsVisible() const
|
||||
{
|
||||
aState = mIsShown;
|
||||
return NS_OK;
|
||||
return mIsShown;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
virtual float GetDPI();
|
||||
NS_IMETHOD Show(bool aState);
|
||||
NS_IMETHOD SetModal(bool aModal);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
PRInt32 *aX,
|
||||
PRInt32 *aY);
|
||||
|
@ -1190,10 +1190,9 @@ NS_METHOD nsWindow::Show(bool bState)
|
||||
**************************************************************/
|
||||
|
||||
// Return true if the whether the component is visible, false otherwise
|
||||
NS_METHOD nsWindow::IsVisible(bool & bState)
|
||||
bool nsWindow::IsVisible() const
|
||||
{
|
||||
bState = mIsVisible;
|
||||
return NS_OK;
|
||||
return mIsVisible;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
virtual nsIWidget* GetParent(void);
|
||||
virtual float GetDPI();
|
||||
NS_IMETHOD Show(bool bState);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop, PRInt32 *aX, PRInt32 *aY);
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
|
@ -64,8 +64,9 @@ public:
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
NS_IMETHOD IsVisible(bool& aState)
|
||||
{ aState = mVisible; return NS_OK; }
|
||||
|
||||
virtual bool IsVisible() const
|
||||
{ return mVisible; }
|
||||
|
||||
NS_IMETHOD ConstrainPosition(bool /*ignored aAllowSlop*/,
|
||||
PRInt32* aX,
|
||||
|
@ -456,12 +456,9 @@ NS_IMETHODIMP nsXULWindow::Destroy()
|
||||
// only if the parent is visible.
|
||||
nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
|
||||
if (parent) {
|
||||
bool parentVisible = true;
|
||||
nsCOMPtr<nsIWidget> parentWidget;
|
||||
parent->GetMainWidget(getter_AddRefs(parentWidget));
|
||||
if (parentWidget)
|
||||
parentWidget->IsVisible(parentVisible);
|
||||
if (parentVisible) {
|
||||
if (!parentWidget || parentWidget->IsVisible()) {
|
||||
nsCOMPtr<nsIBaseWindow> baseHiddenWindow;
|
||||
if (appShell) {
|
||||
nsCOMPtr<nsIXULWindow> hiddenWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user