Closed Bug 312770 Opened 19 years ago Closed 19 years ago

Table too wide because of marquee

Categories

(Core :: Layout: Tables, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: martijn.martijn, Assigned: martijn.martijn)

References

()

Details

(Keywords: regression, testcase)

Attachments

(6 files, 4 obsolete files)

At the url, the tables surrounding the marquees have become wider since the fix for bug 277208. That should not have happened.
Attached file testcase
Attached file testcase2
This happens because for some reason the offsetWidth of a display:table div is calculated including the margins it has, I think that is an incorrect thing to do.
Testcase2 should give approximately/precisely the same value for the two alerts, not something completely different.
Component: Layout → Layout: Tables
QA Contact: layout → layout.tables
So I guess the offsetWidth gets calculated here: http://lxr.mozilla.org/seamonkey/source/content/html/content/src/nsGenericHTMLElement.cpp#579 and for some reason nsTableOuterFrame.cpp is used as frame or something like that?
Martijn, tables have a very bizarre frame structure: the outer table frame the caption the inner table frame The inner table frame is the frame that corresponds to the table tag. The outer table frame is a place holder that inherits a couple of style properties from the the table frame (http://lxr.mozilla.org/seamonkey/source/layout/style/ua.css#60) However if you look fromt the parent frame point of view it sees first the outer table frame. Currently the outer table frame includes the margin around the inner table frame and caption and adjusts the margins for the different caption-side scenarios.
>sees first the outer table frame with a 0 margin, so it probably reports the outer width which includes the table margin as the offset width. I think Boris did file a bug about this but I can't find it now.
Attached file testcase3
Sorry, my previous analysis was wrong (although it still is a bug, but it is not what is causing this bug). This bug happens because of this line: http://lxr.mozilla.org/seamonkey/source/layout/style/xbl-marquee/xbl-marquee.xml#231 this.innerDiv.style.padding = "0px"; Here, the padding is changed and that seems to trigger an incremental reflow bug, which you can see in the testcase3 that I attached.
Attached patch patch1 (obsolete) — Splinter Review
Well, this fixes it for the marquees on the url, but for particular pages with the same layout and where there is a script which sets marquee.innerHTML to some other text dynamically, this bug could still be seen. The border-collapse: collapse; rule is necessary, because the marquees were also a bit too high on the page, and I think this also fixes the remaining issue in bug 269257. The xbl-marquee.css print rule is for printing. Alhough IE6 doesn't wrap on print preview, I think it's more print-friendly to wrap.
The patch also fixes the issue mentioned in bug 276729, comment 8.
Attachment #199926 - Flags: review?(bzbarsky)
>border-collapse: collapse; means asking for trouble
(In reply to comment #10) > >border-collapse: collapse; > means asking for trouble What trouble? What should I use instead? border:0px?
border-collapse is not a happy camper in Gecko, unfortunately. :( There are lots of bugs, esp with incremental stuff. Martijn, I'm not sure I follow what the patch is doing...
Martijn, border collapse, short BC, is 160k of nearly assembly code masceraded as C++ inside nsTableFrame.cpp. See http://en.wikipedia.org/wiki/Katorga when people work on this code. It needs to be rewritten. If you can acchieve the same without border-collapse then do it.
Attached file testcase4
Well, I need the border-collapse: collapse rule for this testcase. I get the following results in various browsers: Browser offsetwidth offsetheight IE6: 261 19 Mozilla1.7 261 20 patched trunk without border-collapse 261 24 patched trunk with border-collapse 261 20 Adding a border:0; rule doesn't make any difference, so it seems I can only use border-collapse:collapse to correct this. I can't really imagine it would cause many problems in this case, but if you say so. On the other hand, this isn't really a big deal and seems only to happen when the marquee is inside a table.
Attached patch patch2 (obsolete) — Splinter Review
This is the same as patch1, but without the border-collapse: collapse rule. You decide which one is preferred. > Martijn, I'm not sure I follow what the patch is doing... Instead of adding the style rules dynamically with javascript, the style rules are directly applied. That way, I don't trigger this incremental reflow bug (which is I guess, part of bug 47710). I've tested this on the majority of testcases in bugzilla and some urls, no regressions that I know of. Maybe you know somebody else who can review this? Doron? Ultimately, I think returning to xul:hbox is the best solution, because then the white-space:nowrap hack is not necessary. But currently that would regress bug 277208, which is a worse issue than the issues that the use of display:table hasve introduced.
Can you get away with border-spacing:0 instead of using border-collapse? Or does that do nothing here? And yes, if doron can review I could sr...
Attached patch patch3 (obsolete) — Splinter Review
(In reply to comment #16) > Can you get away with border-spacing:0 instead of using border-collapse? Or > does that do nothing here? Oops, I forgot about that one. Yes, that works.
Attachment #199926 - Attachment is obsolete: true
Attachment #200185 - Attachment is obsolete: true
Attachment #200208 - Flags: review?(doronr)
Attachment #199926 - Flags: review?(bzbarsky)
} /* This hack is needed until bug 119078 gets fixed */ - + + marquee > * > * > *{ + white-space: normal !important; + } } Please explain why that is needed. Are you trying to style the <html:div anonid="innerDiv">? If so, you should give it a class and style it using a classname rather.
Attached patch patch4 (obsolete) — Splinter Review
You're right. But I can use the [anonid="innerDiv"] attribute selector, instead of adding a classname.
Attachment #200208 - Attachment is obsolete: true
Attachment #200214 - Flags: review?(doronr)
For what it's worth, class selectors are a good bit faster than attribute selectors...
Attachment #200208 - Flags: review?(doronr)
Comment on attachment 200214 [details] [diff] [review] patch4 Please use a class selector
Attachment #200214 - Flags: review?(doronr) → review-
Attached patch patch5Splinter Review
Ok, so like this?
Attachment #200214 - Attachment is obsolete: true
Attachment #200226 - Flags: review?(doronr)
Comment on attachment 200226 [details] [diff] [review] patch5 >Index: layout/style/xbl-marquee/xbl-marquee.css >=================================================================== >RCS file: /cvsroot/mozilla/layout/style/xbl-marquee/xbl-marquee.css,v >retrieving revision 1.1 >diff -u -8 -p -r1.1 xbl-marquee.css >--- layout/style/xbl-marquee/xbl-marquee.css 18 Jul 2005 21:15:42 -0000 1.1 >+++ layout/style/xbl-marquee/xbl-marquee.css 20 Oct 2005 16:42:25 -0000 >@@ -45,10 +45,13 @@ marquee[height*="7"], marquee[height*="8 > > /* PRINT ONLY rules follow */ > @media print { > > marquee > * > * { > margin: 0 !important; > padding: 0 !important; > } /* This hack is needed until bug 119078 gets fixed */ >- >+ >+ marquee .innerDiv { >+ white-space: normal !important; >+ } > } You probably should just do: div.innerDiv { since the stylesheet is included only by the marquee anyways I believe.
Attachment #200226 - Flags: review?(doronr) → review+
(In reply to comment #23) > You probably should just do: > > div.innerDiv { > > since the stylesheet is included only by the marquee anyways I believe. Yes, you're right, but somehow, I'm scared of that.
(In reply to comment #24) > (In reply to comment #23) > > You probably should just do: > > > > div.innerDiv { > > > > since the stylesheet is included only by the marquee anyways I believe. > Yes, you're right, but somehow, I'm scared of that. > > > Should be fine.
Attachment #200226 - Flags: superreview?(bzbarsky)
Comment on attachment 200226 [details] [diff] [review] patch5 Yeah, please use a straight class selector. That's actually faster than using a descendant like that. sr=bzbarsky with that.
Attachment #200226 - Flags: superreview?(bzbarsky) → superreview+
Ok, this uses a straight class selector. Ready for checkin.
Assignee: nobody → martijn.martijn
Fixed on trunk. Please make sure we have a bug filed on the actual underlying incremental reflow issue!
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Ok, I filed bug 313520 about that.
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: