From e58dd0c2e08d9d1baf50e10bba258006e2caa7d7 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 19 Aug 2010 19:03:20 -0500 Subject: [PATCH] Backed out changeset 5452db293694 --- view/public/nsIView.h | 4 --- view/src/nsView.cpp | 63 +++++++++++++++---------------------------- view/src/nsView.h | 9 ------- 3 files changed, 21 insertions(+), 55 deletions(-) diff --git a/view/public/nsIView.h b/view/public/nsIView.h index 5dc34c6b6ec..e9690cb2bc2 100644 --- a/view/public/nsIView.h +++ b/view/public/nsIView.h @@ -396,10 +396,6 @@ protected: PRBool mWidgetIsTopLevel; virtual ~nsIView() {} - -private: - nsView* Impl(); - const nsView* Impl() const; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIView, NS_IVIEW_IID) diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index ff58451b2fc..151d45f4f73 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -394,7 +394,7 @@ nsIntRect nsIView::CalcWidgetBounds(nsWindowType aType) nsRect viewBounds(mDimBounds); - nsView* parent = GetParent()->Impl(); + nsView* parent = static_cast(GetParent()); if (parent) { nsPoint offset; nsIWidget* parentWidget = parent->GetNearestWidget(&offset, p2a); @@ -665,19 +665,6 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID, PRBool aResetVisibility, nsContentType aContentType, nsIWidget* aParentWidget) -{ - return Impl()->CreateWidget(aWindowIID, aWidgetInitData, aNative, - aEnableDragDrop, aResetVisibility, - aContentType, aParentWidget); -} - -nsresult nsView::CreateWidget(const nsIID &aWindowIID, - nsWidgetInitData *aWidgetInitData, - nsNativeWidget aNative, - PRBool aEnableDragDrop, - PRBool aResetVisibility, - nsContentType aContentType, - nsIWidget* aParentWidget) { if (NS_UNLIKELY(mWindow)) { NS_ERROR("We already have a window for this view? BAD"); @@ -688,11 +675,13 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID, NS_RELEASE(mWindow); } - nsIntRect trect = CalcWidgetBounds(aWidgetInitData - ? aWidgetInitData->mWindowType - : eWindowType_child); + nsView* v = static_cast(this); - if (NS_OK == LoadWidget(aWindowIID)) + nsIntRect trect = v->CalcWidgetBounds(aWidgetInitData + ? aWidgetInitData->mWindowType + : eWindowType_child); + + if (NS_OK == v->LoadWidget(aWindowIID)) { PRBool usewidgets; nsCOMPtr dx; @@ -747,7 +736,7 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID, } // propagate the z-index to the widget. - UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this)); + UpdateNativeWidgetZIndexes(v, FindNonAutoZIndex(v)); } else { // We should tell the widget its size even if we don't create a // native widget. (At the moment, this doesn't really matter, @@ -760,7 +749,7 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID, //make sure visibility state is accurate if (aResetVisibility) { - SetVisibility(GetVisibility()); + v->SetVisibility(GetVisibility()); } return NS_OK; @@ -789,7 +778,8 @@ nsresult nsIView::AttachToTopLevelWidget(nsIWidget* aWidget) mWindow = aWidget; NS_ADDREF(mWindow); - ViewWrapper* wrapper = new ViewWrapper(Impl()); + nsView* v = static_cast(this); + ViewWrapper* wrapper = new ViewWrapper(v); NS_ADDREF(wrapper); mWindow->SetAttachedViewPtr(wrapper); mWindow->EnableDragDrop(PR_TRUE); @@ -863,7 +853,8 @@ EVENT_CALLBACK nsIView::AttachWidgetEventHandler(nsIWidget* aWidget) NS_ASSERTION(!data, "Already got client data"); #endif - ViewWrapper* wrapper = new ViewWrapper(Impl()); + nsView* v = static_cast(this); + ViewWrapper* wrapper = new ViewWrapper(v); if (!wrapper) return nsnull; NS_ADDREF(wrapper); // Will be released in DetachWidgetEventHandler @@ -917,8 +908,9 @@ void nsIView::List(FILE* out, PRInt32 aIndent) const nsPoint nsIView::GetOffsetTo(const nsIView* aOther) const { - return Impl()->GetOffsetTo(static_cast(aOther), - Impl()->GetViewManager()->AppUnitsPerDevPixel()); + const nsView* view = static_cast(this); + return view->GetOffsetTo(static_cast(aOther), + view->GetViewManager()->AppUnitsPerDevPixel()); } nsPoint nsView::GetOffsetTo(const nsView* aOther) const @@ -966,12 +958,10 @@ nsPoint nsIView::GetOffsetToWidget(nsIWidget* aWidget) const { nsPoint pt; // Get the view for widget - nsIView* widgetIView = GetViewFor(aWidget); - if (!widgetIView) { + nsView* widgetView = static_cast(GetViewFor(aWidget)); + if (!widgetView) { return pt; } - nsView* widgetView = widgetIView->Impl(); - // Get the offset to the widget view in the widget view's APD // We get the offset in the widget view's APD first and then convert to our // APD afterwards so that we can include the widget view's ViewToWidgetOffset @@ -993,8 +983,9 @@ nsPoint nsIView::GetOffsetToWidget(nsIWidget* aWidget) const nsIWidget* nsIView::GetNearestWidget(nsPoint* aOffset) const { - return Impl()->GetNearestWidget(aOffset, - Impl()->GetViewManager()->AppUnitsPerDevPixel()); + const nsView* view = static_cast(this); + return view->GetNearestWidget(aOffset, + view->GetViewManager()->AppUnitsPerDevPixel()); } nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset) const @@ -1065,18 +1056,6 @@ nsIView::SetDeletionObserver(nsWeakView* aDeletionObserver) mDeletionObserver = aDeletionObserver; } -nsView* -nsIView::Impl() -{ - return static_cast(this); -} - -const nsView* -nsIView::Impl() const -{ - return static_cast(this); -} - nsRect nsView::GetBoundsInParentUnits() const { diff --git a/view/src/nsView.h b/view/src/nsView.h index ae4db7c8350..2db3f556ac1 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -117,15 +117,6 @@ public: void DropMouseGrabbing(); public: - // See nsIView::CreateWidget. - nsresult CreateWidget(const nsIID &aWindowIID, - nsWidgetInitData *aWidgetInitData, - nsNativeWidget aNative, - PRBool aEnableDragDrop, - PRBool aResetVisibility, - nsContentType aContentType, - nsIWidget* aParentWidget); - // NOT in nsIView, so only available in view module // These are also present in nsIView, but these versions return nsView and nsViewManager // instead of nsIView and nsIViewManager.