Open Bug 413027 Opened 17 years ago Updated 3 years ago

Marquee height is sized too small, clipping text vertically

Categories

(Core :: Layout, defect)

defect

Tracking

()

REOPENED

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

()

Details

(Keywords: regression, testcase, Whiteboard: [not needed for 1.9])

Attachments

(11 files, 3 obsolete files)

484 bytes, text/html
Details
318 bytes, text/html
Details
300 bytes, text/html
Details
342 bytes, text/html
Details
1005 bytes, patch
roc
: review+
Details | Diff | Splinter Review
442 bytes, text/html
Details
622 bytes, text/html
Details
14.41 KB, patch
dbaron
: review-
dbaron
: superreview-
Details | Diff | Splinter Review
5.53 KB, application/zip
Details
1.00 KB, patch
roc
: review+
beltzner
: approval1.9+
Details | Diff | Splinter Review
2.30 KB, patch
beltzner
: approval1.9+
Details | Diff | Splinter Review
Marquee height is sized too small, clipping text vertically STEPS TO REPRODUCE 1. load the attached testcase ACTUAL RESULT I can see the top 3-4 pixels of the text scrolling from right to left. EXPECTED RESULT To see the full text scrolling from right to left. PLATFORMS AND BUILDS TESTED Bug occurs in Firefox trunk 2008011804 on Linux. Bug does not occur in Firefox 2.0.0.11 on Linux. Regression window: 2008-01-09-04 -- 2008-01-10-04 (I'm guessing bug 407016)
Attached file Testcase #1
Attached file testcase2
Vertical margin doesn't seem to be taken into account when inside a display: -moz-box; overflow: hidden; box. This is something that was fixed somehow on branch between 2007-07-09 and 2007-07-12: http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=MOZILLA_1_8_BRANCH&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2007-07-09+03&maxdate=2007-07-12+06&cvsroot=%2Fcvsroot Somehow fixed by bug 384344 on branch?
Attached file testcase3
Without using overflow: hidden;
Attached file reference
By using display: table; on the in-between div, I get the desired rendering. I guess I could the same as a hack for marquee, if needed.
Attached patch patchSplinter Review
This fixes the bug, but I haven't tested it a lot, and I'd rather see the underlying issue fixed.
Flags: blocking1.9? → blocking1.9+
Priority: -- → P3
I guess there might be a relation with bug 412646 here.
Another marquee TestCase, an H2 inside marquee displayed incorrectly 3.0b3. regression,
The block inside the box should be a margin-root, but it isn't.
Hmm. Most things that contain blocks have dedicated anonymous block children that we know to set NS_BLOCK_MARGIN_ROOT on. But XUL and MathML frames with block children don't have such anonymous wrappers so we don't know where to set NS_BLOCK_MARGIN_ROOT.
Oh, nsBlockFrame::BlockIsMarginRoot takes care of that. Where things actually go wrong is nsFrame::RefreshSizeCache where we compute the pref-size for the DIV-as-box. The pref-height and min-height are both set to just the height of the highest line-box. The ascent is set to the block's first line ascent, which includes the top margin. Then box layout goes off to compute its desired height, but by that point the bottom-margin has been completely forgotten. This is an insane way to compute the block preferred height. Why don't we just use the height the block asked for? We did just reflow it with its preferred width, after all.
Attached patch fix (obsolete) — Splinter Review
This fixes the bug. It's the scariest patch I've seen in a while. I'll run reftests and mochitests and see how things go.
Assignee: nobody → roc
Status: NEW → ASSIGNED
The patch passes reftests and mochitests. I did some CVS archaeology. The original checkin of this approach to finding the min-height/pref-height for a box-wrapped block was in bug 110328. Naturally there's no discussion there of the new approach. The basic idea seems to have been that if 'maxElementWidth' (i.e. min-width) is the width of the widest unbreakable segment of the content, then the corresponding min-height must be the height of the tallest vertically unbreakable segment of the content, i.e. the height of the tallest line. Which makes no sense.
Comment on attachment 306198 [details] [diff] [review] fix This really does seem like the right thing to do. I guess if we do it, we should do it now for beta4.
Attachment #306198 - Flags: superreview?(dbaron)
Attachment #306198 - Flags: review?(dbaron)
I really think we should do this.
Flags: blocking1.9+
Priority: P2 → P1
Flags: tracking1.9+
Comment on attachment 306198 [details] [diff] [review] fix OK, r+sr=dbaron. Sorry for the delay. I'm not sure whether this is really the right thing to do, but it's not bad, and it's better than the old behavior.
Attachment #306198 - Flags: superreview?(dbaron)
Attachment #306198 - Flags: superreview+
Attachment #306198 - Flags: review?(dbaron)
Attachment #306198 - Flags: review+
Checked in
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: [needs review]
Checked in reftest.
Flags: in-testsuite+
This caused a reftest to fail so I backed it out. *** 11816 ERROR FAIL | Error thrown during test: document.elementFromPoint(pt.x, pt.y) is null | got 0, expected 1 | /tests/content/xul/document/test/test_bug199692.xul
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Sorry, I mean a mochitest, on all 3 platforms. Which is strange since I ran mochitests and they were OK. It may have also been responsible for 3 MathML-related reftest failures on Linux, although I don't see how: REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/bugs/347348-1.xhtml REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/bugs/347496-1.xhtml REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/bugs/355548-3.xml
Looks like this wasn't responsible for those reftest failures, they persisted after the backout.
That Mochitest passes for me on Linux.
Windows build still in progress, but I don't expect it to be any different. I relanded this with extra code in test_bug199692.xul to tell me which part of the test actually failed (that extra code may as well stay). I'm also sort of hoping that the failure doesn't occur again.
My local Windows build passed. Tinderboxes still fail: *** 11823 ERROR FAIL | Point on XBL content should return element with -moz-binding style (returned null) | | /tests/content/xul/document/test/test_bug199692.xul *** 11824 ERROR FAIL | Error thrown during test: e is null | got 0, expected 1 | /tests/content/xul/document/test/test_bug199692.xul Maybe I need to run the tests all in one long run like Tinderboxes do?
Yes, if I run the tests from its parent directory, it fails! Even though it's the first test in the list!
That's probably because running from the parent directory puts the test in a small IFRAME, and the problematic elementFromPoint is testing a coordinate outside the IFRAME (and hence <window>) bounds.
For some reason, the <window> isn't growing to contain the full height of the <body> *with* my patch, but it does *without* my patch.
OK, the problems with my patch are caused by a different XUL layout bug shown in this testcase. If a XUL box contains a block whose height is equal to its min/pref height, then we don't take the ChildResized path in nsSprocketLayout because the block's rect doesn't change, so we never get around to adjusting the XUL box height for the block min-height. OTOH if the block has two lines so its height is not the height computed by the insane min/pref height code this bug removes, then the ChildResized path kicks in and the XUL box height adjusts properly.
Attachment #308801 - Attachment mime type: application/vnd.mozilla.xul+xml → text/html
Attached patch fix v2 (obsolete) — Splinter Review
Additional fix in nsSprocketLayout to update the frame bounds early if a child's min-size demands it. The surrounding code is horrible but looking at how originalClientRect is used later, this should be safe. I'll run reftests and mochitests but I'm reasonably confident in the patch; anything it would break must already be extremely fragile since this update would happen anyway if a child changed its size in any way.
Attachment #306198 - Attachment is obsolete: true
Attachment #308964 - Flags: superreview?(dbaron)
Attachment #308964 - Flags: review?(dbaron)
> to update the frame bounds early Sorry, we don't actually update the frame bounds, we just update "originalClientRect" which represents our idea of what the frame bounds should eventually be.
Whiteboard: [needs review]
Attached patch fix v3 (obsolete) — Splinter Review
Reftests found one case where we are depending on the XUL layout bug: scrollbars. nsGfxScrollFrame sets the scrollbar size to zero and expects that to be honoured even though it's below the minimum size. That was a mistake. So now I change nsGfxScrollFrame to not rely on that being honoured; hidden scrollbars are just ignored by BuildDisplayList. (Scrollbars are already ignored for computing the overflow area.)
Attachment #308964 - Attachment is obsolete: true
Attachment #308998 - Flags: superreview?(dbaron)
Attachment #308998 - Flags: review?(dbaron)
Attachment #308964 - Flags: superreview?(dbaron)
Attachment #308964 - Flags: review?(dbaron)
Comment on attachment 308998 [details] [diff] [review] fix v3 r+sr=dbaron, but I'd prefer that you leave the childResized variable in, #ifdef DEBUG, and then, in your code that handles the new condition, add an NS_ASSERTION(childResized, "this condition should be more restrictive than the old childResized condition") or something to that effect.
Attachment #308998 - Flags: superreview?(dbaron)
Attachment #308998 - Flags: superreview+
Attachment #308998 - Flags: review?(dbaron)
Attachment #308998 - Flags: review+
We do want to change the frame bounds in cases where childResized is false (i.e. the child didn't change size after we called GetMinSize on it). The testcase here, for example. So I'm not sure what you mean.
So, this causes new mochitest failures: *** 47130 ERROR FAIL | listbox: Page down should go to the item one visible page away | got "listbox_item14", expected "listbox_item8" | /tests/toolkit/content/tests/widgets/test_hiddenpaging.xul *** 47131 ERROR FAIL | listbox: Page down should have scrolled down a visible page | got 2, expected 7 | /tests/toolkit/content/tests/widgets/test_hiddenpaging.xul *** 47132 ERROR FAIL | listbox: Second page down should go to the item two visible pages away | got "listbox_item14", expected "listbox_item13" | /tests/toolkit/content/tests/widgets/test_hiddenpaging.xul *** 47133 ERROR FAIL | listbox: Second page down should not scroll beyond the end | got 6, expected 9 | /tests/toolkit/content/tests/widgets/test_hiddenpaging.xul They're all in one test so maybe it's not severe...
This problem is in the layout of scrollable grid row groups. We have a single listcol; when we lay it out, nsGridRowLeafLayout::PopulateBoxSizes returns a boxSizes list containing the sizes of all the rows so we end up computing a size for the listcol which is big enough for all the rows. In the listbox, the columns are in an nsStackLayout with the scrollable rows, and so the whole thing grows to the size of the largest child, which is the listcol. Effectively the desired size of the actual rows is ignored. So this has regressed because before my change to nsSprocketLayout, the size desired by the children simply wasn't taken into account to compute the final size of the listcol. (It would have been if one of the listcol children changed size during the listcol layout, but there aren't any children in this case.) I'm not really sure how to fix this. I'll have to think about it.
Attached patch fix v4Splinter Review
Same as before, plus a fix in nsGridRowLeafLayout::PopulateBoxSizes to ignore the pref and min size contribution of rows inside a scrollable group when sizing the columns. Note that those pref and min sizes will still potentially contribute to the layout of the grid body. Seems pretty safe. Passes reftests and mochitests on Mac.
Attachment #308998 - Attachment is obsolete: true
Attachment #309358 - Flags: superreview?(dbaron)
Attachment #309358 - Flags: review?(dbaron)
Could you explain why you think the nsGridRowLeafLayout change is safe? (Also, the patches differ since v4 doesn't have the added reftest files, but that seems ok since it looks like they weren't backed out after landing v3.)
(In reply to comment #37) > (Also, the patches differ since v4 doesn't have the added reftest files, but > that seems ok since it looks like they weren't backed out after landing v3.) That's right. > Could you explain why you think the nsGridRowLeafLayout change is safe? It prevents the min/pref height of grid items in a scrollable container from contributing to the min/pref height of a grid column frame. (And similar for widths and grid row frames). Currently on trunk a grid column has completely the wrong height in that situation --- it's the height of the full grid contents, even if the grid is shorter. Since the frame is outside the scroll frame, if it rendered anything it would render incorrectly. The stack will still stretch the column to the height of the grid, so we're not losing anything other than the ability of the column to stretch the height of the grid, in this specific situation, which doesn't seem like something we want anyway.
> Currently on trunk a grid column has completely the wrong height in that > situation Actually that's not true. Because of the sprocket layout bug that I'm fixing here, and the fact that the column frame never has any children, currently AFAICT the column frame never actually takes the min/pref height of its children into account.
Target Milestone: --- → mozilla1.9beta5
Comment on attachment 309358 [details] [diff] [review] fix v4 So I wrote a bunch of grid reftests to try to understand what this change is doing. I'm not sure that I agree with the behavior they're testing, but patch v4 does significantly more than just reverting what patch v3 does to scrollable grid row groups. In particular, it seems to make some columns disappear. Have a look at layout/xul/base/src/grid/reftests/scrollable-columns.xul (which I'll land once the tree turns green again). I don't think we have a good spec for what these things are supposed to do or who depends on what, but changing grid this significantly at this point scares me. Maybe there's a simple fix, though.
Attachment #309358 - Flags: superreview?(dbaron)
Attachment #309358 - Flags: superreview-
Attachment #309358 - Flags: review?(dbaron)
Attachment #309358 - Flags: review-
Whiteboard: [needs review] → [review denied]
With roc out, is it reasonable to expect us to get this in beta 5?
I'm not sure. I started to look at it just now, and I'll try to continue tomorrow. I had another look at the behavior of the grid testcases that I'd written with the patch to see if it made any sense; I still don't think it does. In one case it causes a scrollbar thumb to have a size that doesn't match the scrolled/scrollable area ratio (though it matches the ratio that it would have if the rendering were correct). And it seems to cause some rows/columns to disappear. Furthermore, the problem isn't just a theoretical problem with my testcases -- it breaks all the font size dropdowns in the advanced part of font preferences. They end up too narrow (or, in the min font size case, too short -- except that seems to happen even without the grid patch), and the dropdowns are misplaced relative to the control. (Preferences -> Content -> Fonts & Colors -> Advanced) I have a rough idea of what I think the grid code ought to be doing -- something like ignoring row-progression-direction contributions of rows inside a scrollable rowgroup to the size of the grid as a whole (or the size of its other-direction rowgroup child) -- but I still haven't figured out the grid code well enough to do that.
So, thinking about it a little more, maybe what roc did is roughly right, except that: * we want to do it for min size only, and not pref size * we also want it to apply to row groups in a scrollable row group container
Really appreciate you taking this on, David. Above and beyond the call.
Aha! The other problem with roc's patch is that nsGrid::GetScrollBox always returns non-null.
It turns out that fixing this bug is going require a bunch of changes to poorly understood XUL code in ways that impact XUL apps. The original regression was really quite minor and does not justify that kind of risk, so David and I agreed to take this off the blocking list.
Flags: wanted-next+
Flags: blocking1.9-
Flags: blocking1.9+
Priority: P1 → --
Whiteboard: [review denied]
Target Milestone: mozilla1.9beta5 → ---
For what it's worth, here's what I was working on top of fix v3. It didn't yet do what I expected it do do, though.
Blocks: 412646
(In reply to comment #46) > It turns out that fixing this bug is going require a bunch of changes to poorly > understood XUL code in ways that impact XUL apps. The original regression was > really quite minor and does not justify that kind of risk, so David and I > agreed to take this off the blocking list. > I voted for this bug because I saw that the use of Marquee was quite popular in the Far East? For a few references see: http://blog.mozilla.com/gen/2007/11/08/browser-and-web-content-compatibility-in-asia/ http://simonwillison.net/2002/Aug/30/marqueeInMozilla/
I'm aware of that. Martijn, can we take the patch in comment #5?
Comment on attachment 298105 [details] [diff] [review] patch Yeah, I guess that's the only solution at this point, then. I still need to see if this passes reftests, though (I didn't do that last time, iirc). Also, need to test a bunch of websites and testcase, I have.
Attachment #298105 - Flags: review?(roc)
Comment on attachment 298105 [details] [diff] [review] patch This should work unless the children contain table parts, but hopefully that's not going to happen.
Attachment #298105 - Flags: superreview+
Attachment #298105 - Flags: review?(roc)
Attachment #298105 - Flags: review+
Previous patch caused a reftest failure (407016-1-a.html and 407016-1-b.html). This fixes it. I still need to write marquee reftests for this bug itself.
Attachment #311598 - Flags: review?(roc)
I tested a lot of marquee pages with the workaround patch and it seems to work ok.
Attachment #312019 - Attachment is patch: true
Attachment #312019 - Attachment mime type: application/octet-stream → text/plain
Attachment #311598 - Flags: approval1.9?
Comment on attachment 312019 [details] [diff] [review] reftest for marquee a=beltzner
Attachment #312019 - Flags: approval1.9+
Comment on attachment 311598 [details] [diff] [review] workaround patch v2 a=beltzner
Attachment #311598 - Flags: approval1.9? → approval1.9+
https://bugzilla.mozilla.org/attachment.cgi?id=311598 and https://bugzilla.mozilla.org/attachment.cgi?id=312019 can be checked in. It can be that the reftest fails on Mac, because of some half pixel difference thingie (which was explained to me that's not a bug). In that case, it doesn't have to be backed out per se, but the text 'text' can be replaced with '&nbsp;', for example.
Keywords: checkin-needed
Checking in xbl-marquee.xml; /cvsroot/mozilla/layout/style/xbl-marquee/xbl-marquee.xml,v <-- xbl-marquee.xml new revision: 1.32; previous revision: 1.31 done Checked in the workaround patch.
https://bugzilla.mozilla.org/attachment.cgi?id=312019 (reftest for marquee) also checked in now.
OS >> All, please
OS: Linux → All
Hardware: PC → All
Depends on: 429849
Whiteboard: [not needed for 1.9]
Bug 412646 also suffered from this same issue, I think. But that bug was fixed by a workaround solution. There is a testcase in that bug that needs to be verified, when this gets fixed: https://bugzilla.mozilla.org/attachment.cgi?id=297757
Flags: blocking1.9.2?
We checked in Martijn's workaround, can we close this bug?
It's a workaround, no? Isn't a real fix needed here?
Flags: wanted1.9.2-
Flags: blocking1.9.2?
Flags: blocking1.9.2-
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: