mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Implement HTMLVideoElement's video{Width,Height} attributes
This commit is contained in:
parent
becd70eccb
commit
725d7c3699
Notes:
sideshowbarker
2024-07-17 01:04:03 +09:00
Author: https://github.com/trflynn89
Commit: 725d7c3699
Pull-request: https://github.com/SerenityOS/serenity/pull/18183
Reviewed-by: https://github.com/Lubrsi
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/skyrising
4 changed files with 37 additions and 1 deletions
|
@ -24,4 +24,26 @@ JS::ThrowCompletionOr<void> HTMLVideoElement::initialize(JS::Realm& realm)
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-video-videowidth
|
||||
u32 HTMLVideoElement::video_width() const
|
||||
{
|
||||
// The videoWidth IDL attribute must return the intrinsic width of the video in CSS pixels. The videoHeight IDL
|
||||
// attribute must return the intrinsic height of the video in CSS pixels. If the element's readyState attribute
|
||||
// is HAVE_NOTHING, then the attributes must return 0.
|
||||
if (ready_state() == ReadyState::HaveNothing)
|
||||
return 0;
|
||||
return m_video_width;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-video-videoheight
|
||||
u32 HTMLVideoElement::video_height() const
|
||||
{
|
||||
// The videoWidth IDL attribute must return the intrinsic width of the video in CSS pixels. The videoHeight IDL
|
||||
// attribute must return the intrinsic height of the video in CSS pixels. If the element's readyState attribute
|
||||
// is HAVE_NOTHING, then the attributes must return 0.
|
||||
if (ready_state() == ReadyState::HaveNothing)
|
||||
return 0;
|
||||
return m_video_height;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue