Closed
Bug 1160342
Opened 10 years ago
Closed 9 years ago
Implement <marquee> using mutation observers
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla47
People
(Reporter: cvan, Assigned: martijn.martijn)
References
Details
Attachments
(2 files, 5 obsolete files)
47 bytes,
text/html
|
Details | |
22.78 KB,
patch
|
Details | Diff | Splinter Review |
1. Load a page with a <marquee> tag.
2. Notice a JS warning appears in the Console:
> Use of Mutation Events is deprecated. Use MutationObserver instead.
–
The <marquee> tag should likely be reimplemented using mutation observers.
Comment 1•10 years ago
|
||
Martijn, want to fix this?
Comment 2•10 years ago
|
||
(though, it is not clear to me MutationObservers are synchronous enough for this.)
Assignee | ||
Comment 3•10 years ago
|
||
I'll take a look at it later, if someone doesn't beat me to it.
Assignee: nobody → martijn.martijn
Assignee | ||
Comment 4•9 years ago
|
||
It looks like MutationObservers are slow, something like this returns 'scrollalternate' with DOMAttrModified (which is correct) and 'scrollscroll' with MutationObservers for marquees, which is incorrect.
I'm not really sure if this would be an issue with real pages on real sites.
There is no way to speed up MutationObservers, is there?
Or we could overload setAttribute/removeAttribute et all, but that was shot down in bug 239919.
Flags: needinfo?(bugs)
Assignee | ||
Comment 5•9 years ago
|
||
Fwiw, I have something like this for now.
Assignee | ||
Comment 6•9 years ago
|
||
Ok, it might be that .behavior should just reflect the behavior attribute or I need to fix the behavior property.
Flags: needinfo?(bugs)
Comment 7•9 years ago
|
||
(In reply to Martijn Wargers [:mwargers] (QA) from comment #4)
> It looks like MutationObservers are slow, something like this returns
> 'scrollalternate' with DOMAttrModified (which is correct) and 'scrollscroll'
> with MutationObservers for marquees, which is incorrect.
> I'm not really sure if this would be an issue with real pages on real sites.
> There is no way to speed up MutationObservers, is there?
MutationObservers are, last time I checked, 7x faster than MutationEvents ;)
But they aren't synchronous. The callback is called at the end of a microtask.
See comment 2.
Assignee | ||
Comment 8•9 years ago
|
||
Something like this, I guess. The mochitest handles various cases, the todo_is is basically what IE is doing, but what Mozilla currently isn't doing with the patch. Although, I'm wondering if it's really worth the effort to mimick IE in all cases here.
Does this need to go through mozreview or something?
Attachment #8717719 -
Attachment is obsolete: true
Attachment #8719322 -
Flags: review?(bugs)
Comment 9•9 years ago
|
||
(nothing _needs_ to go through mozreview. Some people prefer it, so people prefer the old style.)
Comment 10•9 years ago
|
||
Comment on attachment 8719322 [details] [diff] [review]
1160342.diff
> <setter>
>- this.setAttribute("scrollamount", val);
>+ if (isNaN(val) || val == null)
>+ val = 0;
>+ if (!this._set_scrollAmount(val)) {
>+ throw new Error("Invalid argument for Marquee::scrollAmount");
>+ } else {
>+ this.setAttribute("scrollamount", val);
>+ }
> </setter>
Making web exposed setters to throw is backwards incompatible change and should be done in a separate bug.
(and please test what other browsers do)
So waiting to see a patch which has just the minimal MutationObserver related changes.
Attachment #8719322 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 11•9 years ago
|
||
(In reply to Olli Pettay [:smaug] (high review load) from comment #10)
> Making web exposed setters to throw is backwards incompatible change and
> should be done in a separate bug.
> (and please test what other browsers do)
I think this got broken with the fix for bug 848939, but you're right, this is currently not working, so I guess it's bettor to remove it for now.
I did test what happens in Internet Explorer. Internet Explorer is passing all the tests in the mochitest.
Google Chrome is failing in 21 of the tests.
> So waiting to see a patch which has just the minimal MutationObserver
> related changes.
Ok, will do, I'll just make the tests todo_is() for the cases where it's not doing the same as Internet Explorer.
Ok, will do.
Assignee | ||
Comment 12•9 years ago
|
||
(In reply to Martijn Wargers [:mwargers] (QA) from comment #11)
> I think this got broken with the fix for bug 848939, but you're right, this
> is currently not working, so I guess it's bettor to remove it for now.
> I did test what happens in Internet Explorer. Internet Explorer is passing
> all the tests in the mochitest.
> Google Chrome is failing in 21 of the tests.
Here is an online version of the mochitest, btw: http://people.mozilla.org/~mwargers/mochitestjs2/test_bug1160342_marquee.html
Assignee | ||
Comment 13•9 years ago
|
||
Updated patch with the throwing error part removed. Also added a fix and some tests for the direction property.
What is still needed is more testing of direction=up/down, onbounce, onstart, onfinish. Also, if the actual properties work as advertised.
Also, the mutationObserver could also listen for the relevant attributes in question (although I don't know how that works regarding case sensitivity).
Or perhaps you only want to have this handle the minimal MutationObserver changes?
Attachment #8719322 -
Attachment is obsolete: true
Attachment #8720041 -
Flags: review?(bugs)
Comment 14•9 years ago
|
||
If we can keep the existing behavior with the uploaded patch, great.
Changes to behavior could be implemented in followup bugs.
Comment 15•9 years ago
|
||
So looks like the patch does add plenty of non-mutationobserver related fixes too.
I really would like to have first just the change to start using mutationobserver.
Comment 16•9 years ago
|
||
Comment on attachment 8720041 [details] [diff] [review]
1160342_marquee.diff
So could you split the non-mutationobserver related stuff to a separate patch/bug.
I'm talking about the changes to various getters and setters and so.
And change to _set_scrollDelay.
So I would expect to see a patch which has just those couple of
this._mutationActor(this._mutationObserver.takeRecords()); calls and
<method name="_mutationActor">...</method> and the change to constructor.
(or is there a reason to have all the other changes in this bug?)
Sorry being a bit difficult here, but
this all mainly to ease tracking possible regressions.
Attachment #8720041 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 17•9 years ago
|
||
Assignee | ||
Comment 18•9 years ago
|
||
Ok, this keeps existing attribute/property handling of marquees.
Wit this patch, the results are the same in the mochitest as we have currently (which is not correct in many ways).
Pushed to try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2a33e0f1020e
Attachment #8720242 -
Flags: review?(bugs)
Comment 19•9 years ago
|
||
Comment on attachment 8720242 [details] [diff] [review]
1160342_marquee.diff
Still don't know why we need those two parseInt calls, which seem like unrelated changes.
But fine.
Attachment #8720242 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 20•9 years ago
|
||
Because I would otherwise get differences in results in the mochitest.
Assignee | ||
Comment 21•9 years ago
|
||
Assignee | ||
Comment 22•9 years ago
|
||
Attachment #8717716 -
Attachment is obsolete: true
Attachment #8720041 -
Attachment is obsolete: true
Attachment #8720242 -
Attachment is obsolete: true
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 23•9 years ago
|
||
Keywords: checkin-needed
Comment 24•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•