Closed Bug 313642 Opened 19 years ago Closed 19 years ago

Remove js width and height calculation hacks in marquee code which are not needed anymore

Categories

(Core :: Layout, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

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

References

(Depends on 1 open bug)

Details

Attachments

(4 files, 3 obsolete files)

This is a follow-up from bug 163505. Now that bug is fixed it makes it possible to clean some of the code up in xbl-marquee.xml.
By the way, I forgot that IE6 supports the bgcolor attribute (but not the background attribute) on the marquee. I would like to fix that here too in this bug.
Attached patch patch (obsolete) — Splinter Review
Attached file testcase
Well, the patch isn't working on the second part of this testcase. With the patch, it shows the background-image, but it should not.
How can I remove support for the background attribute, but keep bgcolor?
Blocks: 162980
To do that, you need to not use nsGenericHTMLElement::MapBackgroundAttributesInto.  You probably need to factor it into two functions (MapBackgroundInto and MapBGColorInto), with MapBackgroundAttributesInto calling both functions, and call only MapBGColorInto from this code.
Attached patch patch2a (obsolete) — Splinter Review
Ok, thanks.
I'm splitting the previous patch in two. This is the part without the bgcolor stuff.
Doron, if you could take a look at this too, that would be much appreciated!
Attachment #200627 - Attachment is obsolete: true
Attachment #200746 - Flags: review?(bzbarsky)
looks fine
Attachment #200746 - Flags: review?(bzbarsky)
Attached patch patch3 (obsolete) — Splinter Review
Ok, something like this, I guess.
Attachment #200746 - Attachment is obsolete: true
Attachment #200784 - Flags: review?(bzbarsky)
Comment on attachment 200784 [details] [diff] [review]
patch3

>Index: content/html/content/src/nsGenericHTMLElement.h
>+  static void MapBackgroundInto(const nsMappedAttributes* aAttributes,
>+                                          nsRuleData* aData);

Fix indent, please.

>+  static void MapBGColorInto(const nsMappedAttributes* aAttributes,
>+                                          nsRuleData* aData);
>+  /**

And here.

>Index: content/html/content/src/nsGenericHTMLElement.cpp
>+nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
>                                                   nsRuleData* aData)

And here.

>Index: content/html/content/src/nsHTMLDivElement.cpp
> nsHTMLDivElement::IsAttributeMapped(const nsIAtom* >+      sBackgroundAttributeMap,

That claims that "background" is mapped.  It's not.  You might want to just create a separate sBGAttributeMap for use here or something.

>Index: layout/style/xbl-marquee/xbl-marquee.xml
>-      <property name="width">

This makes the "width" getter behave very very differently than it used to.  Why is this change OK?  What happens for auto-width marquees?

>-              // "", 0 and empty height should default to 200px

What happened to that?  That is, I don't think we do this anymore; why not?

doron, please take a close look at the xml changes?  I don't see how they could possibly be "fine", but I'm not really qualified to review them to start with.
Attachment #200784 - Flags: review?(bzbarsky) → review?(doronr)
> This makes the "width" getter behave very very differently than it used to. 
> Why is this change OK?  What happens for auto-width marquees?
This testcase renders the same for me in Mozilla1.7, Firefox trunk and debug trunk build with patch, so nothing broken there with the patch. (Note, IE6 is different for the 3rd and 4th case, with a very small, almost 0 width, marquee)
I'm removing also the only consumer of the width property in xbl-marquee.xml, since I think it isn't necessary (anymore). That's this line in the patch:
-          this.outerDiv.style.width = this.width;

But to be frank, I don't know why it is OK to remove that code, since I don't know why it is in there, the first place. I tried to remove a large part of that code also in bug 235564. Doron insisted it should stay in. But I don't know of any sites/testcases/examples that gets fixed by that code. And to me, it looks like code that doesn't do anything, so that's why I keep getting removing it.
I haven't seen anything that regressed when removing that code.
I can leave it in if you prefer.

> >-              // "", 0 and empty height should default to 200px
> What happened to that?  That is, I don't think we do this anymore; why not?
Well, this is also done here:
http://lxr.mozilla.org/seamonkey/source/layout/style/html.css#489
But since attribute mapping wasn't working, the js code was also necessary, but currently not anymore.
Attached patch patch4Splinter Review
This patch should address the rest of your comments.
I've called the thing sBackgroundColorAttributeMap , it seems to me more in line with the rest.
Perhaps I should change MapBGColorInto into MapBackgroundColorInto?
Attachment #200784 - Attachment is obsolete: true
Attachment #200825 - Flags: review?(doronr)
Attachment #200784 - Flags: review?(doronr)
Comment on attachment 200825 [details] [diff] [review]
patch4

r=me for the marquee parts.

Hopefully if any stuff that was there for a reason that was removed will appear in bug reports :)
Attachment #200825 - Flags: review?(doronr) → review+
Comment on attachment 200825 [details] [diff] [review]
patch4

I have tested this on at least 20 url's with marquees in it and appr. 50 bugzilla marquee testcases.
I didn't find any regressions because of this patch.
Attachment #200825 - Flags: superreview?(bzbarsky)
Comment on attachment 200825 [details] [diff] [review]
patch4

sr=bzbarsky.  Thanks for the clarifications, Martijn!
Attachment #200825 - Flags: superreview?(bzbarsky) → superreview+
Assignee: nobody → martijn.martijn
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attached patch stuff I forgotSplinter Review
Eek!
I forgot to remove this stuff, this can also safely be removed, it is needed to fix bug 162980.
Attachment #200964 - Flags: review?(bzbarsky)
Attachment #200964 - Flags: superreview+
Attachment #200964 - Flags: review?(bzbarsky)
Attachment #200964 - Flags: review+
Comment on attachment 200964 [details] [diff] [review]
stuff I forgot

Checked this in.  Thanks, Martijn!
Thank you (and Doron). Marquee in Mozilla is still not perfect ;) , so if I could bother you people with some more patches, that would be great.
Bring them on.  ;)
Depends on: 314445
Depends on: 379255
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: