Closed Bug 1622488 Opened 6 years ago Closed 6 years ago

[wpt-sync] Sync PR 22255 - Adds ability for slot to preserve order of its manually assigned nodes.

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 22255 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/22255
Details from upstream follow.

Yu Han <yuzhehan@chromium.org> wrote:

Adds ability for slot to preserve order of its manually assigned nodes.

Prior to this CL, the ordering of the manually assigned nodes is not
preserved. Nodes were assigned in tree-order. In addition, assignment
is not absolute. A slotable node can be assign to multiple slots, and
where it appears is when the assigned slot first appear in a tree-order
traversal, not the last slot the node is assigned to.

This CL does two things. One, the order of manually assigned node is
preserved. Two, assignment is absolute. The implementation uses a
HeapHashMap, candidate_assigned_slot_map_, to keep track of
assignment node -> slot. It uses this map during node assignment to
find if another assigned slot exists. When found, the node is
removed from the previously assigned slot.

Preserving the ordering of manually assigned nodes is done in
HTMLSlotElement::UpdateManuallyAssignedNodesOrdering(). This is called
at the end of SlotAssignment::RecalcAssignment(). RecalcAssignment()
walks the ShadowHost's children in tree-order, so the assigned node
could be out of order from how these nodes were assigned. I thought
about making a separate function for manually assigned nodes, looping
though assigned nodes instead. But I decided against it at this point
due to the complexity of the recalc function.

For Reference: point 1 in this comment is addressed by this CL.
https://github.com/whatwg/html/issues/3534#issuecomment-537802687

Bug:869308
Change-Id: Idc45cb593313b00f13cd5f29df8972bfe246ecce

Reviewed-on: https://chromium-review.googlesource.com/2103403
WPT-Export-Revision: f1cc33ed4fd0ec362397d77afa625771f58ec8b1

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a4bd51e91761 [wpt PR 22255] - Adds ability for slot to preserve order of its manually assigned nodes., a=testonly https://hg.mozilla.org/integration/autoland/rev/38b98e8539de [wpt PR 22255] - Update wpt metadata, a=testonly
Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.