diff --git a/content/shared/public/nsStyleStruct.h b/content/shared/public/nsStyleStruct.h index 4d9fdf026d0..eef469608bf 100644 --- a/content/shared/public/nsStyleStruct.h +++ b/content/shared/public/nsStyleStruct.h @@ -187,6 +187,14 @@ struct nsStyleBackground : public nsStyleStruct { (NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE)) == (NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE); } + + PRBool HasFixedBackground() const + { + // We have to take slower codepaths for fixed background attachment, + // but we don't want to do that when there's no image. + return mBackgroundAttachment == NS_STYLE_BG_ATTACHMENT_FIXED && + mBackgroundImage; + } }; #define BORDER_COLOR_DEFINED 0x80 diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 448c2a1dc21..0ce9fd3b615 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -572,8 +572,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext, // background-attachment: fixed is not really geometry dependent, but // we set it here because it's cheap to do so - PRBool fixedBackground = hasBG && - NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment; + PRBool fixedBackground = hasBG && bg->HasFixedBackground(); // If the frame has a fixed background attachment, then indicate that the // view's contents should be repainted and not bitblt'd vm->SetViewBitBltEnabled(aView, !fixedBackground); @@ -901,8 +900,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame) PRBool hasBackground = nsCSSRendering::FindBackground(aFrame->GetPresContext(), aFrame, &color, &isCanvas); - if (hasBackground && - NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) { + if (hasBackground && color->HasFixedBackground()) { return PR_TRUE; } diff --git a/layout/html/base/src/nsContainerFrame.cpp b/layout/html/base/src/nsContainerFrame.cpp index 448c2a1dc21..0ce9fd3b615 100644 --- a/layout/html/base/src/nsContainerFrame.cpp +++ b/layout/html/base/src/nsContainerFrame.cpp @@ -572,8 +572,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext, // background-attachment: fixed is not really geometry dependent, but // we set it here because it's cheap to do so - PRBool fixedBackground = hasBG && - NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment; + PRBool fixedBackground = hasBG && bg->HasFixedBackground(); // If the frame has a fixed background attachment, then indicate that the // view's contents should be repainted and not bitblt'd vm->SetViewBitBltEnabled(aView, !fixedBackground); @@ -901,8 +900,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame) PRBool hasBackground = nsCSSRendering::FindBackground(aFrame->GetPresContext(), aFrame, &color, &isCanvas); - if (hasBackground && - NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) { + if (hasBackground && color->HasFixedBackground()) { return PR_TRUE; } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 4d9fdf026d0..eef469608bf 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -187,6 +187,14 @@ struct nsStyleBackground : public nsStyleStruct { (NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE)) == (NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE); } + + PRBool HasFixedBackground() const + { + // We have to take slower codepaths for fixed background attachment, + // but we don't want to do that when there's no image. + return mBackgroundAttachment == NS_STYLE_BG_ATTACHMENT_FIXED && + mBackgroundImage; + } }; #define BORDER_COLOR_DEFINED 0x80 diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 810197be243..b3f331c7aba 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -2490,7 +2490,7 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext, } // See if the frame has a fixed background attachment - if (hasBG && NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment) { + if (hasBG && bg->HasFixedBackground()) { aForce = PR_TRUE; fixedBackgroundAttachment = PR_TRUE; }