Closed Bug 288560 Opened 19 years ago Closed 19 years ago

Columns: Hang/freeze in this case using float:right and -moz-column-count:2

Categories

(Core :: Layout, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

VERIFIED FIXED

People

(Reporter: martijn.martijn, Assigned: roc)

Details

(Keywords: testcase)

Attachments

(3 files, 2 obsolete files)

See upcoming testcase.
Basically, the testcase consists of this:
<div style="height:1px;-moz-column-count:2;">
<span style="float:right;border:1px solid red;"></span>
</div>

This causes the freeze/hang. Also, memory seems to increase steadily by 0.5MB/s.
Attached file testcase
Robert, this is probably also something for you.
Attached patch fix (obsolete) — Splinter Review
This is a tough one. We're trying to lay out a float and there simply isn't
enough	available height for it to fit anywhere, so we just keep creating more
columns in the hope that it will eventually fit, and of course that doesn't
help.

What we have to do is what we do elsewhere, which is determine when moving the
content to the next page/column won't give it any more space, and if so, force
it to fit where it is. "fit where it is" is tricky for floats though, because
the space manager is involved. This patch detects force-fit situations and
forces floats to fit by temporarily relaxing the height constraint imposed by
nsBlockBandData. That seems to work well.

To fully fix this bug, though, we have to work a bit harder. Columns need to
set the mIsTopOfPage flag so that the float doesn't get NS_FRAME_IS_TRUNCATED
in its reflow status, which triggers nsLineLayout to try to push the line
anyway.
Assignee: nobody → roc
Status: NEW → ASSIGNED
Attachment #180007 - Flags: superreview?(dbaron)
Attachment #180007 - Flags: review?(dbaron)
Comment on attachment 180007 [details] [diff] [review]
fix

r+sr=dbaron, although I wonder if the overloading of mIsTopOfPage will cause
problems when columns and pagination are combined.
Attachment #180007 - Flags: superreview?(dbaron)
Attachment #180007 - Flags: superreview+
Attachment #180007 - Flags: review?(dbaron)
Attachment #180007 - Flags: review+
Looking again at the patch, there's a significant problem ...

+  nsSize space = mSpace;
+  if (aRelaxHeightConstraint) {
+    space.height = NS_UNCONSTRAINEDSIZE;
+  }

but 'space' isn't used, we just keep using mSpace. I'll fix that and retest...
Attached file testcase
Yeah. The change to nsColumnSetFrame alone fixes Martijn's original testcase,
but the erroneous patch here doesn't fix this testcase.
I think the overloading of mIsTopOfPage won't cause problems. The only
potentially dangerous situation I can think of is when a column set starts right
at the bottom of a page, so the column set doesn't have mIsTopOfPage set, but
the first lines of its columns do, so those lines are not marked as truncated
even when they overflow the height constraint. But the column set itself will be
marked as truncated and pushed to the next page.
Attached patch fix #2 (obsolete) — Splinter Review
This patch fixes both Martijn's testcase and the testcase I just posted. It's
basically identical to the previous patch except it makes the float-forcefit
code actually work by using 'space' instead of 'mSpace' as I'd intended. I also
made another change in nsBlockFrame::PushLine so that the forcefit parameter to
PlaceBelowCurrentLineFloats uses the IsAdjacentToTop value from *before* we
placed the line, not after (when it would almost always be false).
Attachment #180007 - Attachment is obsolete: true
Attachment #182033 - Flags: superreview?(dbaron)
Attachment #182033 - Flags: review?(dbaron)
Comment on attachment 182033 [details] [diff] [review]
fix #2

wrong patch
Attachment #182033 - Attachment is obsolete: true
Attachment #182033 - Flags: superreview?(dbaron)
Attachment #182033 - Flags: review?(dbaron)
Attached patch fix #2Splinter Review
right patch
Attachment #182034 - Flags: superreview?(dbaron)
Attachment #182034 - Flags: review?(dbaron)
Attachment #182034 - Flags: superreview?(dbaron)
Attachment #182034 - Flags: superreview+
Attachment #182034 - Flags: review?(dbaron)
Attachment #182034 - Flags: review+
Comment on attachment 182034 [details] [diff] [review]
fix #2

fixes a hang in some column testcases (which can also be triggered in print
preview). Should have no effect on normal layout.
Attachment #182034 - Flags: approval1.8b2?
Comment on attachment 182034 [details] [diff] [review]
fix #2

a=chofmann
Attachment #182034 - Flags: approval1.8b2? → approval1.8b2+
checked in
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: