mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-30 08:18:49 +00:00
LibWeb: Implement TimeRanges and HTMLMediaElement.seekable()
This commit is contained in:
parent
3952ff4786
commit
aa243000f3
Notes:
github-actions[bot]
2025-02-18 17:46:30 +00:00
Author: https://github.com/Psychpsyo
Commit: aa243000f3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3563
Reviewed-by: https://github.com/ADKaster ✅
5 changed files with 103 additions and 18 deletions
|
@ -8,22 +8,39 @@
|
|||
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#time-ranges
|
||||
class TimeRanges final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(TimeRanges, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(TimeRanges);
|
||||
|
||||
public:
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-timeranges-length
|
||||
size_t length() const;
|
||||
double start(u32 index) const;
|
||||
double end(u32 index) const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-timeranges-start
|
||||
WebIDL::ExceptionOr<double> start(u32 index) const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-timeranges-end
|
||||
WebIDL::ExceptionOr<double> end(u32 index) const;
|
||||
|
||||
void add_range(double start, double end);
|
||||
bool in_range(double);
|
||||
|
||||
private:
|
||||
explicit TimeRanges(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
struct Range {
|
||||
double start;
|
||||
double end;
|
||||
};
|
||||
|
||||
Vector<Range> m_ranges;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue