Bug 582057, part b: Remove nsIDeviceContext::SupportsNativeWidgets because it's not used meaningfully, and will be confusing in content processes. sr=roc

This commit is contained in:
Chris Jones 2010-08-20 14:29:01 -05:00
Родитель 1eedeb1aa6
Коммит 7548246b53
5 изменённых файлов: 45 добавлений и 76 удалений

Просмотреть файл

@ -169,8 +169,8 @@ const PRUint8 kUseAltDCFor_SURFACE_DIM = 0x08; // Use it for getting the Sur
#endif #endif
#define NS_IDEVICE_CONTEXT_IID \ #define NS_IDEVICE_CONTEXT_IID \
{ 0x41391E7C, 0x9ED5, 0x4A60, \ { 0x30a9d22f, 0x8e51, 0x40af, \
{ 0x88, 0x72, 0x06, 0x15, 0x73, 0xF5, 0x0E, 0xE7 } } { 0xa1, 0xf5, 0x48, 0xe3, 0x00, 0xaa, 0xa9, 0x27 } }
typedef enum { typedef enum {
eSystemFont_Caption, // css2 eSystemFont_Caption, // css2
@ -231,8 +231,7 @@ public:
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) = 0; NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) = 0;
/** /**
* Create a rendering context and initialize it. This API should *only* be called * Create a rendering context and initialize it.
* on device contexts whose SupportsNativeWidgets() method return PR_FALSE.
* @param aContext out parameter for new rendering context * @param aContext out parameter for new rendering context
* @return error status * @return error status
*/ */
@ -245,15 +244,6 @@ public:
*/ */
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext) = 0; NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext) = 0;
/**
* Query the device to see if it supports native widgets. If not, then
* nsIWidget->Create() calls should be avoided.
* @param aSupportsWidgets out paramater. If PR_TRUE, then native widgets
* can be created.
* @return error status
*/
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets) = 0;
/** /**
* We are in the process of creating the native widget for aWidget. * We are in the process of creating the native widget for aWidget.
* Do any device-specific processing required to initialize the * Do any device-specific processing required to initialize the

Просмотреть файл

@ -790,13 +790,6 @@ nsThebesDeviceContext::CreateRenderingContextInstance(nsIRenderingContext *&aCon
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsThebesDeviceContext::SupportsNativeWidgets(PRBool &aSupportsWidgets)
{
aSupportsWidgets = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsThebesDeviceContext::ClearCachedSystemFonts() nsThebesDeviceContext::ClearCachedSystemFonts()
{ {

Просмотреть файл

@ -104,7 +104,6 @@ public:
NS_IMETHOD FontMetricsDeleted(const nsIFontMetrics* aFontMetrics); NS_IMETHOD FontMetricsDeleted(const nsIFontMetrics* aFontMetrics);
NS_IMETHOD FlushFontCache(void); NS_IMETHOD FlushFontCache(void);
NS_IMETHOD SupportsNativeWidgets(PRBool& aSupportsWidgets);
NS_IMETHOD PrepareNativeWidget(nsIWidget *aWidget, void **aOut); NS_IMETHOD PrepareNativeWidget(nsIWidget *aWidget, void **aOut);
NS_IMETHOD GetSystemFont(nsSystemFontID aID, nsFont *aFont) const; NS_IMETHOD GetSystemFont(nsSystemFontID aID, nsFont *aFont) const;

Просмотреть файл

@ -697,10 +697,8 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
// XXX is the above comment correct? // XXX is the above comment correct?
viewMan->SetViewVisibility(view, nsViewVisibility_kHide); viewMan->SetViewVisibility(view, nsViewVisibility_kHide);
PRBool usewidgets;
nsCOMPtr<nsIDeviceContext> dx; nsCOMPtr<nsIDeviceContext> dx;
viewMan->GetDeviceContext(*getter_AddRefs(dx)); viewMan->GetDeviceContext(*getter_AddRefs(dx));
dx->SupportsNativeWidgets(usewidgets);
//this is ugly. it was ripped off from didreflow(). MMP //this is ugly. it was ripped off from didreflow(). MMP
// Position and size view relative to its parent, not relative to our // Position and size view relative to its parent, not relative to our
@ -719,7 +717,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (!aViewOnly && !mWidget && usewidgets) { if (!aViewOnly && !mWidget) {
mInnerView = viewMan->CreateView(GetContentRect() - GetPosition(), view); mInnerView = viewMan->CreateView(GetContentRect() - GetPosition(), view);
if (!mInnerView) { if (!mInnerView) {
NS_ERROR("Could not create inner view"); NS_ERROR("Could not create inner view");

Просмотреть файл

@ -694,67 +694,56 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID,
if (NS_OK == LoadWidget(aWindowIID)) if (NS_OK == LoadWidget(aWindowIID))
{ {
PRBool usewidgets;
nsCOMPtr<nsIDeviceContext> dx; nsCOMPtr<nsIDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx)); mViewManager->GetDeviceContext(*getter_AddRefs(dx));
dx->SupportsNativeWidgets(usewidgets);
if (PR_TRUE == usewidgets) PRBool initDataPassedIn = PR_TRUE;
nsWidgetInitData initData;
if (!aWidgetInitData) {
// No initData, we're a child window
// Create initData to pass in params
initDataPassedIn = PR_FALSE;
initData.clipChildren = PR_TRUE; // Clip child window's children
initData.clipSiblings = PR_TRUE; // Clip child window's siblings
aWidgetInitData = &initData;
}
aWidgetInitData->mContentType = aContentType;
if (aNative && aWidgetInitData->mWindowType != eWindowType_popup)
mWindow->Create(nsnull, aNative, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
else
{ {
PRBool initDataPassedIn = PR_TRUE; if (!initDataPassedIn && GetParent() &&
nsWidgetInitData initData;
if (!aWidgetInitData) {
// No initData, we're a child window
// Create initData to pass in params
initDataPassedIn = PR_FALSE;
initData.clipChildren = PR_TRUE; // Clip child window's children
initData.clipSiblings = PR_TRUE; // Clip child window's siblings
aWidgetInitData = &initData;
}
aWidgetInitData->mContentType = aContentType;
if (aNative && aWidgetInitData->mWindowType != eWindowType_popup)
mWindow->Create(nsnull, aNative, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
else
{
if (!initDataPassedIn && GetParent() &&
GetParent()->GetViewManager() != mViewManager) GetParent()->GetViewManager() != mViewManager)
initData.mListenForResizes = PR_TRUE; initData.mListenForResizes = PR_TRUE;
if (aParentWidget) { if (aParentWidget) {
NS_ASSERTION(aWidgetInitData->mWindowType == eWindowType_popup, NS_ASSERTION(aWidgetInitData->mWindowType == eWindowType_popup,
"popup widget type expected"); "popup widget type expected");
mWindow->Create(aParentWidget, nsnull, trect, mWindow->Create(aParentWidget, nsnull, trect,
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
}
else {
nsIWidget* parentWidget = GetParent() ? GetParent()->GetNearestWidget(nsnull)
: nsnull;
if (aWidgetInitData->mWindowType == eWindowType_popup) {
// Without a parent, we can't make a popup. This can happen
// when printing
if (!parentWidget)
return NS_ERROR_FAILURE;
mWindow->Create(nsnull, parentWidget->GetNativeData(NS_NATIVE_WIDGET), trect,
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
} else {
mWindow->Create(parentWidget, nsnull, trect,
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData); ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
} }
else {
nsIWidget* parentWidget = GetParent() ? GetParent()->GetNearestWidget(nsnull)
: nsnull;
if (aWidgetInitData->mWindowType == eWindowType_popup) {
// Without a parent, we can't make a popup. This can happen
// when printing
if (!parentWidget)
return NS_ERROR_FAILURE;
mWindow->Create(nsnull, parentWidget->GetNativeData(NS_NATIVE_WIDGET), trect,
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
} else {
mWindow->Create(parentWidget, nsnull, trect,
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
}
}
} }
if (aEnableDragDrop) {
mWindow->EnableDragDrop(PR_TRUE);
}
// propagate the z-index to the widget.
UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this));
} 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,
// but we might want it to work at some point.)
mWindow->Resize(trect.x, trect.y, trect.width, trect.height,
PR_FALSE);
} }
if (aEnableDragDrop) {
mWindow->EnableDragDrop(PR_TRUE);
}
// propagate the z-index to the widget.
UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this));
} }
//make sure visibility state is accurate //make sure visibility state is accurate