зеркало из https://github.com/mozilla/gecko-dev.git
Bug 50623. Don't forget background styles inherited from the initial context. This has the effect of making FRAME/IFRAME documents transparent by default. Also, make FRAME/IFRAME elements paint any background styles set on them. r=dbaron,sr=waterson
This commit is contained in:
Родитель
622f1d396f
Коммит
6f4e473b18
|
@ -3124,12 +3124,14 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
parentBG = NS_STATIC_CAST(const nsStyleBackground*,
|
||||
parentContext->GetStyleData(eStyleStruct_Background));
|
||||
PRBool inherited = aInherited;
|
||||
// save parentFlags in case bg == parentBG and we clobber them later
|
||||
PRUint8 parentFlags = parentBG->mBackgroundFlags;
|
||||
|
||||
// background-color: color, string, enum (flags), inherit
|
||||
if (eCSSUnit_Inherit == colorData.mBackColor.GetUnit()) { // do inherit first, so SetColor doesn't do it
|
||||
bg->mBackgroundColor = parentBG->mBackgroundColor;
|
||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
bg->mBackgroundFlags |= (parentFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
inherited = PR_TRUE;
|
||||
}
|
||||
else if (SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
||||
|
@ -3154,7 +3156,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
inherited = PR_TRUE;
|
||||
bg->mBackgroundImage = parentBG->mBackgroundImage;
|
||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE);
|
||||
bg->mBackgroundFlags |= (parentFlags & NS_STYLE_BG_IMAGE_NONE);
|
||||
}
|
||||
|
||||
// background-repeat: enum, inherit
|
||||
|
@ -3196,7 +3198,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
inherited = PR_TRUE;
|
||||
bg->mBackgroundXPosition = parentBG->mBackgroundXPosition;
|
||||
bg->mBackgroundFlags &= ~(NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT);
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & (NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT));
|
||||
bg->mBackgroundFlags |= (parentFlags & (NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT));
|
||||
}
|
||||
|
||||
if (eCSSUnit_Percent == colorData.mBackPositionY.GetUnit()) {
|
||||
|
@ -3219,7 +3221,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
inherited = PR_TRUE;
|
||||
bg->mBackgroundYPosition = parentBG->mBackgroundYPosition;
|
||||
bg->mBackgroundFlags &= ~(NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT);
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & (NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT));
|
||||
bg->mBackgroundFlags |= (parentFlags & (NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT));
|
||||
}
|
||||
|
||||
if (inherited)
|
||||
|
|
|
@ -220,6 +220,10 @@ public:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags);
|
||||
|
||||
// Make sure we never think this frame is opaque because it has
|
||||
// a background set; we won't be painting it in most cases
|
||||
virtual PRBool CanPaintBackground() { return PR_FALSE; }
|
||||
|
||||
/**
|
||||
* @see nsIFrame::Reflow
|
||||
*/
|
||||
|
@ -460,17 +464,8 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
//printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
||||
nsIFrame* firstChild = mFrames.FirstChild();
|
||||
if (nsnull != firstChild) {
|
||||
firstChild->Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
aWhichLayer);
|
||||
}
|
||||
if (IsInline()) {
|
||||
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext,
|
||||
aDirtyRect, aWhichLayer);
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext,
|
||||
aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -440,12 +440,10 @@ frameset {
|
|||
}
|
||||
|
||||
frame {
|
||||
background-color: transparent ! important; /* (b=49779) */
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
||||
iframe {
|
||||
background-color: transparent ! important; /* (b=49779) */
|
||||
border: 2px inset;
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
|
|
@ -220,6 +220,10 @@ public:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags);
|
||||
|
||||
// Make sure we never think this frame is opaque because it has
|
||||
// a background set; we won't be painting it in most cases
|
||||
virtual PRBool CanPaintBackground() { return PR_FALSE; }
|
||||
|
||||
/**
|
||||
* @see nsIFrame::Reflow
|
||||
*/
|
||||
|
@ -460,17 +464,8 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
//printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
||||
nsIFrame* firstChild = mFrames.FirstChild();
|
||||
if (nsnull != firstChild) {
|
||||
firstChild->Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
aWhichLayer);
|
||||
}
|
||||
if (IsInline()) {
|
||||
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext,
|
||||
aDirtyRect, aWhichLayer);
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext,
|
||||
aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -440,12 +440,10 @@ frameset {
|
|||
}
|
||||
|
||||
frame {
|
||||
background-color: transparent ! important; /* (b=49779) */
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
||||
iframe {
|
||||
background-color: transparent ! important; /* (b=49779) */
|
||||
border: 2px inset;
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
|
|
@ -3124,12 +3124,14 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
parentBG = NS_STATIC_CAST(const nsStyleBackground*,
|
||||
parentContext->GetStyleData(eStyleStruct_Background));
|
||||
PRBool inherited = aInherited;
|
||||
// save parentFlags in case bg == parentBG and we clobber them later
|
||||
PRUint8 parentFlags = parentBG->mBackgroundFlags;
|
||||
|
||||
// background-color: color, string, enum (flags), inherit
|
||||
if (eCSSUnit_Inherit == colorData.mBackColor.GetUnit()) { // do inherit first, so SetColor doesn't do it
|
||||
bg->mBackgroundColor = parentBG->mBackgroundColor;
|
||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
bg->mBackgroundFlags |= (parentFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
inherited = PR_TRUE;
|
||||
}
|
||||
else if (SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
||||
|
@ -3154,7 +3156,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
inherited = PR_TRUE;
|
||||
bg->mBackgroundImage = parentBG->mBackgroundImage;
|
||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE);
|
||||
bg->mBackgroundFlags |= (parentFlags & NS_STYLE_BG_IMAGE_NONE);
|
||||
}
|
||||
|
||||
// background-repeat: enum, inherit
|
||||
|
@ -3196,7 +3198,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
inherited = PR_TRUE;
|
||||
bg->mBackgroundXPosition = parentBG->mBackgroundXPosition;
|
||||
bg->mBackgroundFlags &= ~(NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT);
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & (NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT));
|
||||
bg->mBackgroundFlags |= (parentFlags & (NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT));
|
||||
}
|
||||
|
||||
if (eCSSUnit_Percent == colorData.mBackPositionY.GetUnit()) {
|
||||
|
@ -3219,7 +3221,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
|||
inherited = PR_TRUE;
|
||||
bg->mBackgroundYPosition = parentBG->mBackgroundYPosition;
|
||||
bg->mBackgroundFlags &= ~(NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT);
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & (NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT));
|
||||
bg->mBackgroundFlags |= (parentFlags & (NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT));
|
||||
}
|
||||
|
||||
if (inherited)
|
||||
|
|
Загрузка…
Ссылка в новой задаче