Merge backout

This commit is contained in:
Chris Jones 2010-08-19 19:03:24 -05:00
commit 036de78312
3 changed files with 21 additions and 55 deletions

View File

@ -396,10 +396,6 @@ protected:
PRBool mWidgetIsTopLevel; PRBool mWidgetIsTopLevel;
virtual ~nsIView() {} virtual ~nsIView() {}
private:
nsView* Impl();
const nsView* Impl() const;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsIView, NS_IVIEW_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIView, NS_IVIEW_IID)

View File

@ -394,7 +394,7 @@ nsIntRect nsIView::CalcWidgetBounds(nsWindowType aType)
nsRect viewBounds(mDimBounds); nsRect viewBounds(mDimBounds);
nsView* parent = GetParent()->Impl(); nsView* parent = static_cast<nsView*>(GetParent());
if (parent) { if (parent) {
nsPoint offset; nsPoint offset;
nsIWidget* parentWidget = parent->GetNearestWidget(&offset, p2a); nsIWidget* parentWidget = parent->GetNearestWidget(&offset, p2a);
@ -665,19 +665,6 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
PRBool aResetVisibility, PRBool aResetVisibility,
nsContentType aContentType, nsContentType aContentType,
nsIWidget* aParentWidget) 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)) { if (NS_UNLIKELY(mWindow)) {
NS_ERROR("We already have a window for this view? BAD"); NS_ERROR("We already have a window for this view? BAD");
@ -688,11 +675,13 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID,
NS_RELEASE(mWindow); NS_RELEASE(mWindow);
} }
nsIntRect trect = CalcWidgetBounds(aWidgetInitData nsView* v = static_cast<nsView*>(this);
nsIntRect trect = v->CalcWidgetBounds(aWidgetInitData
? aWidgetInitData->mWindowType ? aWidgetInitData->mWindowType
: eWindowType_child); : eWindowType_child);
if (NS_OK == LoadWidget(aWindowIID)) if (NS_OK == v->LoadWidget(aWindowIID))
{ {
PRBool usewidgets; PRBool usewidgets;
nsCOMPtr<nsIDeviceContext> dx; nsCOMPtr<nsIDeviceContext> dx;
@ -747,7 +736,7 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID,
} }
// propagate the z-index to the widget. // propagate the z-index to the widget.
UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this)); UpdateNativeWidgetZIndexes(v, FindNonAutoZIndex(v));
} else { } else {
// We should tell the widget its size even if we don't create a // We should tell the widget its size even if we don't create a
// native widget. (At the moment, this doesn't really matter, // 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 //make sure visibility state is accurate
if (aResetVisibility) { if (aResetVisibility) {
SetVisibility(GetVisibility()); v->SetVisibility(GetVisibility());
} }
return NS_OK; return NS_OK;
@ -789,7 +778,8 @@ nsresult nsIView::AttachToTopLevelWidget(nsIWidget* aWidget)
mWindow = aWidget; mWindow = aWidget;
NS_ADDREF(mWindow); NS_ADDREF(mWindow);
ViewWrapper* wrapper = new ViewWrapper(Impl()); nsView* v = static_cast<nsView*>(this);
ViewWrapper* wrapper = new ViewWrapper(v);
NS_ADDREF(wrapper); NS_ADDREF(wrapper);
mWindow->SetAttachedViewPtr(wrapper); mWindow->SetAttachedViewPtr(wrapper);
mWindow->EnableDragDrop(PR_TRUE); mWindow->EnableDragDrop(PR_TRUE);
@ -863,7 +853,8 @@ EVENT_CALLBACK nsIView::AttachWidgetEventHandler(nsIWidget* aWidget)
NS_ASSERTION(!data, "Already got client data"); NS_ASSERTION(!data, "Already got client data");
#endif #endif
ViewWrapper* wrapper = new ViewWrapper(Impl()); nsView* v = static_cast<nsView*>(this);
ViewWrapper* wrapper = new ViewWrapper(v);
if (!wrapper) if (!wrapper)
return nsnull; return nsnull;
NS_ADDREF(wrapper); // Will be released in DetachWidgetEventHandler 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 nsPoint nsIView::GetOffsetTo(const nsIView* aOther) const
{ {
return Impl()->GetOffsetTo(static_cast<const nsView*>(aOther), const nsView* view = static_cast<const nsView*>(this);
Impl()->GetViewManager()->AppUnitsPerDevPixel()); return view->GetOffsetTo(static_cast<const nsView*>(aOther),
view->GetViewManager()->AppUnitsPerDevPixel());
} }
nsPoint nsView::GetOffsetTo(const nsView* aOther) const nsPoint nsView::GetOffsetTo(const nsView* aOther) const
@ -966,12 +958,10 @@ nsPoint nsIView::GetOffsetToWidget(nsIWidget* aWidget) const
{ {
nsPoint pt; nsPoint pt;
// Get the view for widget // Get the view for widget
nsIView* widgetIView = GetViewFor(aWidget); nsView* widgetView = static_cast<nsView*>(GetViewFor(aWidget));
if (!widgetIView) { if (!widgetView) {
return pt; return pt;
} }
nsView* widgetView = widgetIView->Impl();
// Get the offset to the widget view in the widget view's APD // 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 // 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 // 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 nsIWidget* nsIView::GetNearestWidget(nsPoint* aOffset) const
{ {
return Impl()->GetNearestWidget(aOffset, const nsView* view = static_cast<const nsView*>(this);
Impl()->GetViewManager()->AppUnitsPerDevPixel()); return view->GetNearestWidget(aOffset,
view->GetViewManager()->AppUnitsPerDevPixel());
} }
nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset) const nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset) const
@ -1065,18 +1056,6 @@ nsIView::SetDeletionObserver(nsWeakView* aDeletionObserver)
mDeletionObserver = aDeletionObserver; mDeletionObserver = aDeletionObserver;
} }
nsView*
nsIView::Impl()
{
return static_cast<nsView*>(this);
}
const nsView*
nsIView::Impl() const
{
return static_cast<const nsView*>(this);
}
nsRect nsRect
nsView::GetBoundsInParentUnits() const nsView::GetBoundsInParentUnits() const
{ {

View File

@ -117,15 +117,6 @@ public:
void DropMouseGrabbing(); void DropMouseGrabbing();
public: 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 // NOT in nsIView, so only available in view module
// These are also present in nsIView, but these versions return nsView and nsViewManager // These are also present in nsIView, but these versions return nsView and nsViewManager
// instead of nsIView and nsIViewManager. // instead of nsIView and nsIViewManager.