Bug 633282 - Accumulate exclude glass regions during painting and update the widget opaque region info. r=roc.

This commit is contained in:
Jim Mathies 2011-05-13 11:40:46 -05:00
parent 2a4de6175a
commit 4dc93bdb14
3 changed files with 28 additions and 4 deletions

View File

@ -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<ThemeGeometry,2> mThemeGeometries;
nsDisplayTableItem* mCurrentTableItem;
const nsRegion* mFinalTransparentRegion;
nsRegion mExcludedGlassRegion;
Mode mMode;
PRPackedBool mBuildCaret;
PRPackedBool mIgnoreSuppression;

View File

@ -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);
}
}

View File

@ -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;