mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset f1af117d4598
This commit is contained in:
parent
9b55c914bc
commit
80fd4bdeb9
@ -3264,10 +3264,10 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsFrameConstructorState& aState,
|
||||
|
||||
#if defined(XP_MACOSX) || defined(XP_BEOS)
|
||||
static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
|
||||
view->CreateWidgetForPopup(kCPopUpCID, &widgetData);
|
||||
view->CreateWidget(kCPopUpCID, &widgetData, nsnull);
|
||||
#else
|
||||
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
|
||||
view->CreateWidgetForPopup(kCChildCID, &widgetData);
|
||||
view->CreateWidget(kCChildCID, &widgetData, nsnull);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -2320,13 +2320,9 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize, nsIView* aContainerView)
|
||||
if (!view)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool isExternalResource = !!mDocument->GetDisplayDocument();
|
||||
|
||||
// Create a widget if we were given a parent widget or don't have a
|
||||
// container view that we can hook up to without a widget. Don't
|
||||
// create widgets for external resource documents, since they're not
|
||||
// displayed.
|
||||
if (!isExternalResource && (mParentWidget || !aContainerView)) {
|
||||
// Don't create a widget if we weren't given a parent widget but we
|
||||
// have a container view we can hook up to without a widget
|
||||
if (mParentWidget || !aContainerView) {
|
||||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||
// establish a parent/child widget relationship
|
||||
@ -2347,12 +2343,11 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize, nsIView* aContainerView)
|
||||
// Reuse the top level parent widget.
|
||||
rv = view->AttachToTopLevelWidget(mParentWidget);
|
||||
}
|
||||
else if (!aContainerView && mParentWidget) {
|
||||
rv = view->CreateWidgetForParent(kWidgetCID, mParentWidget, initDataPtr,
|
||||
PR_TRUE, PR_FALSE);
|
||||
}
|
||||
else {
|
||||
rv = view->CreateWidget(kWidgetCID, initDataPtr, PR_TRUE, PR_FALSE);
|
||||
nsNativeWidget nw = (aContainerView != nsnull || !mParentWidget) ?
|
||||
nsnull : mParentWidget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
rv = view->CreateWidget(kWidgetCID, initDataPtr,
|
||||
nw, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -8268,7 +8268,7 @@ PresShell::VerifyIncrementalReflow()
|
||||
nsIView* rootView;
|
||||
mViewManager->GetRootView(rootView);
|
||||
NS_ENSURE_TRUE(rootView->HasWidget(), PR_FALSE);
|
||||
nsIWidget* parentWidget = rootView->GetWidget();
|
||||
void* nativeParentWidget = rootView->GetWidget()->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
// Create a new view manager.
|
||||
nsCOMPtr<nsIViewManager> vm = do_CreateInstance(kViewManagerCID);
|
||||
@ -8283,7 +8283,7 @@ PresShell::VerifyIncrementalReflow()
|
||||
NS_ENSURE_TRUE(view, PR_FALSE);
|
||||
|
||||
//now create the widget for the view
|
||||
rv = view->CreateWidgetForParent(kWidgetCID, parentWidget, nsnull, PR_TRUE);
|
||||
rv = view->CreateWidget(kWidgetCID, nsnull, nativeParentWidget, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
// Setup hierarchical relationship in view manager
|
||||
|
@ -967,7 +967,7 @@ nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
|
||||
|
||||
if (aContentType == eContentTypeContent) {
|
||||
// widget needed.
|
||||
nsresult rv = innerView->CreateWidget(kCChildCID, nsnull,
|
||||
nsresult rv = innerView->CreateWidget(kCChildCID, nsnull, nsnull,
|
||||
PR_TRUE, PR_TRUE, aContentType);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Couldn't create widget for frame.");
|
||||
|
@ -1996,15 +1996,12 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
|
||||
// unnecessary and unexpected
|
||||
// Also, no widget should be needed except for the top-level document
|
||||
if (mIsCreatingPrintPreview && documentIsTopLevel) {
|
||||
nsIWidget* widget = nsnull;
|
||||
nsNativeWidget widget = nsnull;
|
||||
if (!frame)
|
||||
widget = mParentWidget;
|
||||
rv = widget ? rootView->CreateWidgetForParent(kWidgetCID, widget, nsnull,
|
||||
PR_TRUE, PR_TRUE,
|
||||
eContentTypeContent)
|
||||
: rootView->CreateWidget(kWidgetCID, nsnull,
|
||||
PR_TRUE, PR_TRUE,
|
||||
eContentTypeContent);
|
||||
widget = mParentWidget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
rv = rootView->CreateWidget(kWidgetCID, nsnull,
|
||||
widget, PR_TRUE, PR_TRUE,
|
||||
eContentTypeContent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aPO->mWindow = rootView->GetWidget();
|
||||
aPO->mPresContext->SetPaginatedScrolling(canCreateScrollbars);
|
||||
|
@ -322,12 +322,12 @@ nsMenuPopupFrame::CreateWidgetForView(nsIView* aView)
|
||||
|
||||
#if defined(XP_MACOSX) || defined(XP_BEOS)
|
||||
static NS_DEFINE_IID(kCPopupCID, NS_POPUP_CID);
|
||||
aView->CreateWidgetForPopup(kCPopupCID, &widgetData, parentWidget,
|
||||
PR_TRUE, PR_TRUE, eContentTypeUI);
|
||||
aView->CreateWidget(kCPopupCID, &widgetData, nsnull, PR_TRUE, PR_TRUE,
|
||||
eContentTypeUI, parentWidget);
|
||||
#else
|
||||
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
|
||||
aView->CreateWidgetForPopup(kCChildCID, &widgetData, parentWidget,
|
||||
PR_TRUE, PR_TRUE, eContentTypeInherit);
|
||||
aView->CreateWidget(kCChildCID, &widgetData, nsnull, PR_TRUE, PR_TRUE,
|
||||
eContentTypeInherit, parentWidget);
|
||||
#endif
|
||||
nsIWidget* widget = aView->GetWidget();
|
||||
widget->SetTransparencyMode(mode);
|
||||
|
@ -61,9 +61,10 @@ enum nsViewVisibility {
|
||||
nsViewVisibility_kShow = 1
|
||||
};
|
||||
|
||||
// IID for the nsIView interface
|
||||
#define NS_IVIEW_IID \
|
||||
{ 0x01258624, 0xca90, 0x47a4, \
|
||||
{ 0xb1, 0xfd, 0x52, 0x11, 0x26, 0xe6, 0xc8, 0xdc } }
|
||||
{ 0xfb9900df, 0x5956, 0x4175, \
|
||||
{ 0x83, 0xba, 0x05, 0x74, 0x31, 0x96, 0x61, 0xee } }
|
||||
|
||||
// Public view flags are defined in this file
|
||||
#define NS_VIEW_FLAGS_PUBLIC 0x00FF
|
||||
@ -275,50 +276,29 @@ public:
|
||||
virtual nsIWidget* GetNearestWidget(nsPoint* aOffset) const;
|
||||
|
||||
/**
|
||||
* Create a widget to associate with this view. This variant of
|
||||
* CreateWidget*() will look around in the view hierarchy for an
|
||||
* appropriate parent widget for the view.
|
||||
*
|
||||
* Create a widget to associate with this view.
|
||||
* @param aWindowIID IID for Widget type that this view
|
||||
* should have associated with it.
|
||||
* should have associated with it. if nsull, then no
|
||||
* width will be created for this view
|
||||
* @param aWidgetInitData data used to initialize this view's widget before
|
||||
* its create is called.
|
||||
* @param aContentType is either content, UI or inherit from parent window.
|
||||
* @param aNative native window that will be used as parent of
|
||||
* aWindowIID. if nsnull, then parent will be derived from
|
||||
* parent view and it's ancestors
|
||||
* @param aWindowType is either content, UI or inherit from parent window.
|
||||
* This is used to expose what type of window this is to
|
||||
* assistive technology like screen readers.
|
||||
* @param aParentWidget alternative parent to aNative used for popups. Must
|
||||
* be null for non-popups.
|
||||
* @return error status
|
||||
*/
|
||||
nsresult CreateWidget(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRBool aEnableDragDrop = PR_TRUE,
|
||||
PRBool aResetVisibility = PR_TRUE,
|
||||
nsContentType aContentType = eContentTypeInherit);
|
||||
|
||||
/**
|
||||
* Create a widget for this view with an explicit parent widget.
|
||||
* |aParentWidget| must be nonnull. The other params are the same
|
||||
* as for |CreateWidget()|.
|
||||
*/
|
||||
nsresult CreateWidgetForParent(const nsIID &aWindowIID,
|
||||
nsIWidget* aParentWidget,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
PRBool aEnableDragDrop = PR_TRUE,
|
||||
PRBool aResetVisibility = PR_TRUE,
|
||||
nsContentType aContentType = eContentTypeInherit);
|
||||
|
||||
/**
|
||||
* Create a popup widget for this view. Pass |aParentWidget| to
|
||||
* explicitly set the popup's parent. If it's not passed, the view
|
||||
* hierarchy will be searched for an appropriate parent widget. The
|
||||
* other params are the same as for |CreateWidget()|, except that
|
||||
* |aWidgetInitData| must be nonnull.
|
||||
*/
|
||||
nsresult CreateWidgetForPopup(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsIWidget* aParentWidget = nsnull,
|
||||
PRBool aEnableDragDrop = PR_TRUE,
|
||||
PRBool aResetVisibility = PR_TRUE,
|
||||
nsContentType aContentType = eContentTypeInherit);
|
||||
nsContentType aWindowType = eContentTypeInherit,
|
||||
nsIWidget* aParentWidget = nsnull);
|
||||
|
||||
/**
|
||||
* Attach/detach a top level widget from this view. When attached, the view
|
||||
|
@ -660,50 +660,33 @@ static PRInt32 FindNonAutoZIndex(nsView* aView)
|
||||
|
||||
nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType)
|
||||
nsContentType aContentType,
|
||||
nsIWidget* aParentWidget)
|
||||
{
|
||||
return Impl()->CreateWidget(aWindowIID, aWidgetInitData,
|
||||
return Impl()->CreateWidget(aWindowIID, aWidgetInitData, aNative,
|
||||
aEnableDragDrop, aResetVisibility,
|
||||
aContentType);
|
||||
}
|
||||
|
||||
nsresult nsIView::CreateWidgetForParent(const nsIID &aWindowIID,
|
||||
nsIWidget* aParentWidget,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType)
|
||||
{
|
||||
return Impl()->CreateWidgetForParent(aWindowIID, aParentWidget,
|
||||
aWidgetInitData,
|
||||
aEnableDragDrop, aResetVisibility,
|
||||
aContentType);
|
||||
}
|
||||
|
||||
nsresult nsIView::CreateWidgetForPopup(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsIWidget* aParentWidget,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType)
|
||||
{
|
||||
return Impl()->CreateWidgetForPopup(aWindowIID, aWidgetInitData,
|
||||
aParentWidget,
|
||||
aEnableDragDrop, aResetVisibility,
|
||||
aContentType);
|
||||
aContentType, aParentWidget);
|
||||
}
|
||||
|
||||
nsresult nsView::CreateWidget(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType)
|
||||
nsContentType aContentType,
|
||||
nsIWidget* aParentWidget)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!aWidgetInitData ||
|
||||
aWidgetInitData->mWindowType != eWindowType_popup,
|
||||
"Use CreateWidgetForPopup");
|
||||
if (NS_UNLIKELY(mWindow)) {
|
||||
NS_ERROR("We already have a window for this view? BAD");
|
||||
ViewWrapper* wrapper = GetWrapperFor(mWindow);
|
||||
NS_IF_RELEASE(wrapper);
|
||||
mWindow->SetClientData(nsnull);
|
||||
mWindow->Destroy();
|
||||
NS_RELEASE(mWindow);
|
||||
}
|
||||
|
||||
nsresult rv = LoadWidget(aWindowIID);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -727,91 +710,38 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID,
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
|
||||
|
||||
initData.mListenForResizes = (!initDataPassedIn && GetParent() &&
|
||||
GetParent()->GetViewManager() != mViewManager);
|
||||
if (aWidgetInitData->mWindowType == eWindowType_popup) {
|
||||
if (aParentWidget) {
|
||||
mWindow->Create(aParentWidget, nsnull, trect,
|
||||
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
}
|
||||
else {
|
||||
// XXX/cjones: having these two separate creation cases seems
|
||||
// ... um ... unnecessary, but it's the way the old code did it.
|
||||
// Please unify them by first finding a suitable parent nsIWidget,
|
||||
// then passing only either the non-null parentWidget or the
|
||||
// native ID to Create().
|
||||
nsIWidget* nearestParent = GetParent() ? GetParent()->GetNearestWidget(nsnull)
|
||||
: nsnull;
|
||||
if (!nearestParent) {
|
||||
// Without a parent, we can't make a popup. This can happen
|
||||
// when printing
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIWidget* parentWidget =
|
||||
GetParent() ? GetParent()->GetNearestWidget(nsnull) : nsnull;
|
||||
|
||||
mWindow->Create(parentWidget, nsnull,
|
||||
trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
|
||||
InitializeWindow(aEnableDragDrop, aResetVisibility);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsView::CreateWidgetForParent(const nsIID &aWindowIID,
|
||||
nsIWidget* aParentWidget,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aWindowType)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!aWidgetInitData ||
|
||||
aWidgetInitData->mWindowType != eWindowType_popup,
|
||||
"Use CreateWidgetForPopup");
|
||||
NS_ABORT_IF_FALSE(aParentWidget, "Parent widget required");
|
||||
|
||||
nsresult rv = LoadWidget(aWindowIID);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
mWindow->Create(nsnull, nearestParent->GetNativeData(NS_NATIVE_WIDGET), trect,
|
||||
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect trect = CalcWidgetBounds(
|
||||
aWidgetInitData ? aWidgetInitData->mWindowType : eWindowType_child);
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
|
||||
|
||||
mWindow->Create(nsnull, aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
|
||||
trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
|
||||
InitializeWindow(aEnableDragDrop, aResetVisibility);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsView::CreateWidgetForPopup(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsIWidget* aParentWidget,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aWindowType)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aWidgetInitData, "Widget init data required");
|
||||
NS_ABORT_IF_FALSE(aWidgetInitData->mWindowType == eWindowType_popup,
|
||||
"Use one of the other CreateWidget methods");
|
||||
|
||||
nsresult rv = LoadWidget(aWindowIID);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
|
||||
|
||||
// XXX/cjones: having these two separate creation cases seems ... um
|
||||
// ... unnecessary, but it's the way the old code did it. Please
|
||||
// unify them by first finding a suitable parent nsIWidget, then
|
||||
// passing only either the non-null parentWidget or the native ID to
|
||||
// Create().
|
||||
if (aParentWidget) {
|
||||
mWindow->Create(aParentWidget, nsnull, trect,
|
||||
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
else if (aNative) {
|
||||
mWindow->Create(nsnull, aNative, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
}
|
||||
else {
|
||||
nsIWidget* nearestParent = GetParent() ? GetParent()->GetNearestWidget(nsnull)
|
||||
: nsnull;
|
||||
if (!nearestParent) {
|
||||
// Without a parent, we can't make a popup. This can happen
|
||||
// when printing
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mWindow->Create(nsnull, nearestParent->GetNativeData(NS_NATIVE_WIDGET), trect,
|
||||
initData.mListenForResizes = (!initDataPassedIn && GetParent() &&
|
||||
GetParent()->GetViewManager() != mViewManager);
|
||||
nsIWidget* parentWidget = GetParent() ? GetParent()->GetNearestWidget(nsnull)
|
||||
: nsnull;
|
||||
mWindow->Create(parentWidget, nsnull, trect,
|
||||
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
}
|
||||
|
||||
@ -821,7 +751,7 @@ nsresult nsView::CreateWidgetForPopup(const nsIID &aWindowIID,
|
||||
}
|
||||
|
||||
void
|
||||
nsView::InitializeWindow(PRBool aEnableDragDrop, PRBool aResetVisibility)
|
||||
nsView::InitializeWindow(bool aEnableDragDrop, bool aResetVisibility)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mWindow, "Must have a window to initialize");
|
||||
|
||||
@ -911,14 +841,7 @@ void nsView::SetZIndex(PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost)
|
||||
//
|
||||
nsresult nsView::LoadWidget(const nsCID &aClassIID)
|
||||
{
|
||||
if (NS_UNLIKELY(mWindow)) {
|
||||
NS_ERROR("We already have a window for this view? BAD");
|
||||
ViewWrapper* wrapper = GetWrapperFor(mWindow);
|
||||
NS_IF_RELEASE(wrapper);
|
||||
mWindow->SetClientData(nsnull);
|
||||
mWindow->Destroy();
|
||||
NS_RELEASE(mWindow);
|
||||
}
|
||||
NS_ABORT_IF_FALSE(!mWindow, "Already have a widget?");
|
||||
|
||||
nsresult rv = CallCreateInstance(aClassIID, &mWindow);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -120,25 +120,11 @@ public:
|
||||
// See nsIView::CreateWidget.
|
||||
nsresult CreateWidget(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType);
|
||||
|
||||
// See nsIView::CreateWidgetForParent.
|
||||
nsresult CreateWidgetForParent(const nsIID &aWindowIID,
|
||||
nsIWidget* aParentWidget,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType);
|
||||
|
||||
// See nsIView::CreateWidgetForPopup.
|
||||
nsresult CreateWidgetForPopup(const nsIID &aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsIWidget* aParentWidget,
|
||||
PRBool aEnableDragDrop,
|
||||
PRBool aResetVisibility,
|
||||
nsContentType aContentType);
|
||||
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
|
||||
@ -210,7 +196,7 @@ protected:
|
||||
nsRegion* mDirtyRegion;
|
||||
|
||||
private:
|
||||
void InitializeWindow(PRBool aEnableDragDrop, PRBool aResetVisibility);
|
||||
void InitializeWindow(bool aEnableDragDrop, bool aResetVisibility);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user