Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 74176adf63af99ed58158b3735b2c7e811149354
      
https://github.com/WebKit/WebKit/commit/74176adf63af99ed58158b3735b2c7e811149354
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-03-04 (Wed, 04 Mar 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime-expected.txt
    M Source/WebCore/html/HTMLMediaElement.cpp

  Log Message:
  -----------
  Fix currentTime getter to return defaultPlaybackStartPosition when no player 
exists
https://bugs.webkit.org/show_bug.cgi?id=309164
rdar://171722368

Reviewed by Eric Carlson and Jean-Yves Avenard.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Per spec [1], "The currentTime attribute must, on getting, return the media
element's default playback start position, unless that is zero, in which
case it must return the element's official playback position."

The setter correctly stores the value in m_defaultPlaybackStartPosition
when readyState is HAVE_NOTHING, but the getter in currentMediaTime()
had an early return for !m_player before checking
m_defaultPlaybackStartPosition, always returning 0.

Reorder the checks so m_defaultPlaybackStartPosition is consulted first,
as the spec requires [1].

[1] 
https://html.spec.whatwg.org/multipage/media.html#default-playback-start-position

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::currentMediaTime const):
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime-expected.txt:
 Progression

Canonical link: https://commits.webkit.org/308654@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to