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
parent 355220de11
commit 5e7a13a689
5 changed files with 45 additions and 76 deletions

View File

@ -169,8 +169,8 @@ const PRUint8 kUseAltDCFor_SURFACE_DIM = 0x08; // Use it for getting the Sur
#endif
#define NS_IDEVICE_CONTEXT_IID \
{ 0x41391E7C, 0x9ED5, 0x4A60, \
{ 0x88, 0x72, 0x06, 0x15, 0x73, 0xF5, 0x0E, 0xE7 } }
{ 0x30a9d22f, 0x8e51, 0x40af, \
{ 0xa1, 0xf5, 0x48, 0xe3, 0x00, 0xaa, 0xa9, 0x27 } }
typedef enum {
eSystemFont_Caption, // css2
@ -231,8 +231,7 @@ public:
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) = 0;
/**
* Create a rendering context and initialize it. This API should *only* be called
* on device contexts whose SupportsNativeWidgets() method return PR_FALSE.
* Create a rendering context and initialize it.
* @param aContext out parameter for new rendering context
* @return error status
*/
@ -245,15 +244,6 @@ public:
*/
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.
* Do any device-specific processing required to initialize the

View File

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

View File

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

View File

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

View File

@ -694,67 +694,56 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID,
if (NS_OK == LoadWidget(aWindowIID))
{
PRBool usewidgets;
nsCOMPtr<nsIDeviceContext> 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;
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() &&
if (!initDataPassedIn && GetParent() &&
GetParent()->GetViewManager() != mViewManager)
initData.mListenForResizes = PR_TRUE;
if (aParentWidget) {
NS_ASSERTION(aWidgetInitData->mWindowType == eWindowType_popup,
"popup widget type expected");
mWindow->Create(aParentWidget, nsnull, trect,
initData.mListenForResizes = PR_TRUE;
if (aParentWidget) {
NS_ASSERTION(aWidgetInitData->mWindowType == eWindowType_popup,
"popup widget type expected");
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);
}
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