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
Родитель ada37f0740
Коммит f69ffc31d7
3 изменённых файлов: 12 добавлений и 21 удалений

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

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

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

@ -2506,27 +2506,18 @@ RegionFromArray(const nsTArray<nsIntRect>& aRects)
return region;
}
void nsWindow::UpdateTransparentRegion(const nsIntRegion &aTransparentRegion)
void nsWindow::UpdateOpaqueRegion(const nsIntRegion &aOpaqueRegion)
{
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
if (!HasGlass() || GetParent())
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
// 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.
MARGINS margins = { -1, -1, -1, -1 };
bool visiblePlugin = false;
if (!opaqueRegion.IsEmpty()) {
if (!aOpaqueRegion.IsEmpty()) {
nsIntRect pluginBounds;
for (nsIWidget* child = GetFirstChild(); child; child = child->GetNextSibling()) {
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
// priority is to include the bounds of all plugins.
// Also don't let MIN_OPAQUE_RECT_HEIGHT_FOR_GLASS_MARGINS override content
// that contains a visible plugin since glass over plugins looks bad.
nsIntRect largest = opaqueRegion.GetLargestRectangle(pluginBounds);
nsIntRect largest = aOpaqueRegion.GetLargestRectangle(pluginBounds);
if (visiblePlugin ||
(largest.x <= MAX_HORIZONTAL_GLASS_MARGIN &&
clientBounds.width - largest.XMost() <= MAX_HORIZONTAL_GLASS_MARGIN &&

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

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