Bug 637864 - Give nsIViewManager::GetRootView a sane signature; r=bz

This commit is contained in:
Ms2ger
2011-03-29 22:24:54 -04:00
parent 75436b2651
commit cc1d294433
19 changed files with 59 additions and 91 deletions

View File

@@ -6386,8 +6386,8 @@ LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
if (shell) { if (shell) {
nsIViewManager* VM = shell->GetViewManager(); nsIViewManager* VM = shell->GetViewManager();
if (VM) { if (VM) {
nsIView* rootView = nsnull; nsIView* rootView = VM->GetRootView();
if (NS_SUCCEEDED(VM->GetRootView(rootView)) && rootView) { if (rootView) {
nsIView* displayRoot = GetDisplayRootFor(rootView); nsIView* displayRoot = GetDisplayRootFor(rootView);
if (displayRoot) { if (displayRoot) {
nsIWidget* widget = displayRoot->GetNearestWidget(nsnull); nsIWidget* widget = displayRoot->GetNearestWidget(nsnull);

View File

@@ -4758,8 +4758,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
// get the root view // get the root view
nsIView *view = nsnull; // views are not ref counted nsIView *view = vm->GetRootView(); // views are not ref counted
NS_ENSURE_SUCCESS(vm->GetRootView(view), NS_ERROR_FAILURE);
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
// if our root view is hidden, we are not visible // if our root view is hidden, we are not visible
@@ -7047,8 +7046,7 @@ nsDocShell::RestoreFromHistory()
if (oldPresShell) { if (oldPresShell) {
nsIViewManager *vm = oldPresShell->GetViewManager(); nsIViewManager *vm = oldPresShell->GetViewManager();
if (vm) { if (vm) {
nsIView *oldRootView = nsnull; nsIView *oldRootView = vm->GetRootView();
vm->GetRootView(oldRootView);
if (oldRootView) { if (oldRootView) {
rootViewSibling = oldRootView->GetNextSibling(); rootViewSibling = oldRootView->GetNextSibling();
@@ -7255,9 +7253,7 @@ nsDocShell::RestoreFromHistory()
nsDocShell::GetPresShell(getter_AddRefs(shell)); nsDocShell::GetPresShell(getter_AddRefs(shell));
nsIViewManager *newVM = shell ? shell->GetViewManager() : nsnull; nsIViewManager *newVM = shell ? shell->GetViewManager() : nsnull;
nsIView *newRootView = nsnull; nsIView *newRootView = newVM ? newVM->GetRootView() : nsnull;
if (newVM)
newVM->GetRootView(newRootView);
// Insert the new root view at the correct location in the view tree. // Insert the new root view at the correct location in the view tree.
if (rootViewParent) { if (rootViewParent) {
@@ -7350,7 +7346,7 @@ nsDocShell::RestoreFromHistory()
// When we insert the root view above the resulting invalidate is // When we insert the root view above the resulting invalidate is
// dropped because painting is suppressed in the presshell until we // dropped because painting is suppressed in the presshell until we
// call Thaw. So we issue the invalidate here. // call Thaw. So we issue the invalidate here.
newVM->GetRootView(newRootView); newRootView = newVM->GetRootView();
if (newRootView) { if (newRootView) {
newVM->UpdateView(newRootView, NS_VMREFRESH_NO_SYNC); newVM->UpdateView(newRootView, NS_VMREFRESH_NO_SYNC);
} }

View File

@@ -448,7 +448,6 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
appPerDev); appPerDev);
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame; event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
nsresult rv;
nsEventStatus status; nsEventStatus status;
if (aToWindow) { if (aToWindow) {
nsIPresShell* presShell = presContext->PresShell(); nsIPresShell* presShell = presContext->PresShell();
@@ -460,17 +459,14 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
nsIViewManager* viewManager = presShell->GetViewManager(); nsIViewManager* viewManager = presShell->GetViewManager();
if (!viewManager) if (!viewManager)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsIView* view = nsnull; nsIView* view = viewManager->GetRootView();
rv = viewManager->GetRootView(view); if (!view)
if (NS_FAILED(rv) || !view)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
status = nsEventStatus_eIgnore; status = nsEventStatus_eIgnore;
rv = vo->HandleEvent(view, &event, PR_FALSE, &status); return vo->HandleEvent(view, &event, PR_FALSE, &status);
} else {
rv = widget->DispatchEvent(&event, status);
} }
return rv; return widget->DispatchEvent(&event, status);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -10144,8 +10144,7 @@ nsGlobalChromeWindow::SetCursor(const nsAString& aCursor)
nsIViewManager* vm = presShell->GetViewManager(); nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
nsIView *rootView; nsIView* rootView = vm->GetRootView();
vm->GetRootView(rootView);
NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE); NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE);
nsIWidget* widget = rootView->GetNearestWidget(nsnull); nsIWidget* widget = rootView->GetNearestWidget(nsnull);

View File

@@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
* /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * The contents of this file are subject to the Mozilla Public License Version
@@ -1570,8 +1569,7 @@ ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
if (shell) { if (shell) {
nsIViewManager* vm = shell->GetViewManager(); nsIViewManager* vm = shell->GetViewManager();
if (vm) { if (vm) {
nsIView* view; nsIView* view = vm->GetRootView();
vm->GetRootView(view);
if (view) { if (view) {
nsPoint offset; nsPoint offset;
widget = view->GetNearestWidget(&offset); widget = view->GetNearestWidget(&offset);

View File

@@ -284,8 +284,7 @@ nsWidgetUtils::MouseMove(nsIDOMEvent* aDOMEvent)
if(g_lastX == MIN_INT || g_lastY == MIN_INT) if(g_lastX == MIN_INT || g_lastY == MIN_INT)
return NS_OK; return NS_OK;
nsIView *aView = nsnull; nsIView* aView = mViewManager->GetRootView();
mViewManager->GetRootView(aView);
if (!aView) if (!aView)
if (NS_FAILED(UpdateFromEvent(aDOMEvent))) if (NS_FAILED(UpdateFromEvent(aDOMEvent)))
return NS_OK; return NS_OK;

View File

@@ -2549,8 +2549,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIFrame** aNewFrame)
viewportFrame->Init(nsnull, nsnull, nsnull); viewportFrame->Init(nsnull, nsnull, nsnull);
// Bind the viewport frame to the root view // Bind the viewport frame to the root view
nsIView* rootView; nsIView* rootView = mPresShell->GetViewManager()->GetRootView();
mPresShell->GetViewManager()->GetRootView(rootView);
viewportFrame->SetView(rootView); viewportFrame->SetView(rootView);
nsContainerFrame::SyncFrameViewProperties(mPresShell->GetPresContext(), viewportFrame, nsContainerFrame::SyncFrameViewProperties(mPresShell->GetPresContext(), viewportFrame,

View File

@@ -1419,9 +1419,7 @@ DocumentViewerImpl::Open(nsISupports *aState, nsISHEntry *aSHEntry)
nsIViewManager *vm = GetViewManager(); nsIViewManager *vm = GetViewManager();
NS_ABORT_IF_FALSE(vm, "no view manager"); NS_ABORT_IF_FALSE(vm, "no view manager");
nsIView *v; nsIView* v = vm->GetRootView();
nsresult rv = vm->GetRootView(v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "failed in getting the root view");
NS_ABORT_IF_FALSE(v, "no root view"); NS_ABORT_IF_FALSE(v, "no root view");
NS_ABORT_IF_FALSE(mParentWidget, "no mParentWidget to set"); NS_ABORT_IF_FALSE(mParentWidget, "no mParentWidget to set");
v->AttachToTopLevelWidget(mParentWidget); v->AttachToTopLevelWidget(mParentWidget);
@@ -1566,8 +1564,7 @@ DocumentViewerImpl::Destroy()
if (mPresShell) { if (mPresShell) {
nsIViewManager *vm = mPresShell->GetViewManager(); nsIViewManager *vm = mPresShell->GetViewManager();
if (vm) { if (vm) {
nsIView *rootView = nsnull; nsIView *rootView = vm->GetRootView();
vm->GetRootView(rootView);
if (rootView) { if (rootView) {
// The invalidate that removing this view causes is dropped because // The invalidate that removing this view causes is dropped because
@@ -2363,8 +2360,7 @@ void
DocumentViewerImpl::DetachFromTopLevelWidget() DocumentViewerImpl::DetachFromTopLevelWidget()
{ {
if (mViewManager) { if (mViewManager) {
nsIView* oldView = nsnull; nsIView* oldView = mViewManager->GetRootView();
mViewManager->GetRootView(oldView);
if (oldView && oldView->IsAttachedToTopLevel()) { if (oldView && oldView->IsAttachedToTopLevel()) {
oldView->DetachFromTopLevelWidget(); oldView->DetachFromTopLevelWidget();
} }

View File

@@ -2436,9 +2436,8 @@ nsPresContext::IsRootContentDocument()
return PR_FALSE; return PR_FALSE;
} }
// We may not have a root frame, so use views. // We may not have a root frame, so use views.
nsIViewManager* vm = PresShell()->GetViewManager(); nsIView* view = PresShell()->GetViewManager()->GetRootView();
nsIView* view = nsnull; if (!view) {
if (NS_FAILED(vm->GetRootView(view)) || !view) {
return PR_FALSE; return PR_FALSE;
} }
view = view->GetParent(); // anonymous inner view view = view->GetParent(); // anonymous inner view

View File

@@ -4844,8 +4844,8 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
} }
#ifdef DEBUG #ifdef DEBUG
if (!mIsDestroying) { if (!mIsDestroying) {
nsIView* rootView; nsIView* rootView = mViewManager->GetRootView();
if (NS_SUCCEEDED(mViewManager->GetRootView(rootView)) && rootView) { if (rootView) {
nsRect bounds = rootView->GetBounds(); nsRect bounds = rootView->GetBounds();
NS_ASSERTION(bounds.Size() == mPresContext->GetVisibleArea().Size(), NS_ASSERTION(bounds.Size() == mPresContext->GetVisibleArea().Size(),
"root view / pres context visible size mismatch"); "root view / pres context visible size mismatch");
@@ -5906,8 +5906,8 @@ LayerManager* PresShell::GetLayerManager()
{ {
NS_ASSERTION(mViewManager, "Should have view manager"); NS_ASSERTION(mViewManager, "Should have view manager");
nsIView* rootView; nsIView* rootView = mViewManager->GetRootView();
if (NS_SUCCEEDED(mViewManager->GetRootView(rootView)) && rootView) { if (rootView) {
if (nsIWidget* widget = rootView->GetWidget()) { if (nsIWidget* widget = rootView->GetWidget()) {
return widget->GetLayerManager(); return widget->GetLayerManager();
} }
@@ -6270,8 +6270,7 @@ PresShell::RetargetEventToParent(nsGUIEvent* aEvent,
} }
// Fake the event as though it'ss from the parent pres shell's root view. // Fake the event as though it'ss from the parent pres shell's root view.
nsIView *parentRootView; nsIView *parentRootView = parentPresShell->GetViewManager()->GetRootView();
parentPresShell->GetViewManager()->GetRootView(parentRootView);
return parentViewObserver->HandleEvent(parentRootView, aEvent, PR_TRUE, aEventStatus); return parentViewObserver->HandleEvent(parentRootView, aEvent, PR_TRUE, aEventStatus);
} }
@@ -6362,10 +6361,8 @@ PresShell::HandleEvent(nsIView *aView,
if (!viewObserver) if (!viewObserver)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsIView *view; nsIView* view = presShell->GetViewManager()->GetRootView();
presShell->GetViewManager()->GetRootView(view); return viewObserver->HandleEvent(view, aEvent, PR_TRUE, aEventStatus);
nsresult rv = viewObserver->HandleEvent(view, aEvent, PR_TRUE, aEventStatus);
return rv;
} }
} }
} }
@@ -6394,8 +6391,7 @@ PresShell::HandleEvent(nsIView *aView,
// from the root views widget. This is necessary to prevent us from // from the root views widget. This is necessary to prevent us from
// dispatching the SysColorChanged notification for each child window // dispatching the SysColorChanged notification for each child window
// which may be redundant. // which may be redundant.
nsIView *view; nsIView* view = vm->GetRootView();
vm->GetRootView(view);
if (view == aView) { if (view == aView) {
*aEventStatus = nsEventStatus_eConsumeDoDefault; *aEventStatus = nsEventStatus_eConsumeDoDefault;
mPresContext->SysColorChanged(); mPresContext->SysColorChanged();
@@ -6586,8 +6582,7 @@ PresShell::HandleEvent(nsIView *aView,
nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(), nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(),
shell->GetDocument())) { shell->GetDocument())) {
shell = static_cast<PresShell*>(activeShell); shell = static_cast<PresShell*>(activeShell);
nsIView* activeShellRootView; nsIView* activeShellRootView = shell->GetViewManager()->GetRootView();
shell->GetViewManager()->GetRootView(activeShellRootView);
frame = static_cast<nsIFrame*>(activeShellRootView->GetClientData()); frame = static_cast<nsIFrame*>(activeShellRootView->GetClientData());
} }
} }
@@ -6596,8 +6591,7 @@ PresShell::HandleEvent(nsIView *aView,
// Handle the event in the correct shell. // Handle the event in the correct shell.
// Prevent deletion until we're done with event handling (bug 336582). // Prevent deletion until we're done with event handling (bug 336582).
nsCOMPtr<nsIPresShell> kungFuDeathGrip(shell); nsCOMPtr<nsIPresShell> kungFuDeathGrip(shell);
nsIView* subshellRootView; nsIView* subshellRootView = shell->GetViewManager()->GetRootView();
shell->GetViewManager()->GetRootView(subshellRootView);
// We pass the subshell's root view as the view to start from. This is // We pass the subshell's root view as the view to start from. This is
// the only correct alternative; if the event was captured then it // the only correct alternative; if the event was captured then it
// must have been captured by us or some ancestor shell and we // must have been captured by us or some ancestor shell and we
@@ -6663,8 +6657,7 @@ PresShell::HandleEvent(nsIView *aView,
nsIPresShell* shell = targetDoc->GetShell(); nsIPresShell* shell = targetDoc->GetShell();
nsCOMPtr<nsIViewObserver> vo = do_QueryInterface(shell); nsCOMPtr<nsIViewObserver> vo = do_QueryInterface(shell);
if (vo) { if (vo) {
nsIView* root = nsnull; nsIView* root = shell->GetViewManager()->GetRootView();
shell->GetViewManager()->GetRootView(root);
rv = static_cast<PresShell*>(shell)->HandleRetargetedEvent(aEvent, rv = static_cast<PresShell*>(shell)->HandleRetargetedEvent(aEvent,
root, root,
aEventStatus, aEventStatus,
@@ -7850,8 +7843,7 @@ PresShell::DoVerifyReflow()
if (GetVerifyReflowEnable()) { if (GetVerifyReflowEnable()) {
// First synchronously render what we have so far so that we can // First synchronously render what we have so far so that we can
// see it. // see it.
nsIView* rootView; nsIView* rootView = mViewManager->GetRootView();
mViewManager->GetRootView(rootView);
mViewManager->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE); mViewManager->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
FlushPendingNotifications(Flush_Layout); FlushPendingNotifications(Flush_Layout);
@@ -8495,8 +8487,7 @@ PresShell::VerifyIncrementalReflow()
NS_ENSURE_SUCCESS(rv, PR_FALSE); NS_ENSURE_SUCCESS(rv, PR_FALSE);
// Get our scrolling preference // Get our scrolling preference
nsIView* rootView; nsIView* rootView = mViewManager->GetRootView();
mViewManager->GetRootView(rootView);
NS_ENSURE_TRUE(rootView->HasWidget(), PR_FALSE); NS_ENSURE_TRUE(rootView->HasWidget(), PR_FALSE);
nsIWidget* parentWidget = rootView->GetWidget(); nsIWidget* parentWidget = rootView->GetWidget();

View File

@@ -475,8 +475,7 @@ nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
return; return;
nsIViewManager* vm = aView->GetViewManager(); nsIViewManager* vm = aView->GetViewManager();
nsIView* rootView; nsIView* rootView = vm->GetRootView();
vm->GetRootView(rootView);
if (aView != rootView) if (aView != rootView)
return; return;

View File

@@ -1546,8 +1546,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
// Update the view immediately (make drag appear snappier) // Update the view immediately (make drag appear snappier)
nsIViewManager* vm = aPresContext->GetPresShell()->GetViewManager(); nsIViewManager* vm = aPresContext->GetPresShell()->GetViewManager();
if (vm) { if (vm) {
nsIView* root; nsIView* root = vm->GetRootView();
vm->GetRootView(root);
if (root) { if (root) {
vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE); vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE);
} }

View File

@@ -3537,9 +3537,8 @@ DumpViews(nsIDocShell* aDocShell, FILE* out)
if (shell) { if (shell) {
nsIViewManager* vm = shell->GetViewManager(); nsIViewManager* vm = shell->GetViewManager();
if (vm) { if (vm) {
nsIView* root; nsIView* root = vm->GetRootView();
vm->GetRootView(root); if (root) {
if (nsnull != root) {
root->List(out); root->List(out);
} }
} }

View File

@@ -475,9 +475,8 @@ DumpViewsRecur(nsIDocShell* aDocShell, FILE* out)
fprintf(out, "docshell=%p \n", static_cast<void*>(aDocShell)); fprintf(out, "docshell=%p \n", static_cast<void*>(aDocShell));
nsCOMPtr<nsIViewManager> vm(view_manager(aDocShell)); nsCOMPtr<nsIViewManager> vm(view_manager(aDocShell));
if (vm) { if (vm) {
nsIView* root; nsIView* root = vm->GetRootView();
vm->GetRootView(root); if (root) {
if (nsnull != root) {
root->List(out); root->List(out);
} }
} }
@@ -568,8 +567,7 @@ void nsLayoutDebuggingTools::ForceRefresh()
nsCOMPtr<nsIViewManager> vm(view_manager(mDocShell)); nsCOMPtr<nsIViewManager> vm(view_manager(mDocShell));
if (!vm) if (!vm)
return; return;
nsIView* root = nsnull; nsIView* root = vm->GetRootView();
vm->GetRootView(root);
if (root) { if (root) {
vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE); vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE);
} }

View File

@@ -1869,7 +1869,7 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
// Create a view // Create a view
if (aIsPopup) { if (aIsPopup) {
viewManager->GetRootView(parentView); parentView = viewManager->GetRootView();
visibility = nsViewVisibility_kHide; visibility = nsViewVisibility_kHide;
zIndex = PR_INT32_MAX; zIndex = PR_INT32_MAX;
} }

View File

@@ -49,9 +49,9 @@ class nsRegion;
class nsIDeviceContext; class nsIDeviceContext;
class nsIViewObserver; class nsIViewObserver;
#define NS_IVIEWMANAGER_IID \ #define NS_IVIEWMANAGER_IID \
{ 0x4017112c, 0x64d7, 0x47bc, \ { 0xa47cdaf9, 0x50fd, 0x40d8, \
{ 0xab, 0x66, 0x4e, 0x5f, 0xff, 0x83, 0xec, 0x7c } } { 0x92, 0xe5, 0x93, 0x4f, 0xfb, 0x01, 0xdd, 0x98 } }
class nsIViewManager : public nsISupports class nsIViewManager : public nsISupports
{ {
@@ -86,7 +86,7 @@ public:
* Get the root of the view tree. * Get the root of the view tree.
* @result the root view * @result the root view
*/ */
NS_IMETHOD GetRootView(nsIView *&aView) = 0; NS_IMETHOD_(nsIView*) GetRootView() = 0;
/** /**
* Set the root of the view tree. Does not destroy the current root view. * Set the root of the view tree. Does not destroy the current root view.

View File

@@ -240,7 +240,7 @@ nsView::~nsView()
{ {
DropMouseGrabbing(); DropMouseGrabbing();
nsView *rootView = mViewManager->GetRootView(); nsView *rootView = mViewManager->GetRootViewImpl();
if (rootView) if (rootView)
{ {
@@ -446,7 +446,7 @@ void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
PRBool aInvalidateChangedSize) { PRBool aInvalidateChangedSize) {
// The geometry of a root view's widget is controlled externally, // The geometry of a root view's widget is controlled externally,
// NOT by sizing or positioning the view // NOT by sizing or positioning the view
if (mViewManager->GetRootView() == this) { if (mViewManager->GetRootViewImpl() == this) {
return; return;
} }
@@ -568,7 +568,7 @@ NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView)
void nsView::InvalidateHierarchy(nsViewManager *aViewManagerParent) void nsView::InvalidateHierarchy(nsViewManager *aViewManagerParent)
{ {
if (mViewManager->GetRootView() == this) if (mViewManager->GetRootViewImpl() == this)
mViewManager->InvalidateHierarchy(); mViewManager->InvalidateHierarchy();
for (nsView *child = mFirstChild; child; child = child->GetNextSibling()) for (nsView *child = mFirstChild; child; child = child->GetNextSibling())
@@ -601,7 +601,7 @@ void nsView::InsertChild(nsView *aChild, nsView *aSibling)
// on all view managers in the new subtree. // on all view managers in the new subtree.
nsViewManager *vm = aChild->GetViewManager(); nsViewManager *vm = aChild->GetViewManager();
if (vm->GetRootView() == aChild) if (vm->GetRootViewImpl() == aChild)
{ {
aChild->InvalidateHierarchy(nsnull); // don't care about releasing grabs aChild->InvalidateHierarchy(nsnull); // don't care about releasing grabs
} }
@@ -637,7 +637,7 @@ void nsView::RemoveChild(nsView *child)
// on all view managers in the removed subtree. // on all view managers in the removed subtree.
nsViewManager *vm = child->GetViewManager(); nsViewManager *vm = child->GetViewManager();
if (vm->GetRootView() == child) if (vm->GetRootViewImpl() == child)
{ {
child->InvalidateHierarchy(GetViewManager()); child->InvalidateHierarchy(GetViewManager());
} }
@@ -1142,7 +1142,7 @@ nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset, const PRInt32 aAPD) const
PRBool nsIView::IsRoot() const PRBool nsIView::IsRoot() const
{ {
NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()"); NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()");
return mViewManager->GetRootView() == this; return mViewManager->GetRootViewImpl() == this;
} }
PRBool nsIView::ExternalIsRoot() const PRBool nsIView::ExternalIsRoot() const
@@ -1176,7 +1176,7 @@ nsView::GetBoundsInParentUnits() const
{ {
nsView* parent = GetParent(); nsView* parent = GetParent();
nsViewManager* VM = GetViewManager(); nsViewManager* VM = GetViewManager();
if (this != VM->GetRootView() || !parent) { if (this != VM->GetRootViewImpl() || !parent) {
return mDimBounds; return mDimBounds;
} }
PRInt32 ourAPD = VM->AppUnitsPerDevPixel(); PRInt32 ourAPD = VM->AppUnitsPerDevPixel();

View File

@@ -242,10 +242,10 @@ nsViewManager::CreateView(const nsRect& aBounds,
return v; return v;
} }
NS_IMETHODIMP nsViewManager::GetRootView(nsIView *&aView) NS_IMETHODIMP_(nsIView*)
nsViewManager::GetRootView()
{ {
aView = mRootView; return mRootView;
return NS_OK;
} }
NS_IMETHODIMP nsViewManager::SetRootView(nsIView *aView) NS_IMETHODIMP nsViewManager::SetRootView(nsIView *aView)
@@ -659,7 +659,7 @@ ShouldIgnoreInvalidation(nsViewManager* aVM)
if (vo && vo->ShouldIgnoreInvalidation()) { if (vo && vo->ShouldIgnoreInvalidation()) {
return PR_TRUE; return PR_TRUE;
} }
nsView* view = aVM->GetRootView()->GetParent(); nsView* view = aVM->GetRootViewImpl()->GetParent();
aVM = view ? view->GetViewManager() : nsnull; aVM = view ? view->GetViewManager() : nsnull;
} }
return PR_FALSE; return PR_FALSE;

View File

@@ -106,7 +106,7 @@ public:
const nsIView* aParent, const nsIView* aParent,
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow); nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
NS_IMETHOD GetRootView(nsIView *&aView); NS_IMETHOD_(nsIView*) GetRootView();
NS_IMETHOD SetRootView(nsIView *aView); NS_IMETHOD SetRootView(nsIView *aView);
NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height); NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height);
@@ -253,7 +253,7 @@ private:
nsresult UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags); nsresult UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
public: // NOT in nsIViewManager, so private to the view module public: // NOT in nsIViewManager, so private to the view module
nsView* GetRootView() const { return mRootView; } nsView* GetRootViewImpl() const { return mRootView; }
nsViewManager* RootViewManager() const { return mRootViewManager; } nsViewManager* RootViewManager() const { return mRootViewManager; }
PRBool IsRootVM() const { return this == RootViewManager(); } PRBool IsRootVM() const { return this == RootViewManager(); }