mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
LibWeb: Implement the HTMLMediaElement delaying-the-load-event flag
This commit is contained in:
parent
1a67b86b76
commit
27fd31b2ad
2 changed files with 16 additions and 6 deletions
|
@ -384,7 +384,9 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
|
||||||
m_network_state = NetworkState::NoSource;
|
m_network_state = NetworkState::NoSource;
|
||||||
|
|
||||||
// FIXME: 2. Set the element's show poster flag to true.
|
// FIXME: 2. Set the element's show poster flag to true.
|
||||||
// FIXME: 3. Set the media element's delaying-the-load-event flag to true (this delays the load event).
|
|
||||||
|
// 3. Set the media element's delaying-the-load-event flag to true (this delays the load event).
|
||||||
|
m_delaying_the_load_event.emplace(document());
|
||||||
|
|
||||||
// FIXME: 4. Await a stable state, allowing the task that invoked this algorithm to continue. The synchronous section consists of all the remaining
|
// FIXME: 4. Await a stable state, allowing the task that invoked this algorithm to continue. The synchronous section consists of all the remaining
|
||||||
// steps of this algorithm until the algorithm says the synchronous section has ended. (Steps in synchronous sections are marked with ⌛.)
|
// steps of this algorithm until the algorithm says the synchronous section has ended. (Steps in synchronous sections are marked with ⌛.)
|
||||||
|
@ -407,7 +409,8 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
|
||||||
// 1. ⌛ Set the networkState to NETWORK_EMPTY.
|
// 1. ⌛ Set the networkState to NETWORK_EMPTY.
|
||||||
m_network_state = NetworkState::Empty;
|
m_network_state = NetworkState::Empty;
|
||||||
|
|
||||||
// FIXME: 2. ⌛ Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
// 2. ⌛ Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
||||||
|
m_delaying_the_load_event.clear();
|
||||||
|
|
||||||
// 3. End the synchronous section and return.
|
// 3. End the synchronous section and return.
|
||||||
return {};
|
return {};
|
||||||
|
@ -834,9 +837,6 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void()>
|
||||||
// 13. If there is no selected video track, then select a video track. This will cause a change event to be fired.
|
// 13. If there is no selected video track, then select a video track. This will cause a change event to be fired.
|
||||||
if (m_video_tracks->selected_index() == -1)
|
if (m_video_tracks->selected_index() == -1)
|
||||||
video_track->set_selected(true);
|
video_track->set_selected(true);
|
||||||
|
|
||||||
// FIXME: Once the readyState attribute reaches HAVE_CURRENT_DATA, after the loadeddata event has been fired, set the element's delaying-the-load-event
|
|
||||||
// flag to false. This stops delaying the load event.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -> Once the entire media resource has been fetched (but potentially before any of it has been decoded)
|
// -> Once the entire media resource has been fetched (but potentially before any of it has been decoded)
|
||||||
|
@ -883,7 +883,8 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::handle_media_source_failure(Span<JS:
|
||||||
// 6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
|
// 6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
|
||||||
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, TRY_OR_THROW_OOM(vm, "Media is not supported"_fly_string));
|
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, TRY_OR_THROW_OOM(vm, "Media is not supported"_fly_string));
|
||||||
|
|
||||||
// FIXME: 7. Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
// 7. Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
||||||
|
m_delaying_the_load_event.clear();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -925,6 +926,11 @@ void HTMLMediaElement::set_ready_state(ReadyState ready_state)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/media.html#loading-the-media-resource:dom-media-readystate-4
|
||||||
|
// Once the readyState attribute reaches HAVE_CURRENT_DATA, after the loadeddata event has been fired, set the
|
||||||
|
// element's delaying-the-load-event flag to false. This stops delaying the load event.
|
||||||
|
m_delaying_the_load_event.clear();
|
||||||
|
|
||||||
// If the new ready state is HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA, then the relevant steps below must then be run also.
|
// If the new ready state is HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA, then the relevant steps below must then be run also.
|
||||||
if (ready_state != ReadyState::HaveFutureData && ready_state != ReadyState::HaveEnoughData)
|
if (ready_state != ReadyState::HaveFutureData && ready_state != ReadyState::HaveEnoughData)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <AK/Variant.h>
|
#include <AK/Variant.h>
|
||||||
#include <LibJS/Heap/MarkedVector.h>
|
#include <LibJS/Heap/MarkedVector.h>
|
||||||
#include <LibJS/SafeFunction.h>
|
#include <LibJS/SafeFunction.h>
|
||||||
|
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
|
||||||
#include <LibWeb/HTML/CORSSettingAttribute.h>
|
#include <LibWeb/HTML/CORSSettingAttribute.h>
|
||||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
@ -184,6 +185,9 @@ private:
|
||||||
// https://html.spec.whatwg.org/multipage/media.html#can-autoplay-flag
|
// https://html.spec.whatwg.org/multipage/media.html#can-autoplay-flag
|
||||||
bool m_can_autoplay { true };
|
bool m_can_autoplay { true };
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/media.html#delaying-the-load-event-flag
|
||||||
|
Optional<DOM::DocumentLoadEventDelayer> m_delaying_the_load_event;
|
||||||
|
|
||||||
bool m_running_time_update_event_handler { false };
|
bool m_running_time_update_event_handler { false };
|
||||||
Optional<Time> m_last_time_update_event_time;
|
Optional<Time> m_last_time_update_event_time;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue