From f69ffc31d7b40c6277ad8fe99a9bf06629b4a453 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Fri, 13 May 2011 11:40:46 -0500 Subject: [PATCH] Bug 633282 - Change up widget's UpdateTransparentRegion to UpdateOpaqueRegion. r=roc. --- widget/public/nsIWidget.h | 13 +++++-------- widget/src/windows/nsWindow.cpp | 18 ++++++------------ widget/src/windows/nsWindow.h | 2 +- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/widget/public/nsIWidget.h b/widget/public/nsIWidget.h index 3c0c494ba76d..fc45b9aee629 100644 --- a/widget/public/nsIWidget.h +++ b/widget/public/nsIWidget.h @@ -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& 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 diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index fe6b637f0542..efb5b794d002 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -2506,27 +2506,18 @@ RegionFromArray(const nsTArray& 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 && diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index db51701212c3..75a2b4bb7831 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -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);