1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 04:17:34 +00:00

LibWeb: Restrict toggling video playback to certain areas in a video

When the control bar is shown, do not toggle playback when clicking on
the control bar, unless the click target is the playback button. This
will let us implement clicking on the timeline to seek.

Note that this requires caching some layout rects on the video element.
We need to remember where the corresponding layout boxes are, and we
can't cache them on the layout box, as that may be destroyed any time.
This commit is contained in:
Timothy Flynn 2023-04-11 19:02:45 -04:00 committed by Linus Groh
parent c4e3ba2dfb
commit ad3c63684c
2 changed files with 30 additions and 6 deletions

View file

@ -36,6 +36,12 @@ public:
void set_layout_mouse_position(Badge<Painting::VideoPaintable>, Optional<CSSPixelPoint> mouse_position) { m_mouse_position = move(mouse_position); }
Optional<CSSPixelPoint> const& layout_mouse_position(Badge<Painting::VideoPaintable>) const { return m_mouse_position; }
struct CachedLayoutBoxes {
Optional<CSSPixelRect> control_box_rect;
Optional<CSSPixelRect> playback_button_rect;
};
CachedLayoutBoxes& cached_layout_boxes(Badge<Painting::VideoPaintable>) const { return m_layout_boxes; }
private:
HTMLVideoElement(DOM::Document&, DOM::QualifiedName);
@ -56,6 +62,7 @@ private:
// Cached state for layout
Optional<CSSPixelPoint> m_mouse_position;
mutable CachedLayoutBoxes m_layout_boxes;
};
}