Closed Bug 239919 Opened 20 years ago Closed 19 years ago

Marquee DOMAttrModified - should it stay?

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: doronr, Assigned: martijn.martijn)

Details

Attachments

(4 files, 1 obsolete file)

http://bugzilla.mozilla.org/show_bug.cgi?id=167224 introduced a DOMAttrModified
handler, which isn't performant.

I'll see if I can hack a way around it, or if we even need it in the end.
Well, it can be removed when you overload the setAttribute method, just like Erik did with his xbl marquee:
http://webfx.eae.net/dhtml/xblmarquee/implementation.html
(probably, putting all the extra properties/methods - that don't belong in a marquee - in a separate __marquee__ object is a good idea, also).

It might very well be that I need to 'steal' some code from him for this (and probably also for other marquee stuff). I've asked him if that's all right, and he agreed.

Also the removeAttribute method needs to be overloaded.
Attached file testcase
Attached patch patch1 (obsolete) — Splinter Review
Well, I actually didn't go for the approach in comment 1, but I took a kind of a pragmatic approach.
I overloaded the setAttribute and removeAttribute methods, but by using other known dom methods (setAttributeNodeNS and removeAttributeNode).
So these other dom methods don't work with this patch, but I don't think they are used a lot and certainly in combination with marquees.
Attachment #202052 - Flags: review?(doronr)
Attachment #202052 - Flags: review?(doronr) → review+
Attachment #202052 - Flags: superreview?(bzbarsky)
That breaks setAttributeNS too, no?

Personally, I think we should stop shying away from mutation listeners and just make mutation events stuck less in the core.
(In reply to comment #5)
> That breaks setAttributeNS too, no?
Yes, but that will also not be used on marquees since IE doesn't support setAttributeNS and marquee is generally considered an IE thing.

But I can rewrite the DOMAttrModified part, and leave out the setAttribute/removeAttribute part, if you prefer?
I think the rest of the patch is still necessary for cleanup/more correctness in behavior.

Comment on attachment 202052 [details] [diff] [review]
patch1

I agree with bz. This is not a good approach and I think that marquee is used rarly enough that we can avoid ughly hacks just to squeeze performance.

If we can't make mutation attributes listeners in xbl fast enough we have to come up with something better in XBL2.

This patch will not work for C++ callers or for getAttributeNS callers.
Attachment #202052 - Flags: superreview?(bzbarsky) → superreview-
Attached patch patch2Splinter Review
patch2, now still using the domattrmodified handler. 
This patch doesn't really have any relevance with this bug, but I started here, so, I'll keep posting the patches here.
This patch is for cleanup/more correctness. See the testcases.
Attachment #202052 - Attachment is obsolete: true
Attachment #202317 - Flags: review?(doronr)
Comment on attachment 202317 [details] [diff] [review]
patch2

>+                break;
>+              case "truespeed":
>+                //needed to update this._scrollDelay
>+                setTimeout(function(x){ x._set_scrollDelay(x.getAttribute('scrolldelay'), false); }, 0, this);

it is more readable to do var foo = function(){}; setTimeout(foo);
Attachment #202317 - Flags: review?(doronr) → review+
Comment on attachment 202317 [details] [diff] [review]
patch2

I'll address the review comment in a new patch.
Attachment #202317 - Flags: superreview?(bzbarsky)
Martijn, could you get someone else to sr this?  I won't be able to get to this for at least a week...
Comment on attachment 202317 [details] [diff] [review]
patch2

Sure, I'll ask Johnny.
Attachment #202317 - Flags: superreview?(bzbarsky) → superreview?(jst)
Comment on attachment 202317 [details] [diff] [review]
patch2

sr=jst
Attachment #202317 - Flags: superreview?(jst) → superreview+
Attached patch patch3Splinter Review
This is with Doron's review comment addressed.
Comment on attachment 202677 [details] [diff] [review]
patch3

So this is ready for check-in, right?
Assignee: doronr → martijn.martijn
mozilla/layout/style/xbl-marquee/xbl-marquee.xml; new revision: 1.19;
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Ok, patch3 is checked in, I'm marking this bug fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Hardware: All → PC
Resolution: --- → FIXED
Target Milestone: mozilla1.9alpha → ---
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Depends on: 362701
No longer depends on: 362701
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: