33 * License, v. 2.0. If a copy of the MPL was not distributed with this
44 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55
6- #include " nsAutoPtr.h"
76#include " nsViewManager.h"
7+
8+ #include " mozilla/MouseEvents.h"
9+ #include " mozilla/PresShell.h"
10+ #include " mozilla/Preferences.h"
11+ #include " mozilla/StartupTimeline.h"
12+ #include " mozilla/dom/Document.h"
13+ #include " nsAutoPtr.h"
814#include " nsGfxCIID.h"
915#include " nsView.h"
1016#include " nsCOMPtr.h"
11- #include " mozilla/MouseEvents.h"
1217#include " nsRegion.h"
1318#include " nsCOMArray.h"
1419#include " nsIPluginWidget.h"
1520#include " nsXULPopupManager.h"
16- #include " nsIPresShell.h"
1721#include " nsIPresShellInlines.h"
1822#include " nsPresContext.h"
19- #include " mozilla/StartupTimeline.h"
2023#include " GeckoProfiler.h"
2124#include " nsRefreshDriver.h"
22- #include " mozilla/Preferences.h"
2325#include " nsContentUtils.h" // for nsAutoScriptBlocker
2426#include " nsLayoutUtils.h"
2527#include " Layers.h"
2628#include " gfxPlatform.h"
2729#include " gfxPrefs.h"
28- #include " mozilla/dom/Document.h"
2930
3031/* *
3132 XXX TODO XXX
@@ -178,9 +179,9 @@ void nsViewManager::DoSetWindowDimensions(nscoord aWidth, nscoord aHeight) {
178179 if (!oldDim.IsEqualEdges (newDim)) {
179180 // Don't resize the widget. It is already being set elsewhere.
180181 mRootView ->SetDimensions (newDim, true , false );
181- if (mPresShell )
182- mPresShell ->ResizeReflow (aWidth, aHeight, oldDim.Width (),
183- oldDim. Height ());
182+ if (RefPtr<PresShell> presShell = mPresShell ) {
183+ presShell ->ResizeReflow (aWidth, aHeight, oldDim.Width (), oldDim. Height ());
184+ }
184185 }
185186}
186187
@@ -363,7 +364,7 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
363364 return ;
364365 }
365366
366- nsCOMPtr<nsIPresShell> rootShell ( mPresShell ) ;
367+ RefPtr<PresShell> rootPresShell = mPresShell ;
367368 AutoTArray<nsCOMPtr<nsIWidget>, 1 > widgets;
368369 aView->GetViewManager ()->ProcessPendingUpdatesRecurse (aView, widgets);
369370 for (uint32_t i = 0 ; i < widgets.Length (); ++i) {
@@ -372,8 +373,8 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
372373 if (view->mNeedsWindowPropertiesSync ) {
373374 view->mNeedsWindowPropertiesSync = false ;
374375 if (nsViewManager* vm = view->GetViewManager ()) {
375- if (nsIPresShell* ps = vm->GetPresShell ()) {
376- ps ->SyncWindowProperties (view);
376+ if (PresShell* presShell = vm->GetPresShell ()) {
377+ presShell ->SyncWindowProperties (view);
377378 }
378379 }
379380 }
@@ -383,7 +384,7 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
383384 view->ResetWidgetBounds (false , true );
384385 }
385386 }
386- if (rootShell ->GetViewManager () != this ) {
387+ if (rootPresShell ->GetViewManager () != this ) {
387388 return ; // presentation might have been torn down
388389 }
389390 if (aFlushDirtyRegion) {
@@ -589,8 +590,8 @@ void nsViewManager::InvalidateWidgetArea(nsView* aWidgetView,
589590
590591static bool ShouldIgnoreInvalidation (nsViewManager* aVM) {
591592 while (aVM) {
592- nsIPresShell* shell = aVM->GetPresShell ();
593- if (!shell || shell ->ShouldIgnoreInvalidation ()) {
593+ PresShell* presShell = aVM->GetPresShell ();
594+ if (!presShell || presShell ->ShouldIgnoreInvalidation ()) {
594595 return true ;
595596 }
596597 nsView* view = aVM->GetRootView ()->GetParent ();
@@ -673,9 +674,8 @@ void nsViewManager::WillPaintWindow(nsIWidget* aWidget) {
673674 }
674675 }
675676
676- nsCOMPtr<nsIPresShell> shell = mPresShell ;
677- if (shell) {
678- shell->WillPaintWindow ();
677+ if (RefPtr<PresShell> presShell = mPresShell ) {
678+ presShell->WillPaintWindow ();
679679 }
680680}
681681
@@ -698,9 +698,8 @@ bool nsViewManager::PaintWindow(nsIWidget* aWidget,
698698}
699699
700700void nsViewManager::DidPaintWindow () {
701- nsCOMPtr<nsIPresShell> shell = mPresShell ;
702- if (shell) {
703- shell->DidPaintWindow ();
701+ if (RefPtr<PresShell> presShell = mPresShell ) {
702+ presShell->DidPaintWindow ();
704703 }
705704}
706705
@@ -750,9 +749,8 @@ void nsViewManager::DispatchEvent(WidgetGUIEvent* aEvent, nsView* aView,
750749 // Hold a refcount to the presshell. The continued existence of the
751750 // presshell will delay deletion of this view hierarchy should the event
752751 // want to cause its destruction in, say, some JavaScript event handler.
753- nsCOMPtr<nsIPresShell> shell = view->GetViewManager ()->GetPresShell ();
754- if (shell) {
755- shell->HandleEvent (frame, aEvent, false , aStatus);
752+ if (RefPtr<PresShell> presShell = view->GetViewManager ()->GetPresShell ()) {
753+ presShell->HandleEvent (frame, aEvent, false , aStatus);
756754 return ;
757755 }
758756 }
@@ -1049,9 +1047,8 @@ void nsViewManager::CallWillPaintOnObservers() {
10491047 if (vm->RootViewManager () == this ) {
10501048 // One of our kids.
10511049 if (vm->mRootView && vm->mRootView ->IsEffectivelyVisible ()) {
1052- nsCOMPtr<nsIPresShell> shell = vm->GetPresShell ();
1053- if (shell) {
1054- shell->WillPaint ();
1050+ if (RefPtr<PresShell> presShell = vm->GetPresShell ()) {
1051+ presShell->WillPaint ();
10551052 }
10561053 }
10571054 }
0 commit comments