Closed
Bug 1359311
Opened 9 years ago
Closed 9 years ago
(intersection-observer) Send update notifications in same order as observed
Categories
(Core :: Layout, enhancement)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla56
| Tracking | Status | |
|---|---|---|
| firefox56 | --- | fixed |
People
(Reporter: tschneider, Assigned: tschneider)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file, 7 obsolete files)
|
5.37 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
At the moment we use a nsHashtable to keep a list of observations. When iterating over its keys, it doesn't guarantee to enumerate in the same order as they were inserted. The Intersection Observer spec mentions that this should be the case.
| Assignee | ||
Updated•9 years ago
|
Blocks: intersection-observer-impl
Comment 1•9 years ago
|
||
(In reply to Tobias Schneider [:tobytailor] from comment #0)
> At the moment we use a nsHashtable to keep a list of observations. When
> iterating over its keys, it doesn't guarantee to enumerate in the same order
> as they were inserted. The Intersection Observer spec mentions that this
> should be the case.
Direct spec link? Also "Notificate?"
| Assignee | ||
Updated•9 years ago
|
Summary: (intersection-observer) Notificate in same order as observed → (intersection-observer) Send update notifications in same order as observed
| Assignee | ||
Comment 2•9 years ago
|
||
Link to specific part of the spec: https://wicg.github.io/IntersectionObserver/#update-intersection-observations-algo, point 2.
| Assignee | ||
Comment 3•9 years ago
|
||
Use nsCOMArray instead of nsHashtable for mObservationTargets to guarantee insertion-order when iterating over its keys.
| Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8862939 -
Attachment is obsolete: true
Comment 6•9 years ago
|
||
Needs a test. Also needs a careful review of the object lifetime effects of this change.
| Assignee | ||
Comment 7•9 years ago
|
||
| Assignee | ||
Comment 8•9 years ago
|
||
Don't block enabling web platform test.
Attachment #8863195 -
Attachment is obsolete: true
Attachment #8868635 -
Flags: review?(bugs)
| Assignee | ||
Updated•9 years ago
|
Comment 9•9 years ago
|
||
Comment on attachment 8868635 [details] [diff] [review]
Send update notifications in same order as observed
The old mObservationTargets keeps raw pointers to elements, new one has strong refs. Aren't we leaking.
Don't you want nsTArray<Element*>, and a comment that the raw pointers are explicitly cleared by UnlinkTarget calls.
Attachment #8868635 -
Flags: review?(bugs) → review-
| Assignee | ||
Comment 10•9 years ago
|
||
Addressed review comments.
Attachment #8868635 -
Attachment is obsolete: true
Attachment #8868671 -
Flags: review?(bugs)
Comment 11•9 years ago
|
||
Comment on attachment 8868671 [details] [diff] [review]
Send update notifications in same order as observed
> DOMIntersectionObserver::UnlinkTarget(Element& aTarget)
> {
> if (!mObservationTargets.Contains(&aTarget)) {
> return;
> }
Could you now remove this. Contains is O(n) and so is RemoveElement, so at least we could
remove one possibly slow call.
>
>- mObservationTargets.RemoveEntry(&aTarget);
>- if (mObservationTargets.Count() == 0) {
>+ mObservationTargets.RemoveElement(&aTarget);
>+ if (mObservationTargets.Length() == 0) {
> Disconnect();
Not about this issue, but Disconnect() is intended using 4 spaces, should be just 2
>+
>+ // Holds raw pointers which are explicitly cleared by UnlinkTarget().
>+ nsTArray<Element *> mObservationTargets;
Nit, extra space before *
Attachment #8868671 -
Flags: review?(bugs) → review+
Comment 13•9 years ago
|
||
Adding dev-doc-needed so I can be sure this fix is reflected in docs if by some chance it's not in initial release (which I doubt will be the case, but at this point I'm documenting this API so I need to be sure).
Keywords: dev-doc-needed
Comment 14•9 years ago
|
||
(In reply to Eric Shepherd [:sheppy] from comment #13)
> Adding dev-doc-needed so I can be sure this fix is reflected in docs if by
> some chance it's not in initial release (which I doubt will be the case, but
> at this point I'm documenting this API so I need to be sure).
Of the IntersectionObserver fixes proposed to fix Web Platform Tests (see the 'blocks' list in bug 1358666,) this one is riskier to product stability. We may hold this change back one release to get more testing on it.
| Assignee | ||
Comment 16•9 years ago
|
||
Olli, I had to make small changes to the patch already reviewed by you. Latest builds failed due to incompatible types used for loop variables. Had to change it from uint32_t to size_t. Please give it a quick review.
Attachment #8880580 -
Attachment is obsolete: true
Attachment #8880707 -
Flags: review?(bugs)
| Assignee | ||
Comment 17•9 years ago
|
||
| Assignee | ||
Comment 18•9 years ago
|
||
Updated•9 years ago
|
Attachment #8880707 -
Flags: review?(bugs) → review+
Comment 19•9 years ago
|
||
Pushed by tschneider@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c285e406afb2
(intersection-observer) Send update notifications in same order as observed. r=smaug
Comment 20•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
| Assignee | ||
Updated•9 years ago
|
Blocks: intersection-observer
Comment 21•9 years ago
|
||
Removed DDN since this will be in place for initial availability.
Keywords: dev-doc-needed
Updated•8 years ago
|
Assignee: nobody → tschneider
You need to log in
before you can comment on or make changes to this bug.
Description
•