Closed Bug 2089345 Opened 13 days ago Closed 4 days ago

[wpt-sync] Sync PR 64380 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=313028

Categories

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

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Sammy Gill <sammy.gill@apple.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=313028

WebKit export from bug: marketwatch.<!---->com:<!----> Tapping the “share” button causes the media controls to shift to the top of the video.<!---->

<pre>
marketwatch.com: Tapping the “share” button causes the media controls to shift to the top of the video.

When an element goes from display: none to some other display we need to
find a spot in the render tree to insert it. This is done by taking said
element and its rendering parent and finding its next sibling in the
render tree. One of the things that happens is we create an iterator to
go over the composed tree in order to find this spot.

However, one problem that can arise, which seems to be the source of the
bug on MarketWatch, is when the element we are creating a renderer for is
part of some slotted content that is a descendant of elements with
display: contents.

When we try to initialize the context stack, we walk up from the target
node to the root. Initially currentContext is set to the targeted node
and gets updated as we cross different boundaries. However, one thing to
note is that if we hit a parent/ancestor that has display: contents we
do not update contextCurrent. Then by the time we hit a boundary
and need to create a Context for the slotted content we use the targeted
node to compute the iterator's start and end.

For the case of the MarketWatch bug the iterator points to the targeted
node and the end iterator points to its sibling which is the source of
the bug. When we try to traverse the iterator we reach the end (the
sibling) and that gives us an incorrect insertion point. What should
instead happen is that the end should point to the end of the slotted
content, which is the end of the display: contents subtree.

To fix this we can:
1.) Detect this case if the node and the current context is not the
same and the node has display: contents.
2.) Create a dedicated constructor that will take in a separate node to
compute the iterator's end from alongside the current context and root.
This can replace the existing one and we can just pass in the same node
which is what we were doing before.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=313028">https://bugs.webkit.org/show_bug.cgi?id=313028</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/312003@main">https://commits.webkit.org/312003@main</a>
</pre>

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 367 tests

Status Summary

Firefox

OK : 296[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 297[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS : 1[GitHub] 43[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 15186[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 15201[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 15212[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL : 173
TIMEOUT: 1
ERROR : 1
NOTRUN : 2

Chrome

PASS : 1

Safari

PASS : 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

  • /shadow-dom/scroll-to-the-fragment-in-shadow-tree.html [wpt.fyi]: OK [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt], SKIP [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]
  • /shadow-dom/nested-hover-pseudo-class-removal.html [wpt.fyi]: PASS [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt], SKIP [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]
Status: NEW → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.