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
This commit is contained in:
bzbarsky%mit.edu 2006-04-04 22:36:01 +00:00
Родитель 43bcb1c2fe
Коммит 8a650e0704
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -1002,12 +1002,18 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
if (mStyleDisplay->mPosition == NS_STYLE_POSITION_FIXED) { if (mStyleDisplay->mPosition == NS_STYLE_POSITION_FIXED) {
// In this case, cbrs->frame will always be an ancestor of // In this case, cbrs->frame will always be an ancestor of
// aContainingBlock, so can just walk our way up the frame tree. // 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); cbOffset.MoveTo(0, 0);
do { do {
cbOffset += aContainingBlock->GetPosition(); nsPoint curOffset = aContainingBlock->GetPosition();
aContainingBlock = aContainingBlock->GetParent(); aContainingBlock = aContainingBlock->GetParent();
NS_ASSERTION(aContainingBlock, NS_ASSERTION(aContainingBlock,
"Should hit cbrs->frame before we run off the frame tree!"); "Should hit cbrs->frame before we run off the frame tree!");
if (aContainingBlock->GetType() != nsLayoutAtoms::scrollFrame) {
cbOffset += curOffset;
}
} while (aContainingBlock != cbrs->frame); } while (aContainingBlock != cbrs->frame);
} else { } else {
cbOffset = aContainingBlock->GetOffsetTo(cbrs->frame); cbOffset = aContainingBlock->GetOffsetTo(cbrs->frame);