mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-29 04:37:55 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
committed by
Andreas Kling
parent
950e819ee7
commit
93712b24bf
89
Libraries/LibWeb/HTML/TextTrackCue.cpp
Normal file
89
Libraries/LibWeb/HTML/TextTrackCue.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Math.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/TextTrackCuePrototype.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/TextTrackCue.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(TextTrackCue);
|
||||
|
||||
TextTrackCue::TextTrackCue(JS::Realm& realm, JS::GCPtr<TextTrack> track)
|
||||
: DOM::EventTarget(realm)
|
||||
, m_track(track)
|
||||
{
|
||||
}
|
||||
|
||||
TextTrackCue::~TextTrackCue() = default;
|
||||
|
||||
void TextTrackCue::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(TextTrackCue);
|
||||
}
|
||||
|
||||
void TextTrackCue::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_track);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-texttrackcue-starttime
|
||||
void TextTrackCue::set_start_time(double start_time)
|
||||
{
|
||||
// On setting, the text track cue start time must be set to the new value, interpreted in seconds;
|
||||
m_start_time = start_time;
|
||||
|
||||
// FIXME: then, if the TextTrackCue object's text track cue is in a text track's list of cues, and that text track is in a media
|
||||
// element's list of text tracks, and the media element's show poster flag is not set, then run the time marches on steps
|
||||
// for that media element.
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-texttrackcue-endtime
|
||||
WebIDL::ExceptionOr<void> TextTrackCue::set_end_time(double end_time)
|
||||
{
|
||||
// On setting, if the new value is negative Infinity or a Not-a-Number (NaN) value, then throw a TypeError exception.
|
||||
if (end_time == -AK::Infinity<double> || isnan(end_time))
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Value is negative infinity or NaN"_string };
|
||||
|
||||
// Otherwise, the text track cue end time must be set to the new value.
|
||||
m_end_time = end_time;
|
||||
|
||||
// FIXME: Then, if the TextTrackCue object's text track cue is in a text track's list of cues, and that text track is in a media
|
||||
// element's list of text tracks, and the media element's show poster flag is not set, then run the time marches on steps
|
||||
// for that media element.
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#handler-texttrackcue-onenter
|
||||
WebIDL::CallbackType* TextTrackCue::onenter()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::enter);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#handler-texttrackcue-onenter
|
||||
void TextTrackCue::set_onenter(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::enter, event_handler);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#handler-texttrackcue-onexit
|
||||
WebIDL::CallbackType* TextTrackCue::onexit()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::exit);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#handler-texttrackcue-onexit
|
||||
void TextTrackCue::set_onexit(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::exit, event_handler);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user