Bug 510149 - Changes to nsLayoutUtils::GetFrameTransparency. r=roc

--HG--
extra : rebase_source : 024d18340b423827524eb725d961d0907b90338d
This commit is contained in:
Markus Stange 2009-08-14 10:08:13 +12:00
Родитель 87be8be824
Коммит f2ba84dee3
4 изменённых файлов: 21 добавлений и 19 удалений

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

@ -3036,31 +3036,34 @@ nsLayoutUtils::HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
}
/* static */ nsTransparencyMode
nsLayoutUtils::GetFrameTransparency(nsIFrame* aFrame) {
if (aFrame->GetStyleContext()->GetStyleDisplay()->mOpacity < 1.0f)
nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
nsIFrame* aCSSRootFrame) {
if (aCSSRootFrame->GetStyleContext()->GetStyleDisplay()->mOpacity < 1.0f)
return eTransparencyTransparent;
if (HasNonZeroCorner(aFrame->GetStyleContext()->GetStyleBorder()->mBorderRadius))
if (HasNonZeroCorner(aCSSRootFrame->GetStyleContext()->GetStyleBorder()->mBorderRadius))
return eTransparencyTransparent;
nsTransparencyMode transparency;
if (aFrame->IsThemed(&transparency))
if (aCSSRootFrame->IsThemed(&transparency))
return transparency;
if (aFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
return eTransparencyGlass;
// We need an uninitialized window to be treated as opaque because
// doing otherwise breaks window display effects on some platforms,
// specifically Vista. (bug 450322)
if (aFrame->GetType() == nsGkAtoms::viewportFrame &&
!aFrame->GetFirstChild(nsnull)) {
if (aBackgroundFrame->GetType() == nsGkAtoms::viewportFrame &&
!aBackgroundFrame->GetFirstChild(nsnull)) {
return eTransparencyOpaque;
}
const nsStyleBackground* bg;
if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg))
if (!nsCSSRendering::FindBackground(aBackgroundFrame->PresContext(),
aBackgroundFrame, &bg)) {
return eTransparencyTransparent;
}
if (NS_GET_A(bg->mBackgroundColor) < 255 ||
// bottom layer's clip is used for the color
bg->BottomLayer().mClip != NS_STYLE_BG_CLIP_BORDER)

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

@ -961,10 +961,16 @@ public:
/**
* Determine if a widget is likely to require transparency or translucency.
* @param aFrame the frame of a <window>, <popup> or <menupopup> element.
* @param aBackgroundFrame The frame that the background is set on. For
* <window>s, this will be the canvas frame.
* @param aCSSRootFrame The frame that holds CSS properties affecting
* the widget's transparency. For menupopups,
* aBackgroundFrame and aCSSRootFrame will be the
* same.
* @return a value suitable for passing to SetWindowTranslucency
*/
static nsTransparencyMode GetFrameTransparency(nsIFrame* aFrame);
static nsTransparencyMode GetFrameTransparency(nsIFrame* aBackgroundFrame,
nsIFrame* aCSSRootFrame);
/**
* Get textrun construction flags determined by a given style; in particular

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

@ -539,14 +539,7 @@ nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
if (!rootFrame)
return;
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(aFrame);
// The issue here is that the CSS 'background' propagates from the root
// element's frame (rootFrame) to the real root frame (nsViewportFrame),
// so we need to call GetFrameTransparency on that. But -moz-appearance
// does not propagate so we need to check that directly on rootFrame.
if (NS_THEME_WIN_GLASS == rootFrame->GetStyleDisplay()->mAppearance) {
mode = eTransparencyGlass;
}
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(aFrame, rootFrame);
nsIWidget* viewWidget = aView->GetWidget();
viewWidget->SetTransparencyMode(mode);
windowWidget->SetWindowShadowStyle(rootFrame->GetStyleUIReset()->mWindowShadow);

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

@ -251,7 +251,7 @@ nsMenuPopupFrame::CreateWidgetForView(nsIView* aView)
widgetData.clipSiblings = PR_TRUE;
widgetData.mPopupHint = mPopupType;
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(this);
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(this, this);
PRBool viewHasTransparentContent = !mInContentShell &&
(eTransparencyTransparent ==
mode);