Open
Bug 376184
Opened 19 years ago
Updated 3 years ago
ignore margin-top of <p> inside <marquee>
Categories
(Core :: Layout, defect)
Tracking
()
NEW
People
(Reporter: moz, Unassigned)
References
()
Details
(Keywords: regression, testcase)
Attachments
(8 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a3pre) Gecko/20070307 Minefield/3.0a3pre
Build Identifier:
Block elements with margin inside a marquee element behave different in IE.
IE is inconsistent and handles <div> different from <p>, see testcase.
(<p> and it's margins are a special thing in IE anyway)
For more compatibility with IE I'd propose to ignore top margin of block elements inside marquee.
This would "fix" at least #1, #2, #4 and (partial)#7 of testcase.
Reproducible: Always
btw., #1 and #4 show the same problem as bug 314445.
#1 an #4 regressed against FF2.
Keywords: regression,
testcase
Comment 3•19 years ago
|
||
So when looking at your testcase, I observe 2 things for IE:
- the default margin of <p> inside marquee is 0 (alos in standards mode)
- The margin-top value of elements in vertical marquees is ignored.
So I think those are 2 things that Mozilla also could be doing to get more compatible marquees.
The testcase also shows a bug where margin-bottoms aren't rendered for elements inside marquees, that has probably something to do with the use of display: -moz-box.
Also, the background colors for #2, #3 and #5 are 100% wide for IE, while it is small for Mozilla. Not sure what can be done about that.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 4•19 years ago
|
||
This testcase shows that IE ignores:
- the margin-top when <p> is the first node inside the marquee
- the margin-bottom when <p> is the last node inside the marquee
Comment 5•19 years ago
|
||
The same goes for vertical marquees.
Comment 6•19 years ago
|
||
This shows that margin-top seems to be always ignored for the elements which are the first node in vertical marquees (with behavior=alternate?).
Comment 7•19 years ago
|
||
..which is not the case for horizontal marquees.
I propose the following addition in html.css:
marquee[direction=up] :first-child, marquee[direction=down] :first-child {
margin-top: 0 !important;
}
marquee p:first-child {
margin-top: 0;
}
This fixes all of testcase1, besides the background width issue and the margin-bottom thing of #3, #6 and #7 (which imo is less important).
(ps. Aren't your testcases wrong?)
#1, #1a,
Attachment #260289 -
Attachment description: testcase → testcase1
We have other block-like elements than p with margins (pre, ol, ul...). So this is better:
marquee[direction=up] :first-child, marquee[direction=down] :first-child {
margin-top: 0 !important;
}
marquee :first-child {
margin-top: 0;
}
In IE it is impossible to override top margins in the up/down case, so we need !important here.
In the general case you can override the default margin behaviour for <p>, <pre>, ....
| Reporter | ||
Comment 10•19 years ago
|
||
this order I like more...
marquee :first-child {
margin-top: 0;
}
marquee[direction="up"] :first-child, marquee[direction="down"] :first-child {
margin-top: 0 !important;
}
Comment 11•19 years ago
|
||
Ok, I guess it needs similar treatment as:
http://lxr.mozilla.org/seamonkey/source/layout/style/quirk.css#127
I think any new rules specific to marquee should reside here:
http://lxr.mozilla.org/seamonkey/source/layout/style/xbl-marquee/xbl-marquee.css
>In IE it is impossible to override top margins in the up/down case, so we need
>!important here.
Actually, I suspect that the computed style is still there for the top margin of the element, but that the vertical marquee just 'ignores' it in IE.
>(ps. Aren't your testcases wrong?)
> #1, #1a,
Could you explain? They could very certainly be wrong.
| Reporter | ||
Comment 12•19 years ago
|
||
(In reply to comment #11)
> Ok, I guess it needs similar treatment as:
> http://lxr.mozilla.org/seamonkey/source/layout/style/quirk.css#127
Yes, even though I don't know what :-moz-first-node exactly does, I'd say:
marquee > :-moz-first-node {
margin-top: 0;
}
marquee[direction="up"] > :-moz-first-node, marquee[direction="down"] > :-moz-first-node {
margin-top: 0 !important;
}
We shouldn't need the optimisation for marquee (listing all possible elements with top margin). Typically marquee hasn't lots of child nodes.
> I think any new rules specific to marquee should reside here:
> http://lxr.mozilla.org/seamonkey/source/layout/style/xbl-marquee/xbl-marquee.css
(I never saw this file)
> >In IE it is impossible to override top margins in the up/down case, so we need
> >!important here.
>
> Actually, I suspect that the computed style is still there for the top margin
> of the element, but that the vertical marquee just 'ignores' it in IE.
We should not care much about, should we? A simple CSS patch does the job.
> >(ps. Aren't your testcases wrong?)
> > #1, #1a,
>
> Could you explain? They could very certainly be wrong.
My time is short today (and was yesterday), I'll look again tomorrow.
(ignore |#1, #1a,| this was a typo)
| Reporter | ||
Comment 13•19 years ago
|
||
(In reply to comment #11)
> Could you explain? They could very certainly be wrong.
Testcase2 is wrong or I can't understand it.
Anyway, I created a new testcase. You can add dynamicly the style rules proposed in comment 12. I think that's the way to go.
It fixes:
* horizontal case (all top-margin issues)
* case "up-slide" (completely)
* case "up-alternate", case "down-alternate", case "down-slide" (all top-margin issues and some bottom issues)
Note: The general up/down case had no problems (besides wrong start position, maybe).
Comment 14•19 years ago
|
||
Testcase2 is the show the difference when the <p> is the first/last node in the marquee or not.
I just added an explanation for :-moz-first-node here:
http://developer.mozilla.org/en/docs/CSS::-moz-first-node
With some text at the start of the marquee, the first <p> would still match the :first-child selector, which it doesn't for the :-moz-first-node selector.
Thanks for that new testcase.
Comment 15•19 years ago
|
||
The computed style is indeed still there, it becomes relevant when the <div> would be absolutely positioned. But it's probably too far fetched to care about that.
So I think you're right margin: 0 !important; might indeed be the best solution.
| Reporter | ||
Comment 16•19 years ago
|
||
> I just added an explanation for :-moz-first-node here:
> http://developer.mozilla.org/en/docs/CSS::-moz-first-node
Cool, give us more of this...
(even though this case was almost obviously, besides the whitespace thing)
> margin: 0 !important; might indeed be the best solution.
So go ahead, make a patch and ask for review!
Comment 17•19 years ago
|
||
Comment 18•19 years ago
|
||
Comment on attachment 261021 [details] [diff] [review]
patch
I suspect you don't like adding additional rules in html.css for this.
I'm not sure how to get it working otherwise, other than a rather hacky way.
Attachment #261021 -
Flags: review?(dbaron)
All the existing rules like this are in quirk.css, for what it's worth.
| Reporter | ||
Comment 20•19 years ago
|
||
> All the existing rules like this are in quirk.css, for what it's worth.
Reverse-engineering MS's marquee completely only for quirks mode would be a bad idea.
Comment 21•19 years ago
|
||
dbaron was talking about the margin-top: 0; rule only.
| Reporter | ||
Comment 22•19 years ago
|
||
Yes, I tryed to say leaving this rules to quirks.css results in incomplete reverse-engineering of marquee.
This makes not much sense, given increasing ammount of webpages using strict doctype without decreasing use of marquee.
Comment on attachment 261021 [details] [diff] [review]
patch
I think this should be done the same way we do it for other things if we do it at all. That said, our rules in quirks.css are pretty horrible and we should really fix bug 33784. I'm not sure I'd want the performance hit of fixing this at all, given the frequency of use of marquee. And the rule you've added without an element name is going to be very slow. That's for the first rule you're adding.
I'd think the second rule you're adding could be fixed in the marquee code by having something that margins collapse through inside the marquee XBL binding, and just scrolling the marquee from one border edge of it to the other.
Attachment #261021 -
Flags: review?(dbaron) → review-
Depends on: 33784
Comment 24•18 years ago
|
||
David, thanks for the review (and explanation).
I agree with you, this is a rather trivial bug and if it would slow things down, it shouldn't be used.
I guess this could also be solved in a different way if styleexplicitcontent would work for xbl.
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•