Bug 1052900. Restore -moz-win-exclude-glass handling to the way it worked before. r=tn

This commit is contained in:
Robert O'Callahan 2014-10-29 12:33:52 +13:00
parent 18015b4ea7
commit d581d9a17c
3 changed files with 25 additions and 4 deletions

View File

@ -679,7 +679,26 @@ public:
* Accumulates the bounds of box frames that have moz-appearance
* -moz-win-exclude-glass style. Used in setting glass margins on
* Windows.
*/
*
* We set the window opaque region (from which glass margins are computed)
* to the intersection of the glass region specified here and the opaque
* region computed during painting. So the excluded glass region actually
* *limits* the extent of the opaque area reported to Windows. We limit it
* so that changes to the computed opaque region (which can vary based on
* region optimizations and the placement of UI elements) outside the
* -moz-win-exclude-glass area don't affect the glass margins reported to
* Windows; changing those margins willy-nilly can cause the Windows 7 glass
* haze effect to jump around disconcertingly.
*/
void AddWindowExcludeGlassRegion(const nsRegion& bounds) {
mWindowExcludeGlassRegion.Or(mWindowExcludeGlassRegion, bounds);
}
const nsRegion& GetWindowExcludeGlassRegion() {
return mWindowExcludeGlassRegion;
}
/**
* Accumulates opaque stuff into the window opaque region.
*/
void AddWindowOpaqueRegion(const nsRegion& bounds) {
mWindowOpaqueRegion.Or(mWindowOpaqueRegion, bounds);
}
@ -783,6 +802,7 @@ private:
mutable mozilla::DebugOnly<bool> mWillChangeBudgetCalculated;
// Relative to mCurrentFrame.
nsRect mDirtyRect;
nsRegion mWindowExcludeGlassRegion;
nsRegion mWindowOpaqueRegion;
nsRegion mWindowDraggingRegion;
// The display item for the Windows window glass background, if any

View File

@ -3142,11 +3142,12 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
!(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget *widget = aFrame->GetNearestWidget();
if (widget) {
nsRegion opaqueRegion = builder.GetWindowOpaqueRegion();
nsRegion opaqueRegion;
opaqueRegion.And(builder.GetWindowExcludeGlassRegion(), builder.GetWindowOpaqueRegion());
widget->UpdateOpaqueRegion(
opaqueRegion.ToNearestPixels(presContext->AppUnitsPerDevPixel()));
nsRegion draggingRegion = builder.GetWindowDraggingRegion();
const nsRegion& draggingRegion = builder.GetWindowDraggingRegion();
widget->UpdateWindowDraggingRegion(
draggingRegion.ToNearestPixels(presContext->AppUnitsPerDevPixel()));
}

View File

@ -1330,7 +1330,7 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// in calculating glass margins on Windows.
const nsStyleDisplay* styles = StyleDisplay();
if (styles && styles->mAppearance == NS_THEME_WIN_EXCLUDE_GLASS) {
aBuilder->AddWindowOpaqueRegion(
aBuilder->AddWindowExcludeGlassRegion(
nsRect(aBuilder->ToReferenceFrame(this), GetSize()));
}