Bug 633282 - Change up widget's UpdateTransparentRegion to UpdateOpaqueRegion. r=roc.

This commit is contained in:
Jim Mathies 2011-05-13 11:40:46 -05:00
Родитель e94a0e080e
Коммит 07f280185f
3 изменённых файлов: 12 добавлений и 21 удалений

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

@ -117,8 +117,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#endif #endif
#define NS_IWIDGET_IID \ #define NS_IWIDGET_IID \
{ 0xe5c2efd1, 0xfbae, 0x4a74, \ { 0xac809e35, 0x632c, 0x448d, \
{ 0xb2, 0xeb, 0xf3, 0x49, 0xf5, 0x72, 0xca, 0x71 } } { 0x9e, 0x34, 0x11, 0x62, 0x32, 0x60, 0x5e, 0xe6 } }
/* /*
* Window shadow styles * Window shadow styles
@ -939,14 +939,11 @@ class nsIWidget : public nsISupports {
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0; virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0;
/** /**
* Informs the widget about the region of the window that is partially * Informs the widget about the region of the window that is opaque.
* transparent. Widgets should assume that the initial transparent
* region is empty.
* *
* @param aTransparentRegion the region of the window that is partially * @param aOpaqueRegion the region of the window that is opaque.
* transparent.
*/ */
virtual void UpdateTransparentRegion(const nsIntRegion &aTransparentRegion) {}; virtual void UpdateOpaqueRegion(const nsIntRegion &aOpaqueRegion) {};
/** /**
* Internal methods * Internal methods

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

@ -2506,27 +2506,18 @@ RegionFromArray(const nsTArray<nsIntRect>& aRects)
return region; return region;
} }
void nsWindow::UpdateTransparentRegion(const nsIntRegion &aTransparentRegion) void nsWindow::UpdateOpaqueRegion(const nsIntRegion &aOpaqueRegion)
{ {
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
if (!HasGlass() || GetParent()) if (!HasGlass() || GetParent())
return; return;
nsIntRect clientBounds;
GetClientBounds(clientBounds);
// calculate the known fully opaque region by subtracting the transparent
// areas from client bounds. We'll use this to calculate our new glass
// bounds.
nsIntRegion opaqueRegion;
opaqueRegion.Sub(clientBounds, aTransparentRegion);
// If there is no opaque region or hidechrome=true, set margins // If there is no opaque region or hidechrome=true, set margins
// to support a full sheet of glass. Comments in MSDN indicate // to support a full sheet of glass. Comments in MSDN indicate
// all values must be set to -1 to get a full sheet of glass. // all values must be set to -1 to get a full sheet of glass.
MARGINS margins = { -1, -1, -1, -1 }; MARGINS margins = { -1, -1, -1, -1 };
bool visiblePlugin = false; bool visiblePlugin = false;
if (!opaqueRegion.IsEmpty()) { if (!aOpaqueRegion.IsEmpty()) {
nsIntRect pluginBounds; nsIntRect pluginBounds;
for (nsIWidget* child = GetFirstChild(); child; child = child->GetNextSibling()) { for (nsIWidget* child = GetFirstChild(); child; child = child->GetNextSibling()) {
nsWindowType type; nsWindowType type;
@ -2547,11 +2538,14 @@ void nsWindow::UpdateTransparentRegion(const nsIntRegion &aTransparentRegion)
} }
} }
nsIntRect clientBounds;
GetClientBounds(clientBounds);
// Find the largest rectangle and use that to calculate the inset. Our top // Find the largest rectangle and use that to calculate the inset. Our top
// priority is to include the bounds of all plugins. // priority is to include the bounds of all plugins.
// Also don't let MIN_OPAQUE_RECT_HEIGHT_FOR_GLASS_MARGINS override content // Also don't let MIN_OPAQUE_RECT_HEIGHT_FOR_GLASS_MARGINS override content
// that contains a visible plugin since glass over plugins looks bad. // that contains a visible plugin since glass over plugins looks bad.
nsIntRect largest = opaqueRegion.GetLargestRectangle(pluginBounds); nsIntRect largest = aOpaqueRegion.GetLargestRectangle(pluginBounds);
if (visiblePlugin || if (visiblePlugin ||
(largest.x <= MAX_HORIZONTAL_GLASS_MARGIN && (largest.x <= MAX_HORIZONTAL_GLASS_MARGIN &&
clientBounds.width - largest.XMost() <= MAX_HORIZONTAL_GLASS_MARGIN && clientBounds.width - largest.XMost() <= MAX_HORIZONTAL_GLASS_MARGIN &&

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

@ -184,7 +184,7 @@ public:
#ifdef MOZ_XUL #ifdef MOZ_XUL
virtual void SetTransparencyMode(nsTransparencyMode aMode); virtual void SetTransparencyMode(nsTransparencyMode aMode);
virtual nsTransparencyMode GetTransparencyMode(); virtual nsTransparencyMode GetTransparencyMode();
virtual void UpdateTransparentRegion(const nsIntRegion& aTransparentRegion); virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion);
#endif // MOZ_XUL #endif // MOZ_XUL
#ifdef NS_ENABLE_TSF #ifdef NS_ENABLE_TSF
NS_IMETHOD OnIMEFocusChange(PRBool aFocus); NS_IMETHOD OnIMEFocusChange(PRBool aFocus);