Bug 617539 - remove nsIWidget_MOZILLA_2_0_BRANCH, r=jimm

This commit is contained in:
Benjamin Smedberg 2011-03-25 11:03:35 -04:00
Родитель 5056fd8ce4
Коммит 4f48034c2a
10 изменённых файлов: 89 добавлений и 127 удалений

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

@ -6393,9 +6393,9 @@ LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
nsIWidget* widget = displayRoot->GetNearestWidget(nsnull); nsIWidget* widget = displayRoot->GetNearestWidget(nsnull);
if (widget) { if (widget) {
nsRefPtr<LayerManager> manager = nsRefPtr<LayerManager> manager =
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget)-> widget->
GetLayerManager(aRequirePersistent ? nsIWidget_MOZILLA_2_0_BRANCH::LAYER_MANAGER_PERSISTENT : GetLayerManager(aRequirePersistent ? nsIWidget::LAYER_MANAGER_PERSISTENT :
nsIWidget_MOZILLA_2_0_BRANCH::LAYER_MANAGER_CURRENT, nsIWidget::LAYER_MANAGER_CURRENT,
aAllowRetaining); aAllowRetaining);
return manager.forget(); return manager.forget();
} }

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

@ -166,9 +166,8 @@ nsIMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
// the enabled state isn't changing, we should do nothing. // the enabled state isn't changing, we should do nothing.
return NS_OK; return NS_OK;
} }
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
if (!widget2 || NS_FAILED(widget2->GetInputMode(context))) { if (!widget || NS_FAILED(widget->GetInputMode(context))) {
// this platform doesn't support IME controlling // this platform doesn't support IME controlling
return NS_OK; return NS_OK;
} }
@ -223,9 +222,8 @@ nsIMEStateManager::UpdateIMEState(PRUint32 aNewIMEState, nsIContent* aContent)
} }
// Don't update IME state when enabled state isn't actually changed. // Don't update IME state when enabled state isn't actually changed.
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
nsresult rv = widget2->GetInputMode(context); nsresult rv = widget->GetInputMode(context);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return; // This platform doesn't support controling the IME state. return; // This platform doesn't support controling the IME state.
} }
@ -294,8 +292,7 @@ nsIMEStateManager::SetIMEState(PRUint32 aState,
nsIWidget* aWidget) nsIWidget* aWidget)
{ {
if (aState & nsIContent::IME_STATUS_MASK_ENABLED) { if (aState & nsIContent::IME_STATUS_MASK_ENABLED) {
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aWidget); if (!aWidget)
if (!widget2)
return; return;
PRUint32 state = nsContentUtils::GetWidgetStatusFromIMEStatus(aState); PRUint32 state = nsContentUtils::GetWidgetStatusFromIMEStatus(aState);
@ -330,7 +327,7 @@ nsIMEStateManager::SetIMEState(PRUint32 aState,
} }
} }
widget2->SetInputMode(context); aWidget->SetInputMode(context);
nsContentUtils::AddScriptRunner(new IMEEnabledStateChangedEvent(state)); nsContentUtils::AddScriptRunner(new IMEEnabledStateChangedEvent(state));
} }

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

@ -1006,9 +1006,8 @@ nsDOMWindowUtils::GetIMEIsOpen(PRBool *aState)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// Open state should not be available when IME is not enabled. // Open state should not be available when IME is not enabled.
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
nsresult rv = widget2->GetInputMode(context); nsresult rv = widget->GetInputMode(context);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (context.mStatus != nsIWidget::IME_STATUS_ENABLED) if (context.mStatus != nsIWidget::IME_STATUS_ENABLED)
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
@ -1025,9 +1024,8 @@ nsDOMWindowUtils::GetIMEStatus(PRUint32 *aState)
if (!widget) if (!widget)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
nsresult rv = widget2->GetInputMode(context); nsresult rv = widget->GetInputMode(context);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
*aState = context.mStatus; *aState = context.mStatus;
@ -1044,9 +1042,8 @@ nsDOMWindowUtils::GetFocusedInputType(char** aType)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
nsresult rv = widget2->GetInputMode(context); nsresult rv = widget->GetInputMode(context);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
*aType = ToNewCString(context.mHTMLInputType); *aType = ToNewCString(context.mHTMLInputType);

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

@ -518,12 +518,9 @@ TabParent::RecvGetIMEEnabled(PRUint32* aValue)
if (!widget) if (!widget)
return true; return true;
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
if (widget2) { widget->GetInputMode(context);
widget2->GetInputMode(context);
*aValue = context.mStatus; *aValue = context.mStatus;
}
return true; return true;
} }
@ -534,13 +531,11 @@ TabParent::RecvSetInputMode(const PRUint32& aValue, const nsString& aType, const
if (!widget || !AllowContentIME()) if (!widget || !AllowContentIME())
return true; return true;
nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
IMEContext context; IMEContext context;
context.mStatus = aValue; context.mStatus = aValue;
context.mHTMLInputType.Assign(aType); context.mHTMLInputType.Assign(aType);
context.mActionHint.Assign(aAction); context.mActionHint.Assign(aAction);
widget2->SetInputMode(context); widget->SetInputMode(context);
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (!observerService) if (!observerService)

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

@ -600,7 +600,7 @@ LayerManagerOGL::Render()
RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO, RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO,
nsIntPoint(0, 0)); nsIntPoint(0, 0));
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(mWidget)->DrawOver(this, rect); mWidget->DrawOver(this, rect);
if (mTarget) { if (mTarget) {
CopyToTarget(); CopyToTarget();

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

@ -1584,13 +1584,12 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
NS_WARNING("Flushing retained layers!"); NS_WARNING("Flushing retained layers!");
flags |= nsDisplayList::PAINT_FLUSH_LAYERS; flags |= nsDisplayList::PAINT_FLUSH_LAYERS;
} else if (!(aFlags & PAINT_DOCUMENT_RELATIVE)) { } else if (!(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget_MOZILLA_2_0_BRANCH *widget2 = nsIWidget *widget = aFrame->GetNearestWidget();
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aFrame->GetNearestWidget()); if (widget) {
if (widget2) {
builder.SetFinalTransparentRegion(visibleRegion); builder.SetFinalTransparentRegion(visibleRegion);
// If we're finished building display list items for painting of the outermost // If we're finished building display list items for painting of the outermost
// pres shell, notify the widget about any toolbars we've encountered. // pres shell, notify the widget about any toolbars we've encountered.
widget2->UpdateThemeGeometries(builder.GetThemeGeometries()); widget->UpdateThemeGeometries(builder.GetThemeGeometries());
} }
} }
} }
@ -1605,12 +1604,11 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
if ((aFlags & PAINT_WIDGET_LAYERS) && if ((aFlags & PAINT_WIDGET_LAYERS) &&
!willFlushRetainedLayers && !willFlushRetainedLayers &&
!(aFlags & PAINT_DOCUMENT_RELATIVE)) { !(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget_MOZILLA_2_0_BRANCH *widget2 = nsIWidget *widget = aFrame->GetNearestWidget();
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aFrame->GetNearestWidget()); if (widget) {
if (widget2) {
PRInt32 pixelRatio = presContext->AppUnitsPerDevPixel(); PRInt32 pixelRatio = presContext->AppUnitsPerDevPixel();
nsIntRegion visibleWindowRegion(visibleRegion.ToOutsidePixels(presContext->AppUnitsPerDevPixel())); nsIntRegion visibleWindowRegion(visibleRegion.ToOutsidePixels(presContext->AppUnitsPerDevPixel()));
widget2->UpdateTransparentRegion(visibleWindowRegion); widget->UpdateTransparentRegion(visibleWindowRegion);
} }
} }

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

@ -118,15 +118,9 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
#endif #endif
// cc443f0b-af39-415d-9c4b-7e06eaa8b13b
#define NS_IWIDGET_IID \ #define NS_IWIDGET_IID \
{ 0xcc443f0b, 0xaf39, 0x415d, \ { 0xe5c2efd1, 0xfbae, 0x4a74, \
{ 0x9c, 0x4b, 0x7e, 0x06, 0xea, 0xa8, 0xb1, 0x3b } } { 0xb2, 0xeb, 0xf3, 0x49, 0xf5, 0x72, 0xca, 0x71 } }
// {8FC2D005-5359-4dbf-ACB1-701992FB4617}
#define NS_IWIDGET_MOZILLA_2_0_BRANCH_IID \
{ 0x8fc2d005, 0x5359, 0x4dbf, \
{ 0xac, 0xb1, 0x70, 0x19, 0x92, 0xfb, 0x46, 0x17 } }
/* /*
* Window shadow styles * Window shadow styles
@ -790,12 +784,6 @@ class nsIWidget : public nsISupports {
*/ */
virtual nsTransparencyMode GetTransparencyMode() = 0; virtual nsTransparencyMode GetTransparencyMode() = 0;
/**
* depreciated, see 2.0 interface.
*/
virtual void UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion,
const nsIntRegion &aPossiblyTransparentRegion) {};
/** /**
* This represents a command to set the bounds and clip region of * This represents a command to set the bounds and clip region of
* a child widget. * a child widget.
@ -892,7 +880,52 @@ class nsIWidget : public nsISupports {
* @param aAllowRetaining an outparam that states whether the returned * @param aAllowRetaining an outparam that states whether the returned
* layer manager should be used for retained layers * layer manager should be used for retained layers
*/ */
virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull) = 0; inline LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull)
{
return GetLayerManager(LAYER_MANAGER_CURRENT, aAllowRetaining);
}
enum LayerManagerPersistence
{
LAYER_MANAGER_CURRENT = 0,
LAYER_MANAGER_PERSISTENT
};
virtual LayerManager *GetLayerManager(LayerManagerPersistence aPersistence,
bool* aAllowRetaining = nsnull) = 0;
/**
* Called after the LayerManager draws the layer tree
*
* @param aManager The drawing LayerManager.
* @param aRect Current widget rect that is being drawn.
*/
virtual void DrawOver(LayerManager* aManager, nsIntRect aRect) = 0;
/**
* Called when Gecko knows which themed widgets exist in this window.
* The passed array contains an entry for every themed widget of the right
* type (currently only NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR and
* NS_THEME_TOOLBAR) within the window, except for themed widgets which are
* transformed or have effects applied to them (e.g. CSS opacity or
* filters).
* This could sometimes be called during display list construction
* outside of painting.
* If called during painting, it will be called before we actually
* paint anything.
*/
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0;
/**
* Informs the widget about the region of the window that is partially
* transparent. Widgets should assume that the initial transparent
* region is empty.
*
* @param aTransparentRegion the region of the window that is partially
* transparent.
*/
virtual void UpdateTransparentRegion(const nsIntRegion &aTransparentRegion) {};
/** /**
* Internal methods * Internal methods
@ -1251,6 +1284,19 @@ class nsIWidget : public nsISupports {
*/ */
NS_IMETHOD CancelIMEComposition() = 0; NS_IMETHOD CancelIMEComposition() = 0;
/*
* Notifies the IME if the input context changes.
*
* aContext cannot be null.
* Set mStatus to 'Enabled' or 'Disabled' or 'Password'.
*/
NS_IMETHOD SetInputMode(const IMEContext& aContext) = 0;
/*
* Get IME is 'Enabled' or 'Disabled' or 'Password' and other input context
*/
NS_IMETHOD GetInputMode(IMEContext& aContext) = 0;
/** /**
* Set accelerated rendering to 'True' or 'False' * Set accelerated rendering to 'True' or 'False'
*/ */
@ -1383,71 +1429,4 @@ protected:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)
class nsIWidget_MOZILLA_2_0_BRANCH : public nsIWidget {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWIDGET_MOZILLA_2_0_BRANCH_IID)
typedef mozilla::layers::LayerManager LayerManager;
/*
* Notifies the IME if the input context changes.
*
* aContext cannot be null.
* Set mStatus to 'Enabled' or 'Disabled' or 'Password'.
*/
NS_IMETHOD SetInputMode(const IMEContext& aContext) = 0;
/*
* Get IME is 'Enabled' or 'Disabled' or 'Password' and other input context
*/
NS_IMETHOD GetInputMode(IMEContext& aContext) = 0;
enum LayerManagerPersistence
{
LAYER_MANAGER_CURRENT = 0,
LAYER_MANAGER_PERSISTENT
};
virtual LayerManager *GetLayerManager(LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nsnull) = 0;
// Hide build warnings about nsIWidget::GetLayerManager being hidden by
// our GetLayerManager method above.
using nsIWidget::GetLayerManager;
/**
* Called after the LayerManager draws the layer tree
*
* @param aManager The drawing LayerManager.
* @param aRect Current widget rect that is being drawn.
*/
virtual void DrawOver(LayerManager* aManager, nsIntRect aRect) = 0;
/**
* Called when Gecko knows which themed widgets exist in this window.
* The passed array contains an entry for every themed widget of the right
* type (currently only NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR and
* NS_THEME_TOOLBAR) within the window, except for themed widgets which are
* transformed or have effects applied to them (e.g. CSS opacity or
* filters).
* This could sometimes be called during display list construction
* outside of painting.
* If called during painting, it will be called before we actually
* paint anything.
*/
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0;
/**
* Informs the widget about the region of the window that is partially
* transparent. Widgets should assume that the initial transparent
* region is empty.
*
* @param aTransparentRegion the region of the window that is partially
* transparent.
*/
virtual void UpdateTransparentRegion(const nsIntRegion &aTransparentRegion) {};
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget_MOZILLA_2_0_BRANCH, NS_IWIDGET_MOZILLA_2_0_BRANCH_IID)
#endif // nsIWidget_h__ #endif // nsIWidget_h__

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

@ -2171,9 +2171,9 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
return TRUE; return TRUE;
} }
if (GetLayerManager(nsnull)->GetBackendType() == LayerManager::LAYERS_OPENGL) if (GetLayerManager()->GetBackendType() == LayerManager::LAYERS_OPENGL)
{ {
LayerManagerOGL *manager = static_cast<LayerManagerOGL*>(GetLayerManager(nsnull)); LayerManagerOGL *manager = static_cast<LayerManagerOGL*>(GetLayerManager());
manager->SetClippingRegion(event.region); manager->SetClippingRegion(event.region);
nsEventStatus status; nsEventStatus status;

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

@ -750,7 +750,7 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
: mWidget(aWidget) : mWidget(aWidget)
{ {
BasicLayerManager* manager = BasicLayerManager* manager =
static_cast<BasicLayerManager*>(mWidget->GetLayerManager(nsnull)); static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
if (manager) { if (manager) {
NS_ASSERTION(manager->GetBackendType() == LayerManager::LAYERS_BASIC, NS_ASSERTION(manager->GetBackendType() == LayerManager::LAYERS_BASIC,
"AutoLayerManagerSetup instantiated for non-basic layer backend!"); "AutoLayerManagerSetup instantiated for non-basic layer backend!");
@ -761,7 +761,7 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup() nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup()
{ {
BasicLayerManager* manager = BasicLayerManager* manager =
static_cast<BasicLayerManager*>(mWidget->GetLayerManager(nsnull)); static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
if (manager) { if (manager) {
NS_ASSERTION(manager->GetBackendType() == LayerManager::LAYERS_BASIC, NS_ASSERTION(manager->GetBackendType() == LayerManager::LAYERS_BASIC,
"AutoLayerManagerSetup instantiated for non-basic layer backend!"); "AutoLayerManagerSetup instantiated for non-basic layer backend!");
@ -863,11 +863,6 @@ nsBaseWidget::GetShouldAccelerate()
return mUseAcceleratedRendering; return mUseAcceleratedRendering;
} }
LayerManager* nsBaseWidget::GetLayerManager(bool* aAllowRetaining)
{
return GetLayerManager(LAYER_MANAGER_CURRENT, aAllowRetaining);
}
LayerManager* nsBaseWidget::GetLayerManager(LayerManagerPersistence, LayerManager* nsBaseWidget::GetLayerManager(LayerManagerPersistence,
bool* aAllowRetaining) bool* aAllowRetaining)
{ {

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

@ -62,7 +62,7 @@ class gfxContext;
* class, but it gives them a head start.) * class, but it gives them a head start.)
*/ */
class nsBaseWidget : public nsIWidget_MOZILLA_2_0_BRANCH class nsBaseWidget : public nsIWidget
{ {
friend class nsAutoRollup; friend class nsAutoRollup;
@ -115,9 +115,10 @@ public:
NS_IMETHOD MakeFullScreen(PRBool aFullScreen); NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
virtual nsIDeviceContext* GetDeviceContext(); virtual nsIDeviceContext* GetDeviceContext();
virtual nsIToolkit* GetToolkit(); virtual nsIToolkit* GetToolkit();
virtual LayerManager* GetLayerManager(bool *aAllowRetaining = nsnull); virtual LayerManager* GetLayerManager(LayerManagerPersistence aPersistence,
virtual LayerManager* GetLayerManager(LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nsnull); bool* aAllowRetaining = nsnull);
using nsIWidget::GetLayerManager;
virtual void DrawOver(LayerManager* aManager, nsIntRect aRect) {} virtual void DrawOver(LayerManager* aManager, nsIntRect aRect) {}
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {} virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}
virtual gfxASurface* GetThebesSurface(); virtual gfxASurface* GetThebesSurface();