From 84ef11c140be0bb9092fd47cbbcd9a5ffdf7dbf6 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 4 Apr 2006 22:36:01 +0000 Subject: [PATCH] Make sure to not rely on how scrollframes handle frame offsets (esp. since it's changed) when positioning fixed-pos frames. Bug 331729, r+sr=roc git-svn-id: svn://10.0.0.236/trunk@193567 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsHTMLReflowState.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index f82a5752f5c..32d8042fa9d 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -1002,12 +1002,18 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext, if (mStyleDisplay->mPosition == NS_STYLE_POSITION_FIXED) { // In this case, cbrs->frame will always be an ancestor of // aContainingBlock, so can just walk our way up the frame tree. + // Make sure to not add positions of frames whose parent is a + // scrollFrame, since we're doing fixed positioning, which assumes + // everything is scrolled to (0,0). cbOffset.MoveTo(0, 0); do { - cbOffset += aContainingBlock->GetPosition(); + nsPoint curOffset = aContainingBlock->GetPosition(); aContainingBlock = aContainingBlock->GetParent(); NS_ASSERTION(aContainingBlock, "Should hit cbrs->frame before we run off the frame tree!"); + if (aContainingBlock->GetType() != nsLayoutAtoms::scrollFrame) { + cbOffset += curOffset; + } } while (aContainingBlock != cbrs->frame); } else { cbOffset = aContainingBlock->GetOffsetTo(cbrs->frame);