mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibWeb: Extract media element timeline painting to a base class
This moves the painting of the media timeout out of VideoPaintable into a base MediaPaintable. This is to allow re-using the same timeline logic and controls for audio elements.
This commit is contained in:
parent
3a4e64bdbd
commit
ee48d7514f
8 changed files with 314 additions and 240 deletions
|
@ -8,14 +8,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibJS/SafeFunction.h>
|
||||
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
|
||||
#include <LibWeb/HTML/CORSSettingAttribute.h>
|
||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
#include <LibWeb/WebIDL/DOMException.h>
|
||||
#include <math.h>
|
||||
|
||||
|
@ -84,6 +87,16 @@ public:
|
|||
|
||||
JS::NonnullGCPtr<VideoTrackList> video_tracks() const { return *m_video_tracks; }
|
||||
|
||||
void set_layout_mouse_position(Badge<Painting::MediaPaintable>, Optional<CSSPixelPoint> mouse_position) { m_mouse_position = move(mouse_position); }
|
||||
Optional<CSSPixelPoint> const& layout_mouse_position(Badge<Painting::MediaPaintable>) const { return m_mouse_position; }
|
||||
|
||||
struct CachedLayoutBoxes {
|
||||
Optional<CSSPixelRect> control_box_rect;
|
||||
Optional<CSSPixelRect> playback_button_rect;
|
||||
Optional<CSSPixelRect> timeline_rect;
|
||||
};
|
||||
CachedLayoutBoxes& cached_layout_boxes(Badge<Painting::MediaPaintable>) const { return m_layout_boxes; }
|
||||
|
||||
protected:
|
||||
HTMLMediaElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
@ -220,6 +233,10 @@ private:
|
|||
JS::GCPtr<Fetch::Infrastructure::FetchController> m_fetch_controller;
|
||||
|
||||
bool m_seek_in_progress = false;
|
||||
|
||||
// Cached state for layout.
|
||||
Optional<CSSPixelPoint> m_mouse_position;
|
||||
mutable CachedLayoutBoxes m_layout_boxes;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue