Closed Bug 769998 Opened 12 years ago Closed 12 years ago

Make nsIWidget::IsVisible return bool

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: Ms2ger, Assigned: capella)

Details

(Whiteboard: [good first bug][mentor=Ms2ger][lang=c++])

Attachments

(1 file, 2 obsolete files)

Currently, it returns an nsresult, but all implementations return NS_OK. Instead, the boolean should be returned directly; the signature should be

virtual bool IsVisible() const;

http://mxr.mozilla.org/mozilla-central/ident?i=IsVisible&tree=mozilla-central&filter=&strict=1
can i be assigned to work on this bug ?
Certainly.
Assignee: nobody → jdev005
i have never developed a patch before and i really don no how to get about it  ... can u plz help me getting started
i could meet u on irc at any time of  convenience to you
Attached patch Patch (v1) (obsolete) — Splinter Review
I talked to jdev005 through email. He's busy with other bugs so he let me take this. 

Pushed it to TRY for yucks: https://tbpl.mozilla.org/?tree=Try&rev=04b314f638e7

This is out of my normal area, so let me know of any glaring errors.
Assignee: jdev005 → markcapella
Status: NEW → ASSIGNED
Attachment #642297 - Flags: feedback?(Ms2ger)
Comment on attachment 642297 [details] [diff] [review]
Patch (v1)

Review of attachment 642297 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks! f=me with the comments below.

::: view/src/nsViewManager.cpp
@@ +446,1 @@
>        return;

Nit: the return is indented two space too much, and please keep the {}s.

::: widget/cocoa/nsChildView.mm
@@ +530,2 @@
>  {
>    NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;

Hmm, you'll need to update those.

@@ +530,5 @@
>  {
>    NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
>  
> +  if (!mVisible)
> +    return mVisible;

Keep the {}

@@ +543,3 @@
>    }
> +
> +  return outState;

I think this can be written as return ([mView window] != nil) && !NSIsEmptyRect([mView visibleRect]);.

::: widget/cocoa/nsCocoaWindow.mm
@@ +553,2 @@
>  
>    NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;

Same here

::: widget/os2/nsWindow.cpp
@@ +604,2 @@
>  {
> +  return WinIsWindowVisible(GetMainWindow()) ? true : false;

Just return WinIsWindowVisible(GetMainWindow());. Can you check if GetMainWindow() is const?

::: xpfe/appshell/src/nsXULWindow.cpp
@@ +459,3 @@
>      nsCOMPtr<nsIWidget> parentWidget;
>      parent->GetMainWidget(getter_AddRefs(parentWidget));
> +    if (parentWidget && parentWidget->IsVisible()) {

I think this should be !parentWidget || parentWidget->IsVisible() to keep the current behaviour.
Attachment #642297 - Flags: feedback?(Ms2ger) → feedback+
Attached patch Patch (v2) (obsolete) — Splinter Review
New patch attached...

>    NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
>
>Hmm, you'll need to update those.

Dang macros hide code from me ... I defaulted both occurrences to return false ... I think this is correct.


> +  return WinIsWindowVisible(GetMainWindow()) ? true : false;
>
>Just return WinIsWindowVisible(GetMainWindow());. Can you check if GetMainWindow() is const?

GetMainWindow() is not const, with signature "inline HWND nsWindow::GetMainWindow()" ... I'm curious why that might be significant?


> +    if (parentWidget && parentWidget->IsVisible()) {
>
>I think this should be !parentWidget || parentWidget->IsVisible() to keep the current behaviour.

Nice. I had wondered why the original local var was defaulted to true ... I should have looked at that longer.
Attachment #642297 - Attachment is obsolete: true
Attached patch Patch (v3)Splinter Review
Fixedup commit message, seeking review.
Attachment #642390 - Attachment is obsolete: true
Attachment #643303 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/1986d30771e9
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: