Closed Bug 46918 Opened 24 years ago Closed 23 years ago

[INLINE-H] line-breaking bug caused by +ve margin-right on inline elements [LINE] {ll}

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: ian, Assigned: waterson)

References

()

Details

(Keywords: css1, regression, testcase, Whiteboard: [Hixie-P2] (high profile: css1 test suite) fix in hand, awaiting review)

Attachments

(4 files, 2 obsolete files)

The margin-right property is affecting line wrapping of inline elements on all lines, instead of only the last one. For instance, span { margin-right: 10em; } <span> some long text that will span many lines </span> ...will have 10em of right margin on every line, not just after the word "lines". TO REPRODUCE: View attached testcase. EXPECTED RESULTS: The top section should lay out identically to the bottom section. ACTUAL RESULTS: margin-right is affecting every line of the SPAN. TESTED ON: Windows 2000 commercial build 6.0.17.2000072811.
Nominating for nsbeta3. This is a bad CSS1 correctness issue. It is also a regression and is a bug tested on a high profile test suite: the WSP's top 10 for MacIE.
QA Contact: petersen → py8ieh=bugzilla
Whiteboard: hit during nsbeta2 standards compliance testing
Am going to start with Marc's team for this one.
Assignee: clayton → attinasi
CC'ing waterson to see if his recent line work caused this regression? Chris, any chance?
Most likely; I'll take a look...
Assignee: attinasi → waterson
See also related bug 3490, which shows very odd results with negative right margins on inline elements. Chris, if you are not too doomed and can take that bug (bug 3490) I'm sure buster would be very thankful. ;-)
Summary: line breaking bug caused by margin-right on inline elements [LINE] → [INLINE-H] line-breaking bug caused by +ve margin-right on inline elements [LINE] {ll}
Status: NEW → ASSIGNED
Going to mark as [nsbeta3-], but I'll probably be looking at this while staggering through 3940. There seem to be several problems with margins and borders on inline elements.
Whiteboard: hit during nsbeta2 standards compliance testing → [nsbeta3-]
Target Milestone: --- → Future
Whiteboard: [nsbeta3-] → [nsbeta3-]hit during nsbeta2 standards compliance testing
Keywords: rtm
Marking rtm-.
Whiteboard: [nsbeta3-]hit during nsbeta2 standards compliance testing → [nsbeta3-][rtm-] hit during nsbeta2 standards compliance testing
Keywords: mozilla1.0
Keywords: nsbeta3, rtmmozilla0.9, nsbeta1
Whiteboard: [nsbeta3-][rtm-] hit during nsbeta2 standards compliance testing → [Hixie-P2] (high profile: css1 test suite)
Blocks: 104166
any progress with this bug?
Blocks: 103709
Target Milestone: Future → mozilla0.9.9
This test case illustrates that the problem exists with margin-left, alone.
Attached patch fix for margin-left (obsolete) (deleted) — Splinter Review
This fixes margin-left, but not margin-right (that's going to be trickier, because we may or may not wrap the line depending on whether or not the right margin is applied). The fix is to zero the left margin _before_ adjusting the available width. Also, I'm really stumped as to why nsLineLayout::ApplyLeftMargin was trying to determine if the frame was floated. Inline frames that are floated get area frames created for them (see nsCSSFrameConstructor::ConstructFrameByDisplayType), so this code would never be reached. So I removed it. (I suppose I could add an NS_NOTREACHED if people don't trust me!)
OS: Windows 2000 → All
Hardware: PC → All
Comment on attachment 66576 [details] [diff] [review] fix for margin-left r=dbaron
Attachment #66576 - Flags: review+
... although I think it would be a good idea to add an assertion about floating, with a comment that there used to be code to handle it. (Remember when I tried to remove the code that handled incremental reflow during printing? :-)
Attached file test case for inline `margin-start' (deleted) —
This test case checks the starting margin for an inline frame: margin-left for left-to-right text; margin-right for right-to-left text.
The above patch supersedes attachment 66576 [details] [diff] [review]: it attempts to handle right-to-left text, as well. The only part of the patch that I'm not sure about is the detection of a right-to-left text frame; specifically, I doubt that I'm correctly taking embedding levels into account (since I don't really understand them). nsLineLayout::CanPlaceFrame had the same vestigial floater detection code, which I've changed to an assertion.
Attachment #66576 - Attachment is obsolete: true
Attached patch fix (deleted) — Splinter Review
Actually, attachment 66878 [details] [diff] [review] should be a complete fix for this bug and bug 3490, modulo a minor glitch that this patch fixes. (And the question of whether or not I'm detecting the directionality correctly.)
Attachment #66878 - Attachment is obsolete: true
Keywords: review
Whiteboard: [Hixie-P2] (high profile: css1 test suite) → [Hixie-P2] (high profile: css1 test suite) fix in hand, awaiting review
You shouldn't need to take embedding levels into account for this, only the paragraph direction, so the direction tests look OK to me. Does the patch have any impact on bug 121633?
Blocks: 3490
I banged around on bug 121633 for a while: it may be necessary to fix this bug for 121633 to work, but it is not sufficient.
Blocks: 121633
Layout regression tests pass with no bbox errors.
Comment on attachment 66882 [details] [diff] [review] fix looks good r=rbs
Attachment #66882 - Flags: review+
Comment on attachment 66882 [details] [diff] [review] fix sr=kin@netscape.com Should we change "left" and "right" in the following comment to "start" and "end"? + // Adjust available width to account for the left margin. The + // right margin will be accounted for when we finish flowing the + // frame.
Attachment #66882 - Flags: superreview+
Right. Thanks!
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
VERIFIED FIXED. Go Chris! :-D
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: