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

This commit is contained in:
Ms2ger 2011-03-29 22:24:54 -04:00
Родитель 26459abbb2
Коммит 4b1168a59f
19 изменённых файлов: 59 добавлений и 91 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -49,9 +49,9 @@ class nsRegion;
class nsIDeviceContext;
class nsIViewObserver;
#define NS_IVIEWMANAGER_IID \
{ 0x4017112c, 0x64d7, 0x47bc, \
{ 0xab, 0x66, 0x4e, 0x5f, 0xff, 0x83, 0xec, 0x7c } }
#define NS_IVIEWMANAGER_IID \
{ 0xa47cdaf9, 0x50fd, 0x40d8, \
{ 0x92, 0xe5, 0x93, 0x4f, 0xfb, 0x01, 0xdd, 0x98 } }
class nsIViewManager : public nsISupports
{
@ -86,7 +86,7 @@ public:
* Get the root of the view tree.
* @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.

Просмотреть файл

@ -240,7 +240,7 @@ nsView::~nsView()
{
DropMouseGrabbing();
nsView *rootView = mViewManager->GetRootView();
nsView *rootView = mViewManager->GetRootViewImpl();
if (rootView)
{
@ -446,7 +446,7 @@ void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
PRBool aInvalidateChangedSize) {
// The geometry of a root view's widget is controlled externally,
// NOT by sizing or positioning the view
if (mViewManager->GetRootView() == this) {
if (mViewManager->GetRootViewImpl() == this) {
return;
}
@ -568,7 +568,7 @@ NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView)
void nsView::InvalidateHierarchy(nsViewManager *aViewManagerParent)
{
if (mViewManager->GetRootView() == this)
if (mViewManager->GetRootViewImpl() == this)
mViewManager->InvalidateHierarchy();
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.
nsViewManager *vm = aChild->GetViewManager();
if (vm->GetRootView() == aChild)
if (vm->GetRootViewImpl() == aChild)
{
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.
nsViewManager *vm = child->GetViewManager();
if (vm->GetRootView() == child)
if (vm->GetRootViewImpl() == child)
{
child->InvalidateHierarchy(GetViewManager());
}
@ -1142,7 +1142,7 @@ nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset, const PRInt32 aAPD) const
PRBool nsIView::IsRoot() const
{
NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()");
return mViewManager->GetRootView() == this;
return mViewManager->GetRootViewImpl() == this;
}
PRBool nsIView::ExternalIsRoot() const
@ -1176,7 +1176,7 @@ nsView::GetBoundsInParentUnits() const
{
nsView* parent = GetParent();
nsViewManager* VM = GetViewManager();
if (this != VM->GetRootView() || !parent) {
if (this != VM->GetRootViewImpl() || !parent) {
return mDimBounds;
}
PRInt32 ourAPD = VM->AppUnitsPerDevPixel();

Просмотреть файл

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

Просмотреть файл

@ -106,7 +106,7 @@ public:
const nsIView* aParent,
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
NS_IMETHOD GetRootView(nsIView *&aView);
NS_IMETHOD_(nsIView*) GetRootView();
NS_IMETHOD SetRootView(nsIView *aView);
NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height);
@ -253,7 +253,7 @@ private:
nsresult UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
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; }
PRBool IsRootVM() const { return this == RootViewManager(); }