diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 8aca154cb401..2bdc5e422f59 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -470,6 +470,18 @@ public: return CurrentPresShellState()->mPresShell->GetPresContext(); } + /** + * Accumulates the bounds of box frames that have moz-appearance + * -moz-win-exclude-glass style. Used in setting glass margins on + * Windows. + */ + void AddExcludedGlassRegion(nsRect &bounds) { + mExcludedGlassRegion.Or(mExcludedGlassRegion, bounds); + } + const nsRegion& GetExcludedGlassRegion() { + return mExcludedGlassRegion; + } + private: void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame, const nsRect& aDirtyRect); @@ -496,6 +508,7 @@ private: nsAutoTArray mThemeGeometries; nsDisplayTableItem* mCurrentTableItem; const nsRegion* mFinalTransparentRegion; + nsRegion mExcludedGlassRegion; Mode mMode; PRPackedBool mBuildCaret; PRPackedBool mIgnoreSuppression; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index f000f258ad73..04714ba28bf4 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1636,16 +1636,17 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram list.PaintRoot(&builder, aRenderingContext, flags); - // Update the widget's transparent region information. This sets + // Update the widget's opaque region information. This sets // glass boundaries on Windows. if ((aFlags & PAINT_WIDGET_LAYERS) && !willFlushRetainedLayers && !(aFlags & PAINT_DOCUMENT_RELATIVE)) { nsIWidget *widget = aFrame->GetNearestWidget(); if (widget) { - PRInt32 pixelRatio = presContext->AppUnitsPerDevPixel(); - nsIntRegion visibleWindowRegion(visibleRegion.ToOutsidePixels(pixelRatio)); - widget->UpdateTransparentRegion(visibleWindowRegion); + nsRegion excludedRegion = builder.GetExcludedGlassRegion(); + excludedRegion.Sub(excludedRegion, visibleRegion); + nsIntRegion windowRegion(excludedRegion.ToNearestPixels(presContext->AppUnitsPerDevPixel())); + widget->UpdateOpaqueRegion(windowRegion); } } diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 03a7dab2df5c..bba01f858eda 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -1299,6 +1299,16 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, GetContent()->HasAttr(kNameSpaceID_None, nsGkAtoms::layer) && GetContent()->IsXUL(); + // Check for frames that are marked as a part of the region used + // in calculating glass margins on Windows. + if (GetContent()->IsXUL()) { + const nsStyleDisplay* styles = mStyleContext->GetStyleDisplay(); + if (styles && styles->mAppearance == NS_THEME_WIN_EXCLUDE_GLASS) { + nsRect rect = mRect + aBuilder->ToReferenceFrame(this); + aBuilder->AddExcludedGlassRegion(rect); + } + } + nsDisplayListCollection tempLists; const nsDisplayListSet& destination = forceLayer ? tempLists : aLists;