mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:17:36 +00:00
LibWeb: Begin painting video controls on HTMLVideoElement layout nodes
If the video element has a 'controls' attribute, we now paint some basic video controls over the video element. If no frame has been decoded yet, we paint a play button on the center of the element. If a frame has been decoded, we paint that frame and paint a control bar on the bottom of the frame. This control bar currently only contains a play/pause button, depending on the video's playback state. We will only paint the control bar if the video is paused or hovered.
This commit is contained in:
parent
4f29cac715
commit
4555e3b8d2
2 changed files with 176 additions and 3 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
|
||||
|
@ -19,10 +20,20 @@ public:
|
|||
|
||||
virtual void paint(PaintContext&, PaintPhase) const override;
|
||||
|
||||
Layout::VideoBox& layout_box();
|
||||
Layout::VideoBox const& layout_box() const;
|
||||
|
||||
private:
|
||||
VideoPaintable(Layout::VideoBox const&);
|
||||
|
||||
virtual bool wants_mouse_events() const override { return true; }
|
||||
virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
|
||||
virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, CSSPixelPoint, unsigned buttons, unsigned modifiers) override;
|
||||
|
||||
void paint_loaded_video_controls(PaintContext&, HTML::HTMLVideoElement const&, DevicePixelRect video_rect, Optional<DevicePixelPoint> const& mouse_position) const;
|
||||
void paint_placeholder_video_controls(PaintContext&, DevicePixelRect video_rect, Optional<DevicePixelPoint> const& mouse_position) const;
|
||||
|
||||
Optional<CSSPixelPoint> m_mouse_position;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue