changes to support opacity.

git-svn-id: svn://10.0.0.236/trunk@13381 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
michaelp%netscape.com 1998-10-23 17:54:23 +00:00
parent 5a61e26e0e
commit 3e01c94cf4
7 changed files with 24 additions and 46 deletions

View File

@ -87,7 +87,6 @@ void StyleColorImpl::ResetFrom(const nsStyleColor* aParent, nsIPresContext* aPre
{
if (nsnull != aParent) {
mColor = aParent->mColor;
mOpacity = aParent->mOpacity;
}
else {
if (nsnull != aPresContext) {
@ -96,9 +95,10 @@ void StyleColorImpl::ResetFrom(const nsStyleColor* aParent, nsIPresContext* aPre
else {
mColor = NS_RGB(0x00, 0x00, 0x00);
}
mOpacity = 1.0F;
}
mOpacity = 1.0f;
mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT;
mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY;

View File

@ -65,7 +65,7 @@ struct nsStyleColor : public nsStyleStruct {
PRUint8 mCursor; // [reset] See nsStyleConsts.h NS_STYLE_CURSOR_*
nsString mCursorImage; // [reset] url string
float mOpacity; // [inherited] percentage
float mOpacity; // [reset] percentage
protected:
nsStyleColor(void);

View File

@ -87,7 +87,6 @@ void StyleColorImpl::ResetFrom(const nsStyleColor* aParent, nsIPresContext* aPre
{
if (nsnull != aParent) {
mColor = aParent->mColor;
mOpacity = aParent->mOpacity;
}
else {
if (nsnull != aPresContext) {
@ -96,9 +95,10 @@ void StyleColorImpl::ResetFrom(const nsStyleColor* aParent, nsIPresContext* aPre
else {
mColor = NS_RGB(0x00, 0x00, 0x00);
}
mOpacity = 1.0F;
}
mOpacity = 1.0f;
mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT;
mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY;

View File

@ -440,29 +440,17 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
aFrame->GetView(view);
// If we don't yet have a view; see if we need a view
if (nsnull == view) {
// We don't yet have a view; see if we need a view
// Get my nsStyleColor
const nsStyleColor* myColor = (const nsStyleColor*)
aStyleContext->GetStyleData(eStyleStruct_Color);
// See if the opacity is not the same as the geometric parent
// frames opacity.
if (!aForce) {
nsIFrame* parent;
aFrame->GetGeometricParent(parent);
if (nsnull != parent) {
// Get parent's nsStyleColor
const nsStyleColor* parentColor;
parent->GetStyleData(eStyleStruct_Color,
(const nsStyleStruct*&)parentColor);
// If the opacities are different then I need a view
if (myColor->mOpacity != parentColor->mOpacity) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p opacity=%g parentOpacity=%g",
aFrame, myColor->mOpacity, parentColor->mOpacity));
aForce = PR_TRUE;
}
}
if (myColor->mOpacity != 1.0f) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p opacity=%g",
aFrame, myColor->mOpacity));
aForce = PR_TRUE;
}
// See if the frame is being relatively positioned
@ -518,6 +506,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
if (NS_STYLE_BG_COLOR_TRANSPARENT & myColor->mBackgroundFlags) {
viewManager->SetViewContentTransparency(view, PR_TRUE);
}
viewManager->SetViewOpacity(view, myColor->mOpacity);
NS_RELEASE(viewManager);
}

View File

@ -872,7 +872,7 @@ nsBodyFrame::CreateAbsoluteView(nsIStyleContext* aStyleContext) const
nsnull, nsnull, zIndex, pClip);
viewManager->InsertChild(containingView, view, 0);
//XXX this needs to be conditional...
viewManager->SetViewContentTransparency(view, PR_TRUE);
viewManager->SetViewContentTransparency(view, PR_FALSE);
viewManager->SetViewOpacity(view, color->mOpacity);
NS_RELEASE(viewManager);
}

View File

@ -440,29 +440,17 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
aFrame->GetView(view);
// If we don't yet have a view; see if we need a view
if (nsnull == view) {
// We don't yet have a view; see if we need a view
// Get my nsStyleColor
const nsStyleColor* myColor = (const nsStyleColor*)
aStyleContext->GetStyleData(eStyleStruct_Color);
// See if the opacity is not the same as the geometric parent
// frames opacity.
if (!aForce) {
nsIFrame* parent;
aFrame->GetGeometricParent(parent);
if (nsnull != parent) {
// Get parent's nsStyleColor
const nsStyleColor* parentColor;
parent->GetStyleData(eStyleStruct_Color,
(const nsStyleStruct*&)parentColor);
// If the opacities are different then I need a view
if (myColor->mOpacity != parentColor->mOpacity) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p opacity=%g parentOpacity=%g",
aFrame, myColor->mOpacity, parentColor->mOpacity));
aForce = PR_TRUE;
}
}
if (myColor->mOpacity != 1.0f) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p opacity=%g",
aFrame, myColor->mOpacity));
aForce = PR_TRUE;
}
// See if the frame is being relatively positioned
@ -518,6 +506,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
if (NS_STYLE_BG_COLOR_TRANSPARENT & myColor->mBackgroundFlags) {
viewManager->SetViewContentTransparency(view, PR_TRUE);
}
viewManager->SetViewOpacity(view, myColor->mOpacity);
NS_RELEASE(viewManager);
}

View File

@ -87,7 +87,6 @@ void StyleColorImpl::ResetFrom(const nsStyleColor* aParent, nsIPresContext* aPre
{
if (nsnull != aParent) {
mColor = aParent->mColor;
mOpacity = aParent->mOpacity;
}
else {
if (nsnull != aPresContext) {
@ -96,9 +95,10 @@ void StyleColorImpl::ResetFrom(const nsStyleColor* aParent, nsIPresContext* aPre
else {
mColor = NS_RGB(0x00, 0x00, 0x00);
}
mOpacity = 1.0F;
}
mOpacity = 1.0f;
mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT;
mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY;