зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1325234 (part 3) - Streamline nsIWidget::Show(). r=mstange.
This patch changes it from |NS_IMETHOD| to |virtual void|. The return value was only checked in one low-value assertion and one other place where the check had no useful effect (in nsCocoaWindow::HideWindowChrome()). --HG-- extra : rebase_source : f6671e9e0e10ee18fb32f8b1c83f1e64c3d97e67
This commit is contained in:
Родитель
e2d9e4ed68
Коммит
da5978a842
|
@ -477,8 +477,7 @@ CompositorBridgeChild::RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint
|
|||
widget->Enable(isVisible);
|
||||
|
||||
// visible state - updated after clipping, prior to invalidating
|
||||
rv = widget->Show(isVisible);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
|
||||
widget->Show(isVisible);
|
||||
|
||||
// Handle invalidation, this can be costly, avoid if it is not needed.
|
||||
if (isVisible) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
nsNativeWidget aNativeParent,
|
||||
const DesktopIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override { return NS_OK; }
|
||||
NS_IMETHOD Show(bool aState) override { return NS_OK; }
|
||||
virtual void Show(bool aState) override {}
|
||||
virtual bool IsVisible() const override { return true; }
|
||||
virtual void Move(double aX, double aY) override {}
|
||||
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override {}
|
||||
|
|
|
@ -190,7 +190,7 @@ PuppetWidget::Destroy()
|
|||
mTabChild = nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PuppetWidget::Show(bool aState)
|
||||
{
|
||||
NS_ASSERTION(mEnabled,
|
||||
|
@ -216,8 +216,6 @@ PuppetWidget::Show(bool aState)
|
|||
Resize(mBounds.width, mBounds.height, false);
|
||||
Invalidate(mBounds);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
virtual void Destroy() override;
|
||||
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
virtual void Show(bool aState) override;
|
||||
|
||||
virtual bool IsVisible() const override
|
||||
{ return mVisible; }
|
||||
|
|
|
@ -1677,18 +1677,18 @@ nsWindow::GetDefaultScaleInternal()
|
|||
return screenAndroid->GetDensity();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Show(bool aState)
|
||||
{
|
||||
ALOG("nsWindow[%p]::Show %d", (void*)this, aState);
|
||||
|
||||
if (mWindowType == eWindowType_invisible) {
|
||||
ALOG("trying to show invisible window! ignoring..");
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (aState == mIsVisible)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
mIsVisible = aState;
|
||||
|
||||
|
@ -1724,8 +1724,6 @@ nsWindow::Show(bool aState)
|
|||
#ifdef DEBUG_ANDROID_WIDGET
|
||||
DumpWindows();
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
virtual nsIWidget *GetParent(void) override;
|
||||
virtual float GetDPI() override;
|
||||
virtual double GetDefaultScaleInternal() override;
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
virtual void Show(bool aState) override;
|
||||
virtual bool IsVisible() const override;
|
||||
virtual void ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
|
|
|
@ -308,7 +308,7 @@ public:
|
|||
|
||||
virtual void Destroy() override;
|
||||
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
virtual void Show(bool aState) override;
|
||||
virtual bool IsVisible() const override;
|
||||
|
||||
virtual void SetParent(nsIWidget* aNewParent) override;
|
||||
|
|
|
@ -717,9 +717,10 @@ ManipulateViewWithoutNeedingDisplay(NSView* aView, void (^aCallback)())
|
|||
}
|
||||
|
||||
// Hide or show this component
|
||||
NS_IMETHODIMP nsChildView::Show(bool aState)
|
||||
void
|
||||
nsChildView::Show(bool aState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (aState != mVisible) {
|
||||
// Provide an autorelease pool because this gets called during startup
|
||||
|
@ -733,9 +734,8 @@ NS_IMETHODIMP nsChildView::Show(bool aState)
|
|||
|
||||
mVisible = aState;
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
// Change the parent of this widget
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
|
||||
virtual void Destroy() override;
|
||||
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
virtual void Show(bool aState) override;
|
||||
virtual nsIWidget* GetSheetWindowParent(void) override;
|
||||
virtual void Enable(bool aState) override;
|
||||
virtual bool IsEnabled() const override;
|
||||
|
|
|
@ -733,21 +733,22 @@ nsCocoaWindow::IsRunningAppModal()
|
|||
}
|
||||
|
||||
// Hide or show this window
|
||||
NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
void
|
||||
nsCocoaWindow::Show(bool bState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (!mWindow)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// We need to re-execute sometimes in order to bring already-visible
|
||||
// windows forward.
|
||||
if (!mSheetNeedsShow && !bState && ![mWindow isVisible])
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// Protect against re-entering.
|
||||
if (bState && [mWindow isBeingShown])
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
[mWindow setBeingShown:bState];
|
||||
|
||||
|
@ -760,7 +761,7 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
|||
// Don't try to show a popup when the parent isn't visible or is minimized.
|
||||
if (mWindowType == eWindowType_popup && nativeParentWindow) {
|
||||
if (![nativeParentWindow isVisible] || [nativeParentWindow isMiniaturized]) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -772,7 +773,7 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
|||
if (mWindowType == eWindowType_sheet) {
|
||||
// bail if no parent window (its basically what we do in Carbon)
|
||||
if (!nativeParentWindow || !piParentWidget)
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
NSWindow* topNonSheetWindow = nativeParentWindow;
|
||||
|
||||
|
@ -983,9 +984,7 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
|||
|
||||
[mWindow setBeingShown:NO];
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
struct ShadowParams {
|
||||
|
@ -1338,9 +1337,8 @@ nsCocoaWindow::HideWindowChrome(bool aShouldHide)
|
|||
if (isVisible) {
|
||||
bool wasAnimationSuppressed = mIsAnimationSuppressed;
|
||||
mIsAnimationSuppressed = true;
|
||||
rv = Show(true);
|
||||
Show(true);
|
||||
mIsAnimationSuppressed = wasAnimationSuppressed;
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
|
|
|
@ -345,20 +345,23 @@ nsWindow::Destroy()
|
|||
nsBaseWidget::OnDestroy();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Show(bool aState)
|
||||
{
|
||||
if (mWindowType == eWindowType_invisible) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mVisible == aState) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
mVisible = aState;
|
||||
if (!IS_TOPLEVEL()) {
|
||||
return mParent ? mParent->Show(aState) : NS_OK;
|
||||
if (mParent) {
|
||||
mParent->Show(aState);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (aState) {
|
||||
|
@ -375,8 +378,6 @@ nsWindow::Show(bool aState)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
nsWidgetInitData* aInitData) override;
|
||||
virtual void Destroy();
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
virtual void Show(bool aState);
|
||||
virtual bool IsVisible() const;
|
||||
virtual void Move(double aX,
|
||||
double aY);
|
||||
|
|
|
@ -1062,11 +1062,11 @@ void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints)
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Show(bool aState)
|
||||
{
|
||||
if (aState == mIsShown)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// Clear our cached resources when the window is hidden.
|
||||
if (mIsShown && !aState) {
|
||||
|
@ -1089,7 +1089,7 @@ nsWindow::Show(bool aState)
|
|||
if ((aState && !AreBoundsSane()) || !mCreated) {
|
||||
LOG(("\tbounds are insane or window hasn't been created yet\n"));
|
||||
mNeedsShow = true;
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// If someone is hiding this widget, clear any needing show flag.
|
||||
|
@ -1102,8 +1102,6 @@ nsWindow::Show(bool aState)
|
|||
#endif
|
||||
|
||||
NativeShow(aState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
||||
virtual void Move(double aX,
|
||||
double aY) override;
|
||||
NS_IMETHOD Show (bool aState) override;
|
||||
virtual void Show (bool aState) override;
|
||||
virtual void Resize (double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
|
|
|
@ -636,7 +636,7 @@ class nsIWidget : public nsISupports
|
|||
* @param aState true to show the Widget, false to hide it
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Show(bool aState) = 0;
|
||||
virtual void Show(bool aState) = 0;
|
||||
|
||||
/**
|
||||
* Make the window modal.
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
nsWidgetInitData* aInitData = nullptr)
|
||||
override;
|
||||
virtual void Destroy() override;
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
virtual void Show(bool aState) override;
|
||||
virtual void Enable(bool aState) override {}
|
||||
virtual bool IsEnabled() const override {
|
||||
return true;
|
||||
|
|
|
@ -558,7 +558,7 @@ nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& config)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Show(bool aState)
|
||||
{
|
||||
if (aState != mVisible) {
|
||||
|
@ -570,7 +570,6 @@ nsWindow::Show(bool aState)
|
|||
}
|
||||
mVisible = aState;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1420,7 +1420,8 @@ nsWindow::GetFallbackScrollSnapshot(const RECT& aRequiredClip)
|
|||
*
|
||||
**************************************************************/
|
||||
|
||||
NS_IMETHODIMP nsWindow::Show(bool bState)
|
||||
void
|
||||
nsWindow::Show(bool bState)
|
||||
{
|
||||
if (mWindowType == eWindowType_popup) {
|
||||
// See bug 603793. When we try to draw D3D9/10 windows with a drop shadow
|
||||
|
@ -1535,7 +1536,7 @@ NS_IMETHODIMP nsWindow::Show(bool bState)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (!wasVisible && bState) {
|
||||
Invalidate();
|
||||
|
@ -1544,8 +1545,6 @@ NS_IMETHODIMP nsWindow::Show(bool bState)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
|
|
|
@ -119,7 +119,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHOD Show(bool bState) override;
|
||||
virtual void Show(bool aState) override;
|
||||
virtual bool IsVisible() const override;
|
||||
virtual void ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY) override;
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче