From 616220b0c8f0ac0eaee5eb2dcc71a805fd507129 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 5 Jan 2013 16:13:23 +1300 Subject: [PATCH] Bug 826632. Part 7: nsView::GetViewManagerInternal is no longer relevant, so remove it. r=tnikkel --HG-- extra : rebase_source : ee90c4205d54efc1a7fa248a60d82fa51a07f19a --- view/public/nsView.h | 4 +--- view/src/nsView.cpp | 30 +++++++++++++++--------------- view/src/nsViewManager.cpp | 30 +++++++++++++++--------------- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/view/public/nsView.h b/view/public/nsView.h index 42ae807d3526..9e2d9f02c728 100644 --- a/view/public/nsView.h +++ b/view/public/nsView.h @@ -68,9 +68,7 @@ public: * view manager from somewhere else, do that instead. * @result the view manager */ - nsViewManager* GetViewManager() const - { return reinterpret_cast(mViewManager); } - nsViewManager* GetViewManagerInternal() const { return mViewManager; } + nsViewManager* GetViewManager() const { return mViewManager; } /** * Find the view for the given widget, if there is one. diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index fc54bee54f03..a2dc372a6fdb 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -379,7 +379,7 @@ void nsView::InsertChild(nsView *aChild, nsView *aSibling) // If we just inserted a root view, then update the RootViewManager // on all view managers in the new subtree. - nsViewManager *vm = aChild->GetViewManagerInternal(); + nsViewManager *vm = aChild->GetViewManager(); if (vm->GetRootView() == aChild) { aChild->InvalidateHierarchy(nullptr); // don't care about releasing grabs @@ -415,10 +415,10 @@ void nsView::RemoveChild(nsView *child) // If we just removed a root view, then update the RootViewManager // on all view managers in the removed subtree. - nsViewManager *vm = child->GetViewManagerInternal(); + nsViewManager *vm = child->GetViewManager(); if (vm->GetRootView() == child) { - child->InvalidateHierarchy(GetViewManagerInternal()); + child->InvalidateHierarchy(GetViewManager()); } } } @@ -736,7 +736,7 @@ void nsView::List(FILE* out, int32_t aIndent) const nsPoint nsView::GetOffsetTo(const nsView* aOther) const { - return GetOffsetTo(aOther, GetViewManagerInternal()->AppUnitsPerDevPixel()); + return GetOffsetTo(aOther, GetViewManager()->AppUnitsPerDevPixel()); } nsPoint nsView::GetOffsetTo(const nsView* aOther, const int32_t aAPD) const @@ -749,11 +749,11 @@ nsPoint nsView::GetOffsetTo(const nsView* aOther, const int32_t aAPD) const // The offset currently accumulated at the current APD nsPoint docOffset(0, 0); const nsView* v = this; - nsViewManager* currVM = v->GetViewManagerInternal(); + nsViewManager* currVM = v->GetViewManager(); int32_t currAPD = currVM->AppUnitsPerDevPixel(); const nsView* root = nullptr; for ( ; v != aOther && v; root = v, v = v->GetParent()) { - nsViewManager* newVM = v->GetViewManagerInternal(); + nsViewManager* newVM = v->GetViewManager(); if (newVM != currVM) { int32_t newAPD = newVM->AppUnitsPerDevPixel(); if (newAPD != currAPD) { @@ -799,15 +799,15 @@ nsPoint nsView::GetOffsetToWidget(nsIWidget* aWidget) const pt += widgetView->ViewToWidgetOffset(); // Convert to our appunits. - int32_t widgetAPD = widgetView->GetViewManagerInternal()->AppUnitsPerDevPixel(); - int32_t ourAPD = GetViewManagerInternal()->AppUnitsPerDevPixel(); + int32_t widgetAPD = widgetView->GetViewManager()->AppUnitsPerDevPixel(); + int32_t ourAPD = GetViewManager()->AppUnitsPerDevPixel(); pt = pt.ConvertAppUnits(widgetAPD, ourAPD); return pt; } nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset) const { - return GetNearestWidget(aOffset, GetViewManagerInternal()->AppUnitsPerDevPixel()); + return GetNearestWidget(aOffset, GetViewManager()->AppUnitsPerDevPixel()); } nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset, const int32_t aAPD) const @@ -820,10 +820,10 @@ nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset, const int32_t aAPD) const // The offset currently accumulated at the current APD nsPoint docPt(0,0); const nsView* v = this; - nsViewManager* currVM = v->GetViewManagerInternal(); + nsViewManager* currVM = v->GetViewManager(); int32_t currAPD = currVM->AppUnitsPerDevPixel(); for ( ; v && !v->HasWidget(); v = v->GetParent()) { - nsViewManager* newVM = v->GetViewManagerInternal(); + nsViewManager* newVM = v->GetViewManager(); if (newVM != currVM) { int32_t newAPD = newVM->AppUnitsPerDevPixel(); if (newAPD != currAPD) { @@ -863,12 +863,12 @@ nsRect nsView::GetBoundsInParentUnits() const { nsView* parent = GetParent(); - nsViewManager* VM = GetViewManagerInternal(); + nsViewManager* VM = GetViewManager(); if (this != VM->GetRootView() || !parent) { return mDimBounds; } int32_t ourAPD = VM->AppUnitsPerDevPixel(); - int32_t parentAPD = parent->GetViewManagerInternal()->AppUnitsPerDevPixel(); + int32_t parentAPD = parent->GetViewManager()->AppUnitsPerDevPixel(); return mDimBounds.ConvertAppUnitsRoundOut(ourAPD, parentAPD); } @@ -877,8 +877,8 @@ nsView::ConvertFromParentCoords(nsPoint aPt) const { const nsView* parent = GetParent(); if (parent) { - aPt = aPt.ConvertAppUnits(parent->GetViewManagerInternal()->AppUnitsPerDevPixel(), - GetViewManagerInternal()->AppUnitsPerDevPixel()); + aPt = aPt.ConvertAppUnits(parent->GetViewManager()->AppUnitsPerDevPixel(), + GetViewManager()->AppUnitsPerDevPixel()); } aPt -= GetPosition(); return aPt; diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 9c39b195f032..f743de0f77b7 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -264,8 +264,8 @@ static nsRegion ConvertRegionBetweenViews(const nsRegion& aIn, nsRegion out = aIn; out.MoveBy(aFromView->GetOffsetTo(aToView)); out = out.ConvertAppUnitsRoundOut( - aFromView->GetViewManagerInternal()->AppUnitsPerDevPixel(), - aToView->GetViewManagerInternal()->AppUnitsPerDevPixel()); + aFromView->GetViewManager()->AppUnitsPerDevPixel(), + aToView->GetViewManager()->AppUnitsPerDevPixel()); return out; } @@ -396,7 +396,7 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView, // have a delayed resize to handle. for (nsViewManager *vm = this; vm; vm = vm->mRootView->GetParent() - ? vm->mRootView->GetParent()->GetViewManagerInternal() + ? vm->mRootView->GetParent()->GetViewManager() : nullptr) { if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) && vm->mRootView->IsEffectivelyVisible() && @@ -441,7 +441,7 @@ void nsViewManager::FlushDirtyRegionToWidget(nsView* aView) } nsRegion r = ConvertRegionBetweenViews(*dirtyRegion, aView, nearestViewWithWidget); - nsViewManager* widgetVM = nearestViewWithWidget->GetViewManagerInternal(); + nsViewManager* widgetVM = nearestViewWithWidget->GetViewManager(); widgetVM->InvalidateWidgetArea(nearestViewWithWidget, r); dirtyRegion->SetEmpty(); } @@ -564,7 +564,7 @@ ShouldIgnoreInvalidation(nsViewManager* aVM) return true; } nsView* view = aVM->GetRootView()->GetParent(); - aVM = view ? view->GetViewManagerInternal() : nullptr; + aVM = view ? view->GetViewManager() : nullptr; } return false; } @@ -596,7 +596,7 @@ nsViewManager::InvalidateViewNoSuppression(nsView *aView, } nsView* displayRoot = GetDisplayRootFor(aView); - nsViewManager* displayRootVM = displayRoot->GetViewManagerInternal(); + nsViewManager* displayRootVM = displayRoot->GetViewManager(); // Propagate the update to the displayRoot, since iframes, for example, // can overlap each other and be translucent. So we have to possibly // invalidate our rect in each of the widgets we have lying about. @@ -628,7 +628,7 @@ void nsViewManager::InvalidateViews(nsView *aView) // Invalidate all children as well. nsView* childView = aView->GetFirstChild(); while (nullptr != childView) { - childView->GetViewManagerInternal()->InvalidateViews(childView); + childView->GetViewManager()->InvalidateViews(childView); childView = childView->GetNextSibling(); } } @@ -640,7 +640,7 @@ void nsViewManager::WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint) // have a delayed resize to handle. for (nsViewManager *vm = this; vm; vm = vm->mRootView->GetParent() - ? vm->mRootView->GetParent()->GetViewManagerInternal() + ? vm->mRootView->GetParent()->GetViewManager() : nullptr) { if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) && vm->mRootView->IsEffectivelyVisible() && @@ -889,7 +889,7 @@ nsViewManager::InsertChild(nsView *aParent, nsView *aChild, nsView *aSibling, //and mark this area as dirty if the view is visible... if (nsViewVisibility_kHide != aChild->GetVisibility()) - aChild->GetViewManagerInternal()->InvalidateView(aChild); + aChild->GetViewManager()->InvalidateView(aChild); } } @@ -912,7 +912,7 @@ nsViewManager::RemoveChild(nsView *aChild) if (nullptr != parent) { NS_ASSERTION(aChild->GetViewManager() == this || parent->GetViewManager() == this, "wrong view manager"); - aChild->GetViewManagerInternal()->InvalidateView(aChild); + aChild->GetViewManager()->InvalidateView(aChild); parent->RemoveChild(aChild); } } @@ -931,7 +931,7 @@ nsViewManager::MoveViewTo(nsView *aView, nscoord aX, nscoord aY) if (aView->GetVisibility() != nsViewVisibility_kHide) { nsView* parentView = aView->GetParent(); if (parentView) { - nsViewManager* parentVM = parentView->GetViewManagerInternal(); + nsViewManager* parentVM = parentView->GetViewManager(); parentVM->InvalidateView(parentView, oldBounds); parentVM->InvalidateView(parentView, aView->GetBoundsInParentUnits()); } @@ -988,7 +988,7 @@ nsViewManager::ResizeView(nsView *aView, const nsRect &aRect, bool aRepaintExpos } nsRect oldBounds = aView->GetBoundsInParentUnits(); aView->SetDimensions(aRect, true); - nsViewManager* parentVM = parentView->GetViewManagerInternal(); + nsViewManager* parentVM = parentView->GetViewManager(); if (!aRepaintExposedAreaOnly) { // Invalidate the union of the old and new size InvalidateView(aView, aRect); @@ -1029,7 +1029,7 @@ nsViewManager::SetViewVisibility(nsView *aView, nsViewVisibility aVisible) if (nsViewVisibility_kHide == aVisible) { nsView* parentView = aView->GetParent(); if (parentView) { - parentView->GetViewManagerInternal()-> + parentView->GetViewManager()-> InvalidateView(parentView, aView->GetBoundsInParentUnits()); } } @@ -1126,7 +1126,7 @@ nsViewManager::GetRootWidget(nsIWidget **aWidget) return; } if (mRootView->GetParent()) { - mRootView->GetParent()->GetViewManagerInternal()->GetRootWidget(aWidget); + mRootView->GetParent()->GetViewManager()->GetRootWidget(aWidget); return; } *aWidget = nullptr; @@ -1224,7 +1224,7 @@ nsViewManager::InvalidateHierarchy() } nsView *parent = mRootView->GetParent(); if (parent) { - mRootViewManager = parent->GetViewManagerInternal()->RootViewManager(); + mRootViewManager = parent->GetViewManager()->RootViewManager(); NS_ADDREF(mRootViewManager); NS_ASSERTION(mRootViewManager != this, "Root view had a parent, but it has the same view manager");