Backed out changeset ab1cbc8a9d51, bug 90268. r=josh

This commit is contained in:
Josh Aas 2011-08-30 02:13:01 -04:00
parent 4c15607f47
commit 7ad3b2e3f5
5 changed files with 18 additions and 52 deletions

View File

@ -118,8 +118,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#endif
#define NS_IWIDGET_IID \
{ 0xEAAF1019, 0x0CD8, 0x4DD8, \
{ 0xBE, 0xB9, 0x8D, 0x8D, 0xEB, 0x52, 0xFC, 0xF6 } }
{ 0xf43254ce, 0xd315, 0x458b, \
{ 0xba, 0x72, 0xa8, 0xdf, 0x21, 0xcf, 0xa7, 0x2a } }
/*
* Window shadow styles
@ -363,14 +363,6 @@ class nsIWidget : public nsISupports {
nsWidgetInitData *aInitData = nsnull,
PRBool aForceUseIWidgetParent = PR_FALSE) = 0;
/**
* Set the event callback for a widget. If a device context is not
* provided then the existing device context will remain, it will
* not be nulled out.
*/
NS_IMETHOD SetEventCallback(EVENT_CALLBACK aEventFunction,
nsDeviceContext *aContext) = 0;
/**
* Attach to a top level widget.
*
@ -413,7 +405,7 @@ class nsIWidget : public nsISupports {
/**
* Reparent a widget
*
* Change the widget's parent. Null parents are allowed.
* Change the widgets parent
*
* @param aNewParent new parent
*/

View File

@ -704,30 +704,26 @@ nsChildView::SetParent(nsIWidget* aNewParent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_ENSURE_ARG(aNewParent);
if (mOnDestroyCalled)
return NS_OK;
// make sure we stay alive
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
if (mParentWidget) {
// remove us from our existing parent
if (mParentWidget)
mParentWidget->RemoveChild(this);
}
if (aNewParent) {
ReparentNativeWidget(aNewParent);
} else {
[mView removeFromSuperview];
mParentView = nil;
}
mParentWidget = aNewParent;
if (mParentWidget) {
mParentWidget->AddChild(this);
}
nsresult rv = ReparentNativeWidget(aNewParent);
if (NS_SUCCEEDED(rv))
mParentWidget = aNewParent;
// add us to the new parent
mParentWidget->AddChild(this);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
@ -747,7 +743,7 @@ nsChildView::ReparentNativeWidget(nsIWidget* aNewParent)
// we hold a ref to mView, so this is safe
[mView removeFromSuperview];
mParentView = newParentView;
mParentView = newParentView;
[mParentView addSubview:mView];
return NS_OK;

View File

@ -882,17 +882,15 @@ nsWindow::GetDPI()
NS_IMETHODIMP
nsWindow::SetParent(nsIWidget *aNewParent)
{
if (mContainer || !mGdkWindow) {
NS_NOTREACHED("nsWindow::SetParent called illegally");
if (mContainer || !mGdkWindow || !mParent) {
NS_NOTREACHED("nsWindow::SetParent - reparenting a non-child window");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_ASSERTION(!mTransientParent, "child widget with transient parent");
nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
if (mParent) {
mParent->RemoveChild(this);
}
mParent->RemoveChild(this);
mParent = aNewParent;
@ -989,10 +987,6 @@ nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent,
NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(aNewParentWindow)->destroyed,
"destroyed GdkWindow with widget");
SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer);
if (aOldContainer == gInvisibleContainer) {
CheckDestroyInvisibleContainer();
}
}
if (!mIsTopLevel) {

View File

@ -289,21 +289,6 @@ nsBaseWidget::CreateChild(const nsIntRect &aRect,
return nsnull;
}
NS_IMETHODIMP
nsBaseWidget::SetEventCallback(EVENT_CALLBACK aEventFunction,
nsDeviceContext *aContext)
{
mEventCallback = aEventFunction;
if (aContext) {
NS_IF_RELEASE(mContext);
mContext = aContext;
NS_ADDREF(mContext);
}
return NS_OK;
}
// Attach a view to our widget which we'll send events to.
NS_IMETHODIMP
nsBaseWidget::AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction,

View File

@ -170,7 +170,6 @@ public:
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull,
PRBool aForceUseIWidgetParent = PR_FALSE);
NS_IMETHOD SetEventCallback(EVENT_CALLBACK aEventFunction, nsDeviceContext *aContext);
NS_IMETHOD AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction, nsDeviceContext *aContext);
virtual ViewWrapper* GetAttachedViewPtr();
NS_IMETHOD SetAttachedViewPtr(ViewWrapper* aViewWrapper);