Closed
Bug 284695
Opened 20 years ago
Closed 20 years ago
Move GetMainWidget() to nsGlobalWindow, and do some random code cleanup
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: jst, Assigned: jst)
Details
Attachments
(2 files)
13.33 KB,
patch
|
Details | Diff | Splinter Review | |
12.53 KB,
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
There's one place in nsGlobalWindow that could use GetMainWidget(), so that
should be moved from nsGlobalChromeWindow to nsGlobalWindow. And while I was
staring at this code I found a few other minor things to clean up, and a warning
to quiet down... Patch coming up.
Assignee | ||
Comment 1•20 years ago
|
||
Assignee | ||
Comment 2•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #176211 -
Flags: superreview?(peterv)
Attachment #176211 -
Flags: review?(peterv)
Comment 3•20 years ago
|
||
Comment on attachment 176211 [details] [diff] [review]
Fix (diff -w for review).
>Index: dom/src/base/nsGlobalWindow.cpp
>===================================================================
>@@ -3476,63 +3483,58 @@ nsGlobalWindow::Close()
>+ // UniversalBrowserWrite will be enabled if it's been explicityl
explicitly
> if (stringBundleService) {
> nsCOMPtr<nsIStringBundle> stringBundle;
>- rv = stringBundleService->CreateBundle(
>- kDOMSecurityWarningsBundleURL,
>+ rv = stringBundleService->CreateBundle(kDOMSecurityWarningsBundleURL,
> getter_AddRefs(stringBundle));
>- if (NS_SUCCEEDED(rv) && stringBundle) {
>+ if (stringBundle) {
No need to set rv to the result of CreateBundle, you're not using it anymore.
> NS_IMETHODIMP
> nsGlobalChromeWindow::Maximize()
> {
>- nsCOMPtr<nsIWidget> widget;
>- nsresult rv = GetMainWidget(getter_AddRefs(widget));
>+ nsCOMPtr<nsIWidget> widget = GetMainWidget();
>
> if (widget) {
>- rv = widget->SetSizeMode(nsSizeMode_Maximized);
>+ widget->SetSizeMode(nsSizeMode_Maximized);
> }
>
>- return rv;
>+ return NS_OK;
Don't we want to propagate the error here?
> }
>
> NS_IMETHODIMP
> nsGlobalChromeWindow::Minimize()
> {
>- nsCOMPtr<nsIWidget> widget;
>- nsresult rv = GetMainWidget(getter_AddRefs(widget));
>+ nsCOMPtr<nsIWidget> widget = GetMainWidget();
>
> if (widget) {
> // minimize doesn't send deactivate events on windows,
> // so we need to forcefully restore the os chrome
> nsCOMPtr<nsIFullScreen> fullScreen =
> do_GetService("@mozilla.org/browser/fullscreen;1");
> if (fullScreen)
> fullScreen->ShowAllOSChrome();
>
>- rv = widget->SetSizeMode(nsSizeMode_Minimized);
>+ widget->SetSizeMode(nsSizeMode_Minimized);
> }
>
>- return rv;
>+ return NS_OK;
Or here?
> }
>
> NS_IMETHODIMP
> nsGlobalChromeWindow::Restore()
> {
>- nsCOMPtr<nsIWidget> widget;
>- nsresult rv = GetMainWidget(getter_AddRefs(widget));
>+ nsCOMPtr<nsIWidget> widget = GetMainWidget();
>
> if (widget) {
>- rv = widget->SetSizeMode(nsSizeMode_Normal);
>+ widget->SetSizeMode(nsSizeMode_Normal);
> }
>
>- return rv;
>+ return NS_OK;
Or here?
> }
>
> NS_IMETHODIMP
> nsGlobalChromeWindow::GetAttention()
> {
> return GetAttentionWithCycleCount(-1);
> }
>
> NS_IMETHODIMP
> nsGlobalChromeWindow::GetAttentionWithCycleCount(PRInt32 aCycleCount)
> {
>- nsCOMPtr<nsIWidget> widget;
>- nsresult rv = GetMainWidget(getter_AddRefs(widget));
>+ nsCOMPtr<nsIWidget> widget = GetMainWidget();
>
> if (widget) {
>- rv = widget->GetAttention(aCycleCount);
>+ widget->GetAttention(aCycleCount);
> }
>
>- return rv;
>+ return NS_OK;
Or here?
Attachment #176211 -
Flags: superreview?(peterv)
Attachment #176211 -
Flags: superreview+
Attachment #176211 -
Flags: review?(peterv)
Attachment #176211 -
Flags: review+
Assignee | ||
Comment 4•20 years ago
|
||
Sure, changed all that :)
FIXED.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•