зеркало из https://github.com/mozilla/pjs.git
Bug 212366. Make '-moz-opacity' behave like CSS3 opacity: it does not inherit by default, and it composites the element and all its children as a group. r+sr=dbaron
This commit is contained in:
Родитель
ea9b76f64c
Коммит
f60aa658cf
|
@ -2509,6 +2509,15 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
|
|||
parentDisplay = parentContext->GetStyleDisplay();
|
||||
PRBool inherited = aInherited;
|
||||
|
||||
// opacity: factor, inherit
|
||||
if (eCSSUnit_Number == displayData.mOpacity.GetUnit()) {
|
||||
display->mOpacity = displayData.mOpacity.GetFloatValue();
|
||||
}
|
||||
else if (eCSSUnit_Inherit == displayData.mOpacity.GetUnit()) {
|
||||
inherited = PR_TRUE;
|
||||
display->mOpacity = parentDisplay->mOpacity;
|
||||
}
|
||||
|
||||
// display: enum, none, inherit
|
||||
if (eCSSUnit_Enumerated == displayData.mDisplay.GetUnit()) {
|
||||
display->mDisplay = displayData.mDisplay.GetIntValue();
|
||||
|
@ -2769,15 +2778,6 @@ nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct,
|
|||
if (!parentVisibility)
|
||||
parentVisibility = visibility;
|
||||
|
||||
// opacity: factor, inherit
|
||||
if (eCSSUnit_Number == displayData.mOpacity.GetUnit()) {
|
||||
visibility->mOpacity = displayData.mOpacity.GetFloatValue();
|
||||
}
|
||||
else if (eCSSUnit_Inherit == displayData.mOpacity.GetUnit()) {
|
||||
inherited = PR_TRUE;
|
||||
visibility->mOpacity = parentVisibility->mOpacity;
|
||||
}
|
||||
|
||||
// direction: enum, inherit
|
||||
if (eCSSUnit_Enumerated == displayData.mDirection.GetUnit()) {
|
||||
visibility->mDirection = displayData.mDirection.GetIntValue();
|
||||
|
|
|
@ -711,9 +711,10 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
|
|||
// DISPLAY
|
||||
IndentBy(out,aIndent);
|
||||
const nsStyleDisplay* disp = GetStyleDisplay();
|
||||
fprintf(out, "<display data=\"%d %d %d %d %d %d %d %d %ld %ld %ld %ld %s\" />\n",
|
||||
fprintf(out, "<display data=\"%d %d %f %d %d %d %d %d %d %ld %ld %ld %ld %s\" />\n",
|
||||
(int)disp->mPosition,
|
||||
(int)disp->mDisplay,
|
||||
(float)disp->mOpacity,
|
||||
(int)disp->mFloats,
|
||||
(int)disp->mBreakType,
|
||||
(int)disp->mBreakBefore,
|
||||
|
@ -730,10 +731,9 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
|
|||
// VISIBILITY
|
||||
IndentBy(out,aIndent);
|
||||
const nsStyleVisibility* vis = GetStyleVisibility();
|
||||
fprintf(out, "<visibility data=\"%d %d %f\" />\n",
|
||||
fprintf(out, "<visibility data=\"%d %d\" />\n",
|
||||
(int)vis->mDirection,
|
||||
(int)vis->mVisible,
|
||||
(float)vis->mOpacity
|
||||
(int)vis->mVisible
|
||||
);
|
||||
|
||||
// TABLE
|
||||
|
|
|
@ -460,12 +460,11 @@ nsComputedDOMStyle::GetOpacity(nsIFrame *aFrame,
|
|||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
const nsStyleVisibility *visibility = nsnull;
|
||||
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)visibility,
|
||||
aFrame);
|
||||
const nsStyleDisplay *display = nsnull;
|
||||
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
||||
|
||||
if (visibility) {
|
||||
val->SetNumber(visibility->mOpacity);
|
||||
if (display) {
|
||||
val->SetNumber(display->mOpacity);
|
||||
} else {
|
||||
val->SetNumber(1.0f);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,6 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
|
|||
nsCSSValue inherit(eCSSUnit_Inherit);
|
||||
aData->mDisplayData->mVisibility = inherit;
|
||||
aData->mDisplayData->mDirection = inherit;
|
||||
aData->mDisplayData->mOpacity = inherit;
|
||||
}
|
||||
|
||||
if (aData->mSID == eStyleStruct_Display) {
|
||||
|
@ -175,6 +174,9 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
|
|||
aData->mDisplayData->mClip.mBottom = autovalue;
|
||||
aData->mDisplayData->mClip.mLeft = autovalue;
|
||||
|
||||
nsCSSValue one(1.0f, eCSSUnit_Number);
|
||||
aData->mDisplayData->mOpacity = one;
|
||||
|
||||
nsCSSValue inlinevalue(NS_STYLE_DISPLAY_INLINE, eCSSUnit_Enumerated);
|
||||
aData->mDisplayData->mDisplay = inlinevalue;
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ CSS_PROP_POSITION(max-height, max_height, MaxHeight, Position, mMaxHeight, eCSST
|
|||
CSS_PROP_POSITION(max-width, max_width, MaxWidth, Position, mMaxWidth, eCSSType_Value, PR_TRUE)
|
||||
CSS_PROP_POSITION(min-height, min_height, MinHeight, Position, mMinHeight, eCSSType_Value, PR_TRUE)
|
||||
CSS_PROP_POSITION(min-width, min_width, MinWidth, Position, mMinWidth, eCSSType_Value, PR_TRUE)
|
||||
CSS_PROP_VISIBILITY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
|
||||
CSS_PROP_DISPLAY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
|
||||
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, Breaks, mOrphans, eCSSType_Value, PR_FALSE)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor)
|
||||
|
|
|
@ -702,7 +702,6 @@ struct nsStyleVisibility : public nsStyleStruct {
|
|||
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
||||
PRUint8 mVisible; // [inherited]
|
||||
nsCOMPtr<nsILanguageAtom> mLanguage; // [inherited]
|
||||
float mOpacity; // [inherited]
|
||||
|
||||
PRBool IsVisible() const {
|
||||
return (mVisible == NS_STYLE_VISIBILITY_VISIBLE);
|
||||
|
@ -742,6 +741,7 @@ struct nsStyleDisplay : public nsStyleStruct {
|
|||
#else
|
||||
nsRect mClip; // [reset] offsets from upper-left border edge
|
||||
#endif
|
||||
float mOpacity; // [reset]
|
||||
PRUint8 mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
|
||||
PRUint8 mOriginalDisplay; // [reset] saved mDisplay for position:absolute/fixed
|
||||
PRUint8 mAppearance; // [reset]
|
||||
|
@ -751,7 +751,6 @@ struct nsStyleDisplay : public nsStyleStruct {
|
|||
PRPackedBool mBreakBefore; // [reset]
|
||||
PRPackedBool mBreakAfter; // [reset]
|
||||
PRUint8 mOverflow; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
|
||||
|
|
|
@ -1068,6 +1068,7 @@ nsStyleDisplay::nsStyleDisplay()
|
|||
mOverflow = NS_STYLE_OVERFLOW_VISIBLE;
|
||||
mClipFlags = NS_STYLE_CLIP_AUTO;
|
||||
mClip.SetRect(0,0,0,0);
|
||||
mOpacity = 1.0f;
|
||||
}
|
||||
|
||||
nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
|
||||
|
@ -1084,6 +1085,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
|
|||
mOverflow = aSource.mOverflow;
|
||||
mClipFlags = aSource.mClipFlags;
|
||||
mClip = aSource.mClip;
|
||||
mOpacity = aSource.mOpacity;
|
||||
}
|
||||
|
||||
nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
||||
|
@ -1094,7 +1096,10 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
|||
|| mPosition != aOther.mPosition
|
||||
|| mDisplay != aOther.mDisplay
|
||||
|| mFloats != aOther.mFloats
|
||||
|| mOverflow != aOther.mOverflow)
|
||||
|| mOverflow != aOther.mOverflow
|
||||
// might need to create a view to handle change from 1.0 to partial opacity
|
||||
|| (mOpacity != aOther.mOpacity
|
||||
&& ((mOpacity < 1.0) != (aOther.mOpacity < 1.0))))
|
||||
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
|
||||
|
||||
// XXX the following is conservative, for now: changing float breaking shouldn't
|
||||
|
@ -1106,7 +1111,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
|||
NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_ReflowFrame, nsChangeHint_RepaintFrame));
|
||||
|
||||
if (mClipFlags != aOther.mClipFlags
|
||||
|| mClip != aOther.mClip)
|
||||
|| mClip != aOther.mClip
|
||||
|| mOpacity != aOther.mOpacity)
|
||||
NS_UpdateHint(hint, nsChangeHint_SyncFrameView);
|
||||
|
||||
return hint;
|
||||
|
@ -1127,7 +1133,6 @@ nsStyleVisibility::nsStyleVisibility(nsIPresContext* aPresContext)
|
|||
|
||||
aPresContext->GetLanguage(getter_AddRefs(mLanguage));
|
||||
mVisible = NS_STYLE_VISIBILITY_VISIBLE;
|
||||
mOpacity = 1.0f;
|
||||
}
|
||||
|
||||
nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
|
||||
|
@ -1135,23 +1140,14 @@ nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
|
|||
mDirection = aSource.mDirection;
|
||||
mVisible = aSource.mVisible;
|
||||
mLanguage = aSource.mLanguage;
|
||||
mOpacity = aSource.mOpacity;
|
||||
}
|
||||
|
||||
nsChangeHint nsStyleVisibility::CalcDifference(const nsStyleVisibility& aOther) const
|
||||
{
|
||||
if (mOpacity != aOther.mOpacity
|
||||
&& ((mOpacity < 1.0) != (aOther.mOpacity < 1.0)))
|
||||
// might need to create a view to handle change from 1.0 to partial opacity
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
|
||||
if ((mDirection == aOther.mDirection) &&
|
||||
(mLanguage == aOther.mLanguage)) {
|
||||
if ((mVisible == aOther.mVisible)) {
|
||||
if (mOpacity == aOther.mOpacity)
|
||||
return NS_STYLE_HINT_NONE;
|
||||
else
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
if ((mVisible != aOther.mVisible) &&
|
||||
((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
|
||||
|
|
|
@ -450,8 +450,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
SetView(view);
|
||||
|
||||
// set the opacity
|
||||
viewMan->SetViewOpacity(view, GetStyleColor()->mOpacity);
|
||||
|
||||
viewMan->SetViewOpacity(view, GetStyleDisplay()->mOpacity);
|
||||
}
|
||||
mDidInit = PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -798,13 +798,15 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
|
|||
aStyleContext = aFrame->GetStyleContext();
|
||||
}
|
||||
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
|
||||
|
||||
// Set the view's opacity
|
||||
vm->SetViewOpacity(aView, vis->mOpacity);
|
||||
vm->SetViewOpacity(aView, display->mOpacity);
|
||||
|
||||
// Make sure visibility is correct
|
||||
if (0 == (aFlags & NS_FRAME_NO_VISIBILITY)) {
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
|
||||
// See if the view should be hidden or visible
|
||||
PRBool viewIsVisible = PR_TRUE;
|
||||
|
||||
|
@ -834,7 +836,6 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
|
|||
nsViewVisibility_kHide);
|
||||
}
|
||||
|
||||
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
|
||||
// See if the frame is being relatively positioned or absolutely
|
||||
// positioned
|
||||
PRBool isTopMostView = display->IsPositioned();
|
||||
|
@ -860,9 +861,8 @@ PRBool
|
|||
nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
|
||||
{
|
||||
nsStyleContext* sc = aFrame->GetStyleContext();
|
||||
const nsStyleVisibility* vis = sc->GetStyleVisibility();
|
||||
|
||||
if (vis->mOpacity != 1.0f) {
|
||||
const nsStyleDisplay* display = sc->GetStyleDisplay();
|
||||
if (display->mOpacity != 1.0f) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -877,8 +877,6 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
const nsStyleDisplay* display = sc->GetStyleDisplay();
|
||||
|
||||
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
|
||||
return PR_TRUE;
|
||||
} else if (display->IsAbsolutelyPositioned()) {
|
||||
|
|
|
@ -798,13 +798,15 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
|
|||
aStyleContext = aFrame->GetStyleContext();
|
||||
}
|
||||
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
|
||||
|
||||
// Set the view's opacity
|
||||
vm->SetViewOpacity(aView, vis->mOpacity);
|
||||
vm->SetViewOpacity(aView, display->mOpacity);
|
||||
|
||||
// Make sure visibility is correct
|
||||
if (0 == (aFlags & NS_FRAME_NO_VISIBILITY)) {
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
|
||||
// See if the view should be hidden or visible
|
||||
PRBool viewIsVisible = PR_TRUE;
|
||||
|
||||
|
@ -834,7 +836,6 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
|
|||
nsViewVisibility_kHide);
|
||||
}
|
||||
|
||||
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
|
||||
// See if the frame is being relatively positioned or absolutely
|
||||
// positioned
|
||||
PRBool isTopMostView = display->IsPositioned();
|
||||
|
@ -860,9 +861,8 @@ PRBool
|
|||
nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
|
||||
{
|
||||
nsStyleContext* sc = aFrame->GetStyleContext();
|
||||
const nsStyleVisibility* vis = sc->GetStyleVisibility();
|
||||
|
||||
if (vis->mOpacity != 1.0f) {
|
||||
const nsStyleDisplay* display = sc->GetStyleDisplay();
|
||||
if (display->mOpacity != 1.0f) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -877,8 +877,6 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
const nsStyleDisplay* display = sc->GetStyleDisplay();
|
||||
|
||||
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
|
||||
return PR_TRUE;
|
||||
} else if (display->IsAbsolutelyPositioned()) {
|
||||
|
|
|
@ -450,8 +450,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
SetView(view);
|
||||
|
||||
// set the opacity
|
||||
viewMan->SetViewOpacity(view, GetStyleColor()->mOpacity);
|
||||
|
||||
viewMan->SetViewOpacity(view, GetStyleDisplay()->mOpacity);
|
||||
}
|
||||
mDidInit = PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ CSS_PROP_POSITION(max-height, max_height, MaxHeight, Position, mMaxHeight, eCSST
|
|||
CSS_PROP_POSITION(max-width, max_width, MaxWidth, Position, mMaxWidth, eCSSType_Value, PR_TRUE)
|
||||
CSS_PROP_POSITION(min-height, min_height, MinHeight, Position, mMinHeight, eCSSType_Value, PR_TRUE)
|
||||
CSS_PROP_POSITION(min-width, min_width, MinWidth, Position, mMinWidth, eCSSType_Value, PR_TRUE)
|
||||
CSS_PROP_VISIBILITY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
|
||||
CSS_PROP_DISPLAY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
|
||||
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, Breaks, mOrphans, eCSSType_Value, PR_FALSE)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor)
|
||||
|
|
|
@ -460,12 +460,11 @@ nsComputedDOMStyle::GetOpacity(nsIFrame *aFrame,
|
|||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
const nsStyleVisibility *visibility = nsnull;
|
||||
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)visibility,
|
||||
aFrame);
|
||||
const nsStyleDisplay *display = nsnull;
|
||||
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
||||
|
||||
if (visibility) {
|
||||
val->SetNumber(visibility->mOpacity);
|
||||
if (display) {
|
||||
val->SetNumber(display->mOpacity);
|
||||
} else {
|
||||
val->SetNumber(1.0f);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,6 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
|
|||
nsCSSValue inherit(eCSSUnit_Inherit);
|
||||
aData->mDisplayData->mVisibility = inherit;
|
||||
aData->mDisplayData->mDirection = inherit;
|
||||
aData->mDisplayData->mOpacity = inherit;
|
||||
}
|
||||
|
||||
if (aData->mSID == eStyleStruct_Display) {
|
||||
|
@ -175,6 +174,9 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
|
|||
aData->mDisplayData->mClip.mBottom = autovalue;
|
||||
aData->mDisplayData->mClip.mLeft = autovalue;
|
||||
|
||||
nsCSSValue one(1.0f, eCSSUnit_Number);
|
||||
aData->mDisplayData->mOpacity = one;
|
||||
|
||||
nsCSSValue inlinevalue(NS_STYLE_DISPLAY_INLINE, eCSSUnit_Enumerated);
|
||||
aData->mDisplayData->mDisplay = inlinevalue;
|
||||
|
||||
|
|
|
@ -2509,6 +2509,15 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
|
|||
parentDisplay = parentContext->GetStyleDisplay();
|
||||
PRBool inherited = aInherited;
|
||||
|
||||
// opacity: factor, inherit
|
||||
if (eCSSUnit_Number == displayData.mOpacity.GetUnit()) {
|
||||
display->mOpacity = displayData.mOpacity.GetFloatValue();
|
||||
}
|
||||
else if (eCSSUnit_Inherit == displayData.mOpacity.GetUnit()) {
|
||||
inherited = PR_TRUE;
|
||||
display->mOpacity = parentDisplay->mOpacity;
|
||||
}
|
||||
|
||||
// display: enum, none, inherit
|
||||
if (eCSSUnit_Enumerated == displayData.mDisplay.GetUnit()) {
|
||||
display->mDisplay = displayData.mDisplay.GetIntValue();
|
||||
|
@ -2769,15 +2778,6 @@ nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct,
|
|||
if (!parentVisibility)
|
||||
parentVisibility = visibility;
|
||||
|
||||
// opacity: factor, inherit
|
||||
if (eCSSUnit_Number == displayData.mOpacity.GetUnit()) {
|
||||
visibility->mOpacity = displayData.mOpacity.GetFloatValue();
|
||||
}
|
||||
else if (eCSSUnit_Inherit == displayData.mOpacity.GetUnit()) {
|
||||
inherited = PR_TRUE;
|
||||
visibility->mOpacity = parentVisibility->mOpacity;
|
||||
}
|
||||
|
||||
// direction: enum, inherit
|
||||
if (eCSSUnit_Enumerated == displayData.mDirection.GetUnit()) {
|
||||
visibility->mDirection = displayData.mDirection.GetIntValue();
|
||||
|
|
|
@ -711,9 +711,10 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
|
|||
// DISPLAY
|
||||
IndentBy(out,aIndent);
|
||||
const nsStyleDisplay* disp = GetStyleDisplay();
|
||||
fprintf(out, "<display data=\"%d %d %d %d %d %d %d %d %ld %ld %ld %ld %s\" />\n",
|
||||
fprintf(out, "<display data=\"%d %d %f %d %d %d %d %d %d %ld %ld %ld %ld %s\" />\n",
|
||||
(int)disp->mPosition,
|
||||
(int)disp->mDisplay,
|
||||
(float)disp->mOpacity,
|
||||
(int)disp->mFloats,
|
||||
(int)disp->mBreakType,
|
||||
(int)disp->mBreakBefore,
|
||||
|
@ -730,10 +731,9 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
|
|||
// VISIBILITY
|
||||
IndentBy(out,aIndent);
|
||||
const nsStyleVisibility* vis = GetStyleVisibility();
|
||||
fprintf(out, "<visibility data=\"%d %d %f\" />\n",
|
||||
fprintf(out, "<visibility data=\"%d %d\" />\n",
|
||||
(int)vis->mDirection,
|
||||
(int)vis->mVisible,
|
||||
(float)vis->mOpacity
|
||||
(int)vis->mVisible
|
||||
);
|
||||
|
||||
// TABLE
|
||||
|
|
|
@ -1068,6 +1068,7 @@ nsStyleDisplay::nsStyleDisplay()
|
|||
mOverflow = NS_STYLE_OVERFLOW_VISIBLE;
|
||||
mClipFlags = NS_STYLE_CLIP_AUTO;
|
||||
mClip.SetRect(0,0,0,0);
|
||||
mOpacity = 1.0f;
|
||||
}
|
||||
|
||||
nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
|
||||
|
@ -1084,6 +1085,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
|
|||
mOverflow = aSource.mOverflow;
|
||||
mClipFlags = aSource.mClipFlags;
|
||||
mClip = aSource.mClip;
|
||||
mOpacity = aSource.mOpacity;
|
||||
}
|
||||
|
||||
nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
||||
|
@ -1094,7 +1096,10 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
|||
|| mPosition != aOther.mPosition
|
||||
|| mDisplay != aOther.mDisplay
|
||||
|| mFloats != aOther.mFloats
|
||||
|| mOverflow != aOther.mOverflow)
|
||||
|| mOverflow != aOther.mOverflow
|
||||
// might need to create a view to handle change from 1.0 to partial opacity
|
||||
|| (mOpacity != aOther.mOpacity
|
||||
&& ((mOpacity < 1.0) != (aOther.mOpacity < 1.0))))
|
||||
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
|
||||
|
||||
// XXX the following is conservative, for now: changing float breaking shouldn't
|
||||
|
@ -1106,7 +1111,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
|||
NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_ReflowFrame, nsChangeHint_RepaintFrame));
|
||||
|
||||
if (mClipFlags != aOther.mClipFlags
|
||||
|| mClip != aOther.mClip)
|
||||
|| mClip != aOther.mClip
|
||||
|| mOpacity != aOther.mOpacity)
|
||||
NS_UpdateHint(hint, nsChangeHint_SyncFrameView);
|
||||
|
||||
return hint;
|
||||
|
@ -1127,7 +1133,6 @@ nsStyleVisibility::nsStyleVisibility(nsIPresContext* aPresContext)
|
|||
|
||||
aPresContext->GetLanguage(getter_AddRefs(mLanguage));
|
||||
mVisible = NS_STYLE_VISIBILITY_VISIBLE;
|
||||
mOpacity = 1.0f;
|
||||
}
|
||||
|
||||
nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
|
||||
|
@ -1135,23 +1140,14 @@ nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
|
|||
mDirection = aSource.mDirection;
|
||||
mVisible = aSource.mVisible;
|
||||
mLanguage = aSource.mLanguage;
|
||||
mOpacity = aSource.mOpacity;
|
||||
}
|
||||
|
||||
nsChangeHint nsStyleVisibility::CalcDifference(const nsStyleVisibility& aOther) const
|
||||
{
|
||||
if (mOpacity != aOther.mOpacity
|
||||
&& ((mOpacity < 1.0) != (aOther.mOpacity < 1.0)))
|
||||
// might need to create a view to handle change from 1.0 to partial opacity
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
|
||||
if ((mDirection == aOther.mDirection) &&
|
||||
(mLanguage == aOther.mLanguage)) {
|
||||
if ((mVisible == aOther.mVisible)) {
|
||||
if (mOpacity == aOther.mOpacity)
|
||||
return NS_STYLE_HINT_NONE;
|
||||
else
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
if ((mVisible != aOther.mVisible) &&
|
||||
((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
|
||||
|
|
|
@ -702,7 +702,6 @@ struct nsStyleVisibility : public nsStyleStruct {
|
|||
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
||||
PRUint8 mVisible; // [inherited]
|
||||
nsCOMPtr<nsILanguageAtom> mLanguage; // [inherited]
|
||||
float mOpacity; // [inherited]
|
||||
|
||||
PRBool IsVisible() const {
|
||||
return (mVisible == NS_STYLE_VISIBILITY_VISIBLE);
|
||||
|
@ -742,6 +741,7 @@ struct nsStyleDisplay : public nsStyleStruct {
|
|||
#else
|
||||
nsRect mClip; // [reset] offsets from upper-left border edge
|
||||
#endif
|
||||
float mOpacity; // [reset]
|
||||
PRUint8 mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
|
||||
PRUint8 mOriginalDisplay; // [reset] saved mDisplay for position:absolute/fixed
|
||||
PRUint8 mAppearance; // [reset]
|
||||
|
@ -751,7 +751,6 @@ struct nsStyleDisplay : public nsStyleStruct {
|
|||
PRPackedBool mBreakBefore; // [reset]
|
||||
PRPackedBool mBreakAfter; // [reset]
|
||||
PRUint8 mOverflow; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
|
||||
|
|
|
@ -2451,12 +2451,12 @@ nsBoxFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
|||
PRBool isCanvas;
|
||||
PRBool hasBG =
|
||||
nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas);
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
const nsStyleDisplay* disp = aStyleContext->GetStyleDisplay();
|
||||
|
||||
if (vis->mOpacity != 1.0f) {
|
||||
if (disp->mOpacity != 1.0f) {
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("nsBoxFrame::CreateViewForFrame: frame=%p opacity=%g",
|
||||
aFrame, vis->mOpacity));
|
||||
aFrame, disp->mOpacity));
|
||||
aForce = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2517,6 +2517,7 @@ nsBoxFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
|||
(!hasBG ||
|
||||
(bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
|
||||
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) {
|
||||
viewIsVisible = PR_FALSE;
|
||||
}
|
||||
|
@ -2556,7 +2557,7 @@ nsBoxFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
|||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
}
|
||||
|
||||
viewManager->SetViewOpacity(view, vis->mOpacity);
|
||||
viewManager->SetViewOpacity(view, disp->mOpacity);
|
||||
}
|
||||
|
||||
// Remember our view
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -249,11 +249,10 @@ private:
|
|||
nsIRegion *region, PRUint32 aUpdateFlags);
|
||||
void DefaultRefresh(nsView* aView, const nsRect* aRect);
|
||||
void RenderViews(nsView *aRootView, nsIRenderingContext& aRC, const nsRegion& aRegion,
|
||||
PRBool aRCIsOffscreen);
|
||||
nsDrawingSurface aRCSurface);
|
||||
|
||||
void RenderDisplayListElement(DisplayListElement2* element,
|
||||
nsIRenderingContext &aRC,
|
||||
BlendingBuffers* aBuffers, const nsRect& aTranslucentArea);
|
||||
nsIRenderingContext* aRC);
|
||||
|
||||
void PaintView(nsView *aView, nsIRenderingContext &aRC, nscoord x, nscoord y,
|
||||
const nsRect &aDamageRect);
|
||||
|
@ -262,9 +261,9 @@ private:
|
|||
void InvalidateHorizontalBandDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut,
|
||||
PRUint32 aUpdateFlags, nscoord aY1, nscoord aY2, PRBool aInCutOut);
|
||||
|
||||
BlendingBuffers* CreateBlendingBuffers(nsIRenderingContext *aRC,
|
||||
PRBool aTranslucentWindow, PRBool aTranslucentViews,
|
||||
const nsRect& aTranslucentArea);
|
||||
BlendingBuffers* CreateBlendingBuffers(nsIRenderingContext *aRC, PRBool aBorrowContext,
|
||||
nsDrawingSurface aBorrowSurface, PRBool aNeedAlpha,
|
||||
const nsRect& aArea);
|
||||
|
||||
void ReparentViews(DisplayZTreeNode* aNode);
|
||||
void BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool aEventProcessing,
|
||||
|
@ -299,6 +298,9 @@ private:
|
|||
void OptimizeDisplayListClipping(nsAutoVoidArray* aDisplayList, PRBool aHaveClip,
|
||||
nsRect& aClipRect, PRInt32& aIndex,
|
||||
PRBool& aAnyRendered);
|
||||
nsRect OptimizeTranslucentRegions(const nsAutoVoidArray& aDisplayList,
|
||||
PRInt32* aIndex, nsRegion* aOpaqueRegion);
|
||||
|
||||
void ShowDisplayList(nsAutoVoidArray* aDisplayList);
|
||||
|
||||
// Utilities
|
||||
|
|
Загрузка…
Ссылка в новой задаче