Closed
Bug 412607
Opened 18 years ago
Closed 18 years ago
inline content not wrapping to next line, when it should
Categories
(Core :: Layout, defect, P2)
Core
Layout
Tracking
()
VERIFIED
FIXED
People
(Reporter: phiw2, Assigned: dholbert)
References
()
Details
(Keywords: regression, testcase)
Attachments
(7 files, 1 obsolete file)
|
1.16 KB,
text/html
|
Details | |
|
421 bytes,
text/html
|
Details | |
|
338 bytes,
text/html
|
Details | |
|
289 bytes,
text/html
|
Details | |
|
392 bytes,
text/html
|
Details | |
|
2.86 KB,
patch
|
Details | Diff | Splinter Review | |
|
2.29 KB,
patch
|
dholbert
:
review+
dholbert
:
superreview+
|
Details | Diff | Splinter Review |
The linked site shows unneeded scrollbars around each post.
In the testcase:
An image at the end of a line, it should drop to the next line.
wrapped in a div {overflow:auto}, inside a table.
regression range: (tested OS X PPC-10.4)
fails
Gecko/2007102004 Minefield/3.0a9pre
works
Gecko/2007101904 Minefield/3.0a9pre
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2007-10-19+03%3A30%3A00&maxdate=2007-10-20+03%3A30%3A00&cvsroot=%2Fcvsroot
--> bug 393096
Flags: blocking1.9?
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
| Assignee | ||
Comment 1•18 years ago
|
||
This reduced testcase reproduces the bug on both Mac & Linux.
(haven't tried windows; it probably happens there too. If not, I'm sure it would reproduce there after tweaking the image width)
As a first guess, it looks like this bug has something do with the whitespace between the "x" character and the image. If I remove the whitespace betwen the text and the image, I can't get a scrollbar to appear, even when I increase the image's width 1px at a time so that it eventually wraps to the next line.
This is also is true of the original testcase on Mac -- if I remove the whitespace between the text and the image, the bug doesn't reproduce.
| Assignee | ||
Updated•18 years ago
|
OS: Mac OS X → All
Hardware: Macintosh → All
| Assignee | ||
Comment 2•18 years ago
|
||
(In reply to comment #1)
> Created an attachment (id=300542) [details]
> testcase 2
>
> This reduced testcase reproduces the bug on both Mac & Linux.
> (haven't tried windows
It reproduces on Windows as well. (Tested using Firefox 3b2)
| Assignee | ||
Comment 3•18 years ago
|
||
This reduced testcase shows that we need neither a table nor an image to reproduce this bug.
The table was just limiting the width of the "overflow: auto" div (which can be done with CSS), and the image was just acting as an inline fixed-width filler element (which can be done with an inline-block).
| Assignee | ||
Comment 4•18 years ago
|
||
and this testcase shows that "overflow: auto" isn't needed either, actually.
The green div should appear on a separate line from the 'x', but it appears on the same line. (tested on Windows/Mac/Linux)
When I increase the green div's width by 1px, however, it drops to the next line. (on my linux machine, at least)
| Assignee | ||
Comment 5•18 years ago
|
||
(In reply to comment #3)
> This reduced testcase shows that we need neither a table nor an image
(In reply to comment #4)
> and this testcase shows that "overflow: auto" isn't needed either, actually.
Generalizing summary to reflect these discoveries.
Summary: image not dropping to next line when in overflow:auto box and table → inline content not wrapping to next line, when it should
| Assignee | ||
Comment 6•18 years ago
|
||
Here's one more testcase -- it just uses divs to get the point across.
This testcase makes it clear (if it wasn't already) that we're basically ignoring the width of the space when deciding whether the green div needs to wrap or not.
We have:
[wrapper div: 100px wide]
[div a: 20px wide] [SPACE] [div b: 80px wide]
So the divs would fit perfectly if the whitespace were ignored, but not when we actually allocate space for it.
| Assignee | ||
Comment 7•18 years ago
|
||
(In reply to comment #6)
> we're basically ignoring the width of the space when deciding whether
> the green div needs to wrap or not.
Specifically, that happens here, in nsLineLayout::CanPlaceFrame:
http://mxr.mozilla.org/seamonkey/source/layout/generic/nsLineLayout.cpp#1166
1166 PRBool outside = pfd->mBounds.XMost() - mTrimmableWidth + endMargin > psd->mRightEdge;
1167 if (!outside) {
...
1172 return PR_TRUE;
1173 }
At this point, in the code:
- We're determining whether we can place the green div on the first line
- "pfd" is the perFrameData for the green div
- mTrimmableWidth = 300 = 5px, the width of the space before the green div
This seems clearly bad that we'd do this. AFAICT, we need to either:
A) be clearing mTrimmableWidth at some point, so the space is no longer considered "trimmable"
B) remove mTrimmableWidth from the subtraction in line 1166.
I think (A) seems more correct.
Assignee: nobody → dholbert
| Assignee | ||
Comment 8•18 years ago
|
||
(In reply to comment #7)
> we need to
> A) be clearing mTrimmableWidth at some point, so the space is no longer
> considered "trimmable"
Ah -- we actually already do clear mTrimmableWidth during the call of nsLineLayout::ReflowFrame for the green div, BUT we do it a bit too late -- at nsLineLayout:cpp:1013, 17 lines after we've called CanPlaceFrame and decided that the green div fits.
The chunk where we clear it is:
1011 if (!continuingTextRun) {
1012 if (!pfd->GetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE)) {
1013 mTrimmableWidth = 0;
1014 }
roc -- should we move this chunk to up above CanPlaceFrame?
Or, perhaps it should stay in its current position, but it should refer to the *next* frame in the line layout, rather than the current frame? (i.e. so that during nsLineLayout::ReflowFrame on the textFrame, we'd look ahead and see the div coming up, and proactively clear mTrimmableWidth as a result of the upcoming div not being a textframe.)
To tell the truth, I'm not sure what purpose it serves in it current position, without these changes.
> roc -- should we move this chunk to up above CanPlaceFrame?
Yeah, that sounds right.
| Assignee | ||
Comment 10•18 years ago
|
||
This patch fixes testcases 2-5 on linux, making the block wrap to the next line.
(original testcase doesn't reproduce the bug on linux)
| Assignee | ||
Comment 11•18 years ago
|
||
reftests, based on testcase 5.
| Reporter | ||
Comment 12•18 years ago
|
||
Your patch fixes the first test case as well (OS X 10.5). That one is very sensitive to the font chosen (or the font-metrics); make the box 1 or 2 px smaller or larger and you'll get hit..
| Assignee | ||
Comment 13•18 years ago
|
||
(In reply to comment #12)
> Your patch fixes the first test case as well (OS X 10.5).
Great, thanks for testing that!
> That one is very
> sensitive to the font chosen (or the font-metrics); make the box 1 or 2 px
> smaller or larger and you'll get hit..
That makes sense, and actually applies in all of the testcases -- the amount of leeway for reproducing the bug is the width of a space character, which is pretty small.
| Assignee | ||
Comment 14•18 years ago
|
||
(In reply to comment #13)
> > That one is very
> > sensitive to the font chosen (or the font-metrics); make the box 1 or 2 px
> > smaller or larger and you'll get hit..
>
> That makes sense, and actually applies in all of the testcases
Sorry -- to be clear, the "very sensitive to the font chosen" part *does* matter much more on the first testcase than on the other ones, because the first testcase has more text that grows/shrinks when the font changes.
| Assignee | ||
Updated•18 years ago
|
Attachment #301568 -
Flags: review?(roc)
Comment on attachment 301568 [details] [diff] [review]
fix v1
+ if (!continuingTextRun) {
+ if (!pfd->GetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE)) {
Use &&
Attachment #301568 -
Flags: superreview+
Attachment #301568 -
Flags: review?(roc)
Attachment #301568 -
Flags: review+
| Assignee | ||
Comment 16•18 years ago
|
||
(In reply to comment #15)
> Use &&
Ah, good call. Here's the patch again, with that change.
I'll land this when the tree quiets down.
Attachment #301568 -
Attachment is obsolete: true
Attachment #301952 -
Flags: superreview+
Attachment #301952 -
Flags: review+
| Assignee | ||
Comment 17•18 years ago
|
||
fix v1a & reftests checked in.
Checking in generic/nsLineLayout.cpp;
/cvsroot/mozilla/layout/generic/nsLineLayout.cpp,v <-- nsLineLayout.cpp
new revision: 3.297; previous revision: 3.296
done
RCS file: /cvsroot/mozilla/layout/reftests/bugs/412607-1-ref.html,v
done
Checking in reftests/bugs/412607-1-ref.html;
/cvsroot/mozilla/layout/reftests/bugs/412607-1-ref.html,v <-- 412607-1-ref.html
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/layout/reftests/bugs/412607-1a.html,v
done
Checking in reftests/bugs/412607-1a.html;
/cvsroot/mozilla/layout/reftests/bugs/412607-1a.html,v <-- 412607-1a.html
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/layout/reftests/bugs/412607-1b.html,v
done
Checking in reftests/bugs/412607-1b.html;
/cvsroot/mozilla/layout/reftests/bugs/412607-1b.html,v <-- 412607-1b.html
initial revision: 1.1
done
Checking in reftests/bugs/reftest.list;
/cvsroot/mozilla/layout/reftests/bugs/reftest.list,v <-- reftest.list
new revision: 1.341; previous revision: 1.340
done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•18 years ago
|
Attachment #301952 -
Attachment description: fix v1a (for landing) → fix v1a [checked in]
| Assignee | ||
Updated•18 years ago
|
Attachment #301579 -
Attachment description: reftests (as patch) → reftests [checked in]
| Assignee | ||
Updated•18 years ago
|
Flags: in-testsuite+
| Reporter | ||
Updated•18 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•