LibWeb: Keep a seek's target position when pausing a media element

The spec's steps for pausing an HTMLMediaElements prescribe setting the
official playback position to the current playback position, but the
seeking steps are not synchronous, so there's no guarantee that the
current playback position reflects the seek. Therefore, we need to skip
that step if we're in the middle of a seek.

This is included in a pull request to the HTML spec:
https://github.com/whatwg/html/pull/11792
This commit is contained in:
Zaggy1024
2026-01-16 19:10:00 -06:00
committed by Gregory Bertilson
parent 7ede4e8b03
commit e8dcf5fad2
Notes: github-actions[bot] 2026-02-06 10:55:46 +00:00

View File

@@ -1787,7 +1787,11 @@ void HTMLMediaElement::pause_element()
});
// 4. Set the official playback position to the current playback position.
m_official_playback_position = m_current_playback_position;
// AD-HOC: If the seeking attribute is set, we don't want to overwrite the official playback position, since that
// means it is temporarily set to the seeking target position instead of the current playback position.
// See: https://github.com/whatwg/html/issues/11773 and https://github.com/whatwg/html/pull/11792
if (!seeking())
m_official_playback_position = m_current_playback_position;
}
}