diff --git a/content/base/src/nsRuleNode.cpp b/content/base/src/nsRuleNode.cpp index 659eb84a446b..249b8dd0c23b 100644 --- a/content/base/src/nsRuleNode.cpp +++ b/content/base/src/nsRuleNode.cpp @@ -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) diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index d7294b5fa557..912f2be78103 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -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 diff --git a/layout/html/document/src/html.css b/layout/html/document/src/html.css index c24447039039..5bb870678b6d 100644 --- a/layout/html/document/src/html.css +++ b/layout/html/document/src/html.css @@ -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; } diff --git a/layout/html/document/src/nsFrameFrame.cpp b/layout/html/document/src/nsFrameFrame.cpp index d7294b5fa557..912f2be78103 100644 --- a/layout/html/document/src/nsFrameFrame.cpp +++ b/layout/html/document/src/nsFrameFrame.cpp @@ -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 diff --git a/layout/style/html.css b/layout/style/html.css index c24447039039..5bb870678b6d 100644 --- a/layout/style/html.css +++ b/layout/style/html.css @@ -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; } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 659eb84a446b..249b8dd0c23b 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -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)