Line up the hypothetical box for positioned frames with the _top_ of the line

box if there is nothing in the line before the positioned frame's placeholder.
When that happens, it means that the positioned frame's content actually came
before whatever content lives in the line box and thus the frame should not be
lined up with the line box's bottom.  Bug 94468, r+sr=roc
This commit is contained in:
bzbarsky%mit.edu 2003-10-18 08:04:37 +00:00
Родитель ee8a913c40
Коммит f9544503f0
2 изменённых файлов: 58 добавлений и 8 удалений

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

@ -858,11 +858,36 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
aHypotheticalBox.mTop = lineBox->mBounds.y;
} else {
// The element would have been block-level which means it would be below
// the line containing the placeholder frame
// the line containing the placeholder frame, unless all the frames
// before it are empty. In that case, it would have been just before
// this line.
// XXXbz why the special-casing if we are the last line box?
if (lineBox != blockFrame->end_lines()) {
// The top of the hypothetical box is just below the line containing
// the placeholder
aHypotheticalBox.mTop = lineBox->mBounds.YMost();
nsIFrame * firstFrame = lineBox->mFirstChild;
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
while (firstFrame != aPlaceholderFrame) {
NS_ASSERTION(firstFrame, "Must reach our placeholder before end of list!");
PRBool isEmpty;
firstFrame->IsEmpty(mode,
firstFrame->GetStyleText()->WhiteSpaceIsSignificant(),
&isEmpty);
if (!isEmpty) {
break;
}
firstFrame = firstFrame->GetNextSibling();
}
if (firstFrame == aPlaceholderFrame) {
// The top of the hypothetical box is the top of the line containing
// the placeholder, since there is nothing in the line before our
// placeholder except empty frames.
aHypotheticalBox.mTop = lineBox->mBounds.y;
} else {
// The top of the hypothetical box is just below the line containing
// the placeholder.
aHypotheticalBox.mTop = lineBox->mBounds.YMost();
}
} else {
// Just use the placeholder's y-offset
aHypotheticalBox.mTop = placeholderOffset.y;

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

@ -858,11 +858,36 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
aHypotheticalBox.mTop = lineBox->mBounds.y;
} else {
// The element would have been block-level which means it would be below
// the line containing the placeholder frame
// the line containing the placeholder frame, unless all the frames
// before it are empty. In that case, it would have been just before
// this line.
// XXXbz why the special-casing if we are the last line box?
if (lineBox != blockFrame->end_lines()) {
// The top of the hypothetical box is just below the line containing
// the placeholder
aHypotheticalBox.mTop = lineBox->mBounds.YMost();
nsIFrame * firstFrame = lineBox->mFirstChild;
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
while (firstFrame != aPlaceholderFrame) {
NS_ASSERTION(firstFrame, "Must reach our placeholder before end of list!");
PRBool isEmpty;
firstFrame->IsEmpty(mode,
firstFrame->GetStyleText()->WhiteSpaceIsSignificant(),
&isEmpty);
if (!isEmpty) {
break;
}
firstFrame = firstFrame->GetNextSibling();
}
if (firstFrame == aPlaceholderFrame) {
// The top of the hypothetical box is the top of the line containing
// the placeholder, since there is nothing in the line before our
// placeholder except empty frames.
aHypotheticalBox.mTop = lineBox->mBounds.y;
} else {
// The top of the hypothetical box is just below the line containing
// the placeholder.
aHypotheticalBox.mTop = lineBox->mBounds.YMost();
}
} else {
// Just use the placeholder's y-offset
aHypotheticalBox.mTop = placeholderOffset.y;