Closed Bug 407111 Opened 17 years ago Closed 17 years ago

Text won't break before an image

Categories

(Core :: Layout: Block and Inline, defect, P2)

x86
macOS
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: roc, Assigned: roc)

Details

Attachments

(2 files)

Attached file testcase
The testcase should wrap to two lines, but it doesn't.
The <br> in the testcase doesn't seem to be necessary.
Seems like we ought to break before the second image, no?  Isn't that the only possible break point in the line?
Yeah. I didn't mean the summary to imply that we should break directly before the <br>
Summary: Text won't break before a <br> → Text won't break before an image
Attached patch fixSplinter Review
Turns out the <br> is necessary, actually. I'm not sure what Jesse is seeing, maybe a build before 405577 was fixed.

Somewhere recently I exposed a bug that's been around for at least a little while. When nsLineLayout places a frame that doesn't continue a textrun and is wrappable CSS white-space, it records a break opportunity. The problem is, it passes PR_TRUE for the aFits parameter, which is sometimes incorrect ... sometimes, such as in this testcase after the <br>, the break position after the frame is beyond the available width. Thus this "bad" break opportunity wipes out the "good" one that really did fit. The fix is to return in CanPlaceFrame whether the trailing edge of the frame fits in the available width, pass that for aFits.

This also shows the "shouldn't be updating the break position after we've already flagged an overrun" assertion firing incorrectly. It's legitimate to get a NotifyOptionalBreakPosition call after we've detected an overrun, but aFits must be false.
Attachment #291856 - Flags: superreview?(dbaron)
Attachment #291856 - Flags: review?(dbaron)
Whiteboard: [needs review]
Block p2 since I'd hope we'd squash the layout/text changes before B3..
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
I don't think that's going to happen unfortunately.
(In reply to comment #6)
> I don't think that's going to happen unfortunately.
> 

I can dream right :-)?  Please adjust if you think P2 is not right...
Comment on attachment 291856 [details] [diff] [review]
fix

r+sr=dbaron
Attachment #291856 - Flags: superreview?(dbaron)
Attachment #291856 - Flags: superreview+
Attachment #291856 - Flags: review?(dbaron)
Attachment #291856 - Flags: review+
I'm not sure if we should take this for beta2. David, what do you think?
Whiteboard: [needs review] → [needs landing]
I don't have strong feelings either way; you probably have a better handle on the bugs that have been filed.
Comment on attachment 291856 [details] [diff] [review]
fix

Let's do it. This is a tough call but I think the risk is low and I'm afraid that this bug could be common.
Attachment #291856 - Flags: approvalM10?
Comment on attachment 291856 [details] [diff] [review]
fix

k - if you think it's good let's do it roc
Attachment #291856 - Flags: approvalM10?
Attachment #291856 - Flags: approvalM10+
Attachment #291856 - Flags: approval1.9+
checked in
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs landing]
verified fixed using the testcase from roc and Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9pre) Gecko/2008050621 Firefox/3.0pre
Status: RESOLVED → VERIFIED
No longer depends on: 440149
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: