summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/VideoPaintable.h
blob: ac4e1fa09e610b25eae5fa2cb874d1116625865e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/Forward.h>
#include <LibWeb/Painting/PaintableBox.h>

namespace Web::Painting {

class VideoPaintable final : public PaintableBox {
    JS_CELL(VideoPaintable, PaintableBox);

public:
    static JS::NonnullGCPtr<VideoPaintable> create(Layout::VideoBox const&);

    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;
};

}