Work on getting floaters working again

This commit is contained in:
troy 1998-05-07 05:25:08 +00:00
Родитель 2193cef855
Коммит f6e0e4fd8b
8 изменённых файлов: 58 добавлений и 64 удалений

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

@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
{ {
// If the floater is the left-most non-zero size child frame then insert // If the floater is the left-most non-zero size child frame then insert
// it before the current line; otherwise add it to the below-current-line // it before the current line; otherwise add it to the below-current-line
// todo list and we'll handle it when we flush out the line // todo list, and we'll handle it when we flush out the line
if (IsLeftMostChild(aPlaceholder)) { if (IsLeftMostChild(aPlaceholder)) {
nsISpaceManager* sm = aState.mSpaceManager; nsISpaceManager* sm = aState.mSpaceManager;
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* floaterDisplay;
aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay);
nsStyleDisplay* floaterDisplay = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
// Commit some space in the space manager and adjust our current // Commit some space in the space manager and adjust our current
// band of available space. // band of available space.
@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
} }
} }
// XXX It's unclear what coordinate space aY is in. Is it relative to the
// upper-left origin of the containing block, or relative to aState.mY?
void void
nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
nscoord aY) nscoord aY)
@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
GetAvailableSpace(aState, aY); GetAvailableSpace(aState, aY);
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* sd;
floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd);
nsStyleDisplay* sd = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
floater->GetRect(region); floater->GetRect(region);
region.y = bd->availSpace.y; // XXX GetAvailableSpace() is translating availSpace by aState.mY...
region.y = bd->availSpace.y - aState.mY;
if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { if (NS_STYLE_FLOAT_LEFT == sd->mFloats) {
region.x = bd->availSpace.x; region.x = bd->availSpace.x;
} else { } else {

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

@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
{ {
// If the floater is the left-most non-zero size child frame then insert // If the floater is the left-most non-zero size child frame then insert
// it before the current line; otherwise add it to the below-current-line // it before the current line; otherwise add it to the below-current-line
// todo list and we'll handle it when we flush out the line // todo list, and we'll handle it when we flush out the line
if (IsLeftMostChild(aPlaceholder)) { if (IsLeftMostChild(aPlaceholder)) {
nsISpaceManager* sm = aState.mSpaceManager; nsISpaceManager* sm = aState.mSpaceManager;
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* floaterDisplay;
aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay);
nsStyleDisplay* floaterDisplay = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
// Commit some space in the space manager and adjust our current // Commit some space in the space manager and adjust our current
// band of available space. // band of available space.
@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
} }
} }
// XXX It's unclear what coordinate space aY is in. Is it relative to the
// upper-left origin of the containing block, or relative to aState.mY?
void void
nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
nscoord aY) nscoord aY)
@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
GetAvailableSpace(aState, aY); GetAvailableSpace(aState, aY);
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* sd;
floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd);
nsStyleDisplay* sd = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
floater->GetRect(region); floater->GetRect(region);
region.y = bd->availSpace.y; // XXX GetAvailableSpace() is translating availSpace by aState.mY...
region.y = bd->availSpace.y - aState.mY;
if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { if (NS_STYLE_FLOAT_LEFT == sd->mFloats) {
region.x = bd->availSpace.x; region.x = bd->availSpace.x;
} else { } else {

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

@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
{ {
// If the floater is the left-most non-zero size child frame then insert // If the floater is the left-most non-zero size child frame then insert
// it before the current line; otherwise add it to the below-current-line // it before the current line; otherwise add it to the below-current-line
// todo list and we'll handle it when we flush out the line // todo list, and we'll handle it when we flush out the line
if (IsLeftMostChild(aPlaceholder)) { if (IsLeftMostChild(aPlaceholder)) {
nsISpaceManager* sm = aState.mSpaceManager; nsISpaceManager* sm = aState.mSpaceManager;
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* floaterDisplay;
aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay);
nsStyleDisplay* floaterDisplay = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
// Commit some space in the space manager and adjust our current // Commit some space in the space manager and adjust our current
// band of available space. // band of available space.
@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
} }
} }
// XXX It's unclear what coordinate space aY is in. Is it relative to the
// upper-left origin of the containing block, or relative to aState.mY?
void void
nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
nscoord aY) nscoord aY)
@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
GetAvailableSpace(aState, aY); GetAvailableSpace(aState, aY);
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* sd;
floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd);
nsStyleDisplay* sd = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
floater->GetRect(region); floater->GetRect(region);
region.y = bd->availSpace.y; // XXX GetAvailableSpace() is translating availSpace by aState.mY...
region.y = bd->availSpace.y - aState.mY;
if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { if (NS_STYLE_FLOAT_LEFT == sd->mFloats) {
region.x = bd->availSpace.x; region.x = bd->availSpace.x;
} else { } else {

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

@ -414,11 +414,11 @@ nsLineLayout::ReflowChild()
mReflowResult = NS_LINE_LAYOUT_REFLOW_RESULT_NOT_AWARE; mReflowResult = NS_LINE_LAYOUT_REFLOW_RESULT_NOT_AWARE;
nscoord dx = mReflowData.mX + kidSpacing->mMargin.left; nscoord dx = mReflowData.mX + kidSpacing->mMargin.left;
if (isBlock) { if (isBlock) {
mSpaceManager->Translate(dx, 0); mSpaceManager->Translate(dx, mY);
rv = mBlock->ReflowBlockChild(mKidFrame, mPresContext, rv = mBlock->ReflowBlockChild(mKidFrame, mPresContext,
mSpaceManager, kidAvailSize, kidRect, mSpaceManager, kidAvailSize, kidRect,
kidMaxElementSize, kidReflowStatus); kidMaxElementSize, kidReflowStatus);
mSpaceManager->Translate(-dx, 0); mSpaceManager->Translate(-dx, -mY);
kidRect.x = dx; kidRect.x = dx;
kidRect.y = mY; kidRect.y = mY;
kidSize.width = kidRect.width; kidSize.width = kidRect.width;

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

@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
{ {
// If the floater is the left-most non-zero size child frame then insert // If the floater is the left-most non-zero size child frame then insert
// it before the current line; otherwise add it to the below-current-line // it before the current line; otherwise add it to the below-current-line
// todo list and we'll handle it when we flush out the line // todo list, and we'll handle it when we flush out the line
if (IsLeftMostChild(aPlaceholder)) { if (IsLeftMostChild(aPlaceholder)) {
nsISpaceManager* sm = aState.mSpaceManager; nsISpaceManager* sm = aState.mSpaceManager;
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* floaterDisplay;
aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay);
nsStyleDisplay* floaterDisplay = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
// Commit some space in the space manager and adjust our current // Commit some space in the space manager and adjust our current
// band of available space. // band of available space.
@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
} }
} }
// XXX It's unclear what coordinate space aY is in. Is it relative to the
// upper-left origin of the containing block, or relative to aState.mY?
void void
nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
nscoord aY) nscoord aY)
@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
GetAvailableSpace(aState, aY); GetAvailableSpace(aState, aY);
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* sd;
floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd);
nsStyleDisplay* sd = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
floater->GetRect(region); floater->GetRect(region);
region.y = bd->availSpace.y; // XXX GetAvailableSpace() is translating availSpace by aState.mY...
region.y = bd->availSpace.y - aState.mY;
if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { if (NS_STYLE_FLOAT_LEFT == sd->mFloats) {
region.x = bd->availSpace.x; region.x = bd->availSpace.x;
} else { } else {

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

@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
{ {
// If the floater is the left-most non-zero size child frame then insert // If the floater is the left-most non-zero size child frame then insert
// it before the current line; otherwise add it to the below-current-line // it before the current line; otherwise add it to the below-current-line
// todo list and we'll handle it when we flush out the line // todo list, and we'll handle it when we flush out the line
if (IsLeftMostChild(aPlaceholder)) { if (IsLeftMostChild(aPlaceholder)) {
nsISpaceManager* sm = aState.mSpaceManager; nsISpaceManager* sm = aState.mSpaceManager;
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* floaterDisplay;
aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay);
nsStyleDisplay* floaterDisplay = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
// Commit some space in the space manager and adjust our current // Commit some space in the space manager and adjust our current
// band of available space. // band of available space.
@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
} }
} }
// XXX It's unclear what coordinate space aY is in. Is it relative to the
// upper-left origin of the containing block, or relative to aState.mY?
void void
nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
nscoord aY) nscoord aY)
@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
GetAvailableSpace(aState, aY); GetAvailableSpace(aState, aY);
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* sd;
floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd);
nsStyleDisplay* sd = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
floater->GetRect(region); floater->GetRect(region);
region.y = bd->availSpace.y; // XXX GetAvailableSpace() is translating availSpace by aState.mY...
region.y = bd->availSpace.y - aState.mY;
if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { if (NS_STYLE_FLOAT_LEFT == sd->mFloats) {
region.x = bd->availSpace.x; region.x = bd->availSpace.x;
} else { } else {

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

@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
{ {
// If the floater is the left-most non-zero size child frame then insert // If the floater is the left-most non-zero size child frame then insert
// it before the current line; otherwise add it to the below-current-line // it before the current line; otherwise add it to the below-current-line
// todo list and we'll handle it when we flush out the line // todo list, and we'll handle it when we flush out the line
if (IsLeftMostChild(aPlaceholder)) { if (IsLeftMostChild(aPlaceholder)) {
nsISpaceManager* sm = aState.mSpaceManager; nsISpaceManager* sm = aState.mSpaceManager;
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* floaterDisplay;
aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay);
nsStyleDisplay* floaterDisplay = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
// Commit some space in the space manager and adjust our current // Commit some space in the space manager and adjust our current
// band of available space. // band of available space.
@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext,
} }
} }
// XXX It's unclear what coordinate space aY is in. Is it relative to the
// upper-left origin of the containing block, or relative to aState.mY?
void void
nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
nscoord aY) nscoord aY)
@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState,
GetAvailableSpace(aState, aY); GetAvailableSpace(aState, aY);
// Get the type of floater // Get the type of floater
nsIStyleContextPtr styleContext; nsStyleDisplay* sd;
floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd);
nsStyleDisplay* sd = (nsStyleDisplay*)
styleContext->GetData(kStyleDisplaySID);
floater->GetRect(region); floater->GetRect(region);
region.y = bd->availSpace.y; // XXX GetAvailableSpace() is translating availSpace by aState.mY...
region.y = bd->availSpace.y - aState.mY;
if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { if (NS_STYLE_FLOAT_LEFT == sd->mFloats) {
region.x = bd->availSpace.x; region.x = bd->availSpace.x;
} else { } else {

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

@ -414,11 +414,11 @@ nsLineLayout::ReflowChild()
mReflowResult = NS_LINE_LAYOUT_REFLOW_RESULT_NOT_AWARE; mReflowResult = NS_LINE_LAYOUT_REFLOW_RESULT_NOT_AWARE;
nscoord dx = mReflowData.mX + kidSpacing->mMargin.left; nscoord dx = mReflowData.mX + kidSpacing->mMargin.left;
if (isBlock) { if (isBlock) {
mSpaceManager->Translate(dx, 0); mSpaceManager->Translate(dx, mY);
rv = mBlock->ReflowBlockChild(mKidFrame, mPresContext, rv = mBlock->ReflowBlockChild(mKidFrame, mPresContext,
mSpaceManager, kidAvailSize, kidRect, mSpaceManager, kidAvailSize, kidRect,
kidMaxElementSize, kidReflowStatus); kidMaxElementSize, kidReflowStatus);
mSpaceManager->Translate(-dx, 0); mSpaceManager->Translate(-dx, -mY);
kidRect.x = dx; kidRect.x = dx;
kidRect.y = mY; kidRect.y = mY;
kidSize.width = kidRect.width; kidSize.width = kidRect.width;