Fixed block frame Clear method to work properly

This commit is contained in:
kipp 1998-06-01 23:38:40 +00:00
parent 9be24b0fac
commit f7574b4cbd
6 changed files with 360 additions and 318 deletions

View File

@ -553,26 +553,54 @@ nsBlockFrame::DrainOverflowList()
void
nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
{
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
return;
}
for (;;) {
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
break;
}
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
@ -597,43 +625,22 @@ nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
if (clearYMost == aState.mY) {
// Nothing to clear
break;
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost + 1;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
nsresult

View File

@ -553,26 +553,54 @@ nsBlockFrame::DrainOverflowList()
void
nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
{
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
return;
}
for (;;) {
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
break;
}
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
@ -597,43 +625,22 @@ nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
if (clearYMost == aState.mY) {
// Nothing to clear
break;
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost + 1;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
nsresult

View File

@ -553,26 +553,54 @@ nsBlockFrame::DrainOverflowList()
void
nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
{
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
return;
}
for (;;) {
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
break;
}
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
@ -597,43 +625,22 @@ nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
if (clearYMost == aState.mY) {
// Nothing to clear
break;
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost + 1;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
nsresult

View File

@ -553,26 +553,54 @@ nsBlockFrame::DrainOverflowList()
void
nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
{
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
return;
}
for (;;) {
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
break;
}
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
@ -597,43 +625,22 @@ nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
if (clearYMost == aState.mY) {
// Nothing to clear
break;
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost + 1;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
nsresult

View File

@ -553,26 +553,54 @@ nsBlockFrame::DrainOverflowList()
void
nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
{
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
return;
}
for (;;) {
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
break;
}
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
@ -597,43 +625,22 @@ nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
if (clearYMost == aState.mY) {
// Nothing to clear
break;
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost + 1;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
nsresult

View File

@ -553,26 +553,54 @@ nsBlockFrame::DrainOverflowList()
void
nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
{
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
return;
}
for (;;) {
if (aState.mCurrentBand.count <= 1) {
// No floaters in this band therefore nothing to clear
break;
}
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
// Find the Y coordinate to clear to
nscoord clearYMost = aState.mY;
nsRect tmp;
PRInt32 i;
for (i = 0; i < aState.mCurrentBand.count; i++) {
nsStyleDisplay* display;
nsBandTrapezoid* trapezoid = &aState.mCurrentBand.data[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 fn, numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (fn = 0; fn < numFrames; fn++) {
nsIFrame* f = (nsIFrame*) trapezoid->frames->ElementAt(fn);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
@ -597,43 +625,22 @@ nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint8 aBreakType)
}
}
}
else {
trapezoid->frame->GetStyleData(eStyleStruct_Display,
(nsStyleStruct*&)display);
switch (display->mFloats) {
case NS_STYLE_FLOAT_LEFT:
if ((NS_STYLE_CLEAR_LEFT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
case NS_STYLE_FLOAT_RIGHT:
if ((NS_STYLE_CLEAR_RIGHT == aBreakType) ||
(NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) {
trapezoid->GetRect(tmp);
nscoord ym = tmp.YMost();
if (ym > clearYMost) {
clearYMost = ym;
}
}
break;
}
}
}
if (clearYMost == aState.mY) {
// Nothing to clear
break;
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost + 1;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsBlockFrame::ClearFloaters: mY=%d clearYMost=%d\n",
aState.mY, clearYMost));
aState.mY = clearYMost;
// Get a new band
GetAvailableSpace(aState, aState.mY);
}
nsresult