The slow codepaths for fixed background-attachment should only apply when there's a background image. b=258793 r+sr=roc

This commit is contained in:
dbaron%dbaron.org 2004-09-13 05:39:27 +00:00
Родитель d1b63ea756
Коммит cd7b1f831b
5 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -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)) ==
(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 #define BORDER_COLOR_DEFINED 0x80

Просмотреть файл

@ -572,8 +572,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext,
// background-attachment: fixed is not really geometry dependent, but // background-attachment: fixed is not really geometry dependent, but
// we set it here because it's cheap to do so // we set it here because it's cheap to do so
PRBool fixedBackground = hasBG && PRBool fixedBackground = hasBG && bg->HasFixedBackground();
NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment;
// If the frame has a fixed background attachment, then indicate that the // If the frame has a fixed background attachment, then indicate that the
// view's contents should be repainted and not bitblt'd // view's contents should be repainted and not bitblt'd
vm->SetViewBitBltEnabled(aView, !fixedBackground); vm->SetViewBitBltEnabled(aView, !fixedBackground);
@ -901,8 +900,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
PRBool hasBackground = PRBool hasBackground =
nsCSSRendering::FindBackground(aFrame->GetPresContext(), nsCSSRendering::FindBackground(aFrame->GetPresContext(),
aFrame, &color, &isCanvas); aFrame, &color, &isCanvas);
if (hasBackground && if (hasBackground && color->HasFixedBackground()) {
NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) {
return PR_TRUE; return PR_TRUE;
} }

Просмотреть файл

@ -572,8 +572,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext,
// background-attachment: fixed is not really geometry dependent, but // background-attachment: fixed is not really geometry dependent, but
// we set it here because it's cheap to do so // we set it here because it's cheap to do so
PRBool fixedBackground = hasBG && PRBool fixedBackground = hasBG && bg->HasFixedBackground();
NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment;
// If the frame has a fixed background attachment, then indicate that the // If the frame has a fixed background attachment, then indicate that the
// view's contents should be repainted and not bitblt'd // view's contents should be repainted and not bitblt'd
vm->SetViewBitBltEnabled(aView, !fixedBackground); vm->SetViewBitBltEnabled(aView, !fixedBackground);
@ -901,8 +900,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
PRBool hasBackground = PRBool hasBackground =
nsCSSRendering::FindBackground(aFrame->GetPresContext(), nsCSSRendering::FindBackground(aFrame->GetPresContext(),
aFrame, &color, &isCanvas); aFrame, &color, &isCanvas);
if (hasBackground && if (hasBackground && color->HasFixedBackground()) {
NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) {
return PR_TRUE; return PR_TRUE;
} }

Просмотреть файл

@ -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)) ==
(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 #define BORDER_COLOR_DEFINED 0x80

Просмотреть файл

@ -2490,7 +2490,7 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
} }
// See if the frame has a fixed background attachment // 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; aForce = PR_TRUE;
fixedBackgroundAttachment = PR_TRUE; fixedBackgroundAttachment = PR_TRUE;
} }