From af8fae6ff37fbba2c2ddc18c21c0dac2e84e118c Mon Sep 17 00:00:00 2001 From: "mats.palmgren%bredband.net" Date: Wed, 6 Feb 2008 18:22:24 +0000 Subject: [PATCH] Adjust for viewport scrollbars when positioning a fixed background. b=402807 r+sr=roc a=blocking1.9 --- layout/base/nsCSSRendering.cpp | 16 ++++++++++++++-- layout/reftests/bugs/reftest.list | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 14032ed317f..52532100e1c 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -3591,8 +3591,9 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext, nsIFrame* topFrame = aPresContext->PresShell()->FrameManager()->GetRootFrame(); NS_ASSERTION(topFrame, "no root frame"); + nsIFrame* pageContentFrame = nsnull; if (aPresContext->IsPaginated()) { - nsIFrame* pageContentFrame = + pageContentFrame = nsLayoutUtils::GetClosestFrameOfType(aForFrame, nsGkAtoms::pageContentFrame); if (pageContentFrame) { topFrame = pageContentFrame; @@ -3600,8 +3601,19 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext, // else this is an embedded shell and its root frame is what we want } - // Get the anchor point, relative to the viewport. nsRect viewportArea = topFrame->GetRect(); + + if (!pageContentFrame) { + // Subtract the size of scrollbars. + nsIScrollableFrame* scrollableFrame = + aPresContext->PresShell()->GetRootScrollFrameAsScrollable(); + if (scrollableFrame) { + nsMargin scrollbars = scrollableFrame->GetActualScrollbarSizes(); + viewportArea.Deflate(scrollbars); + } + } + + // Get the anchor point, relative to the viewport. ComputeBackgroundAnchorPoint(aColor, viewportArea, viewportArea, tileWidth, tileHeight, anchor); // Convert the anchor point from viewport coordinates to aForFrame diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 942fb75d31e..ca57b8b7442 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -618,7 +618,7 @@ skip-if(MOZ_WIDGET_TOOLKIT!="windows") == 391045.html 391045-ref.html # windows- == 402567-2.html 402567-2-ref.html == 402567-3.html 402567-3-ref.html == 402567-4.html 402567-4-ref.html -fails == 402807-1.html 402807-1-ref.html # bug 402807 +== 402807-1.html 402807-1-ref.html == 402950-1.html 402950-1-ref.html == 403129-1.html 403129-1-ref.html == 403129-2.html 403129-2-ref.html