Coverage Report

Created: 2026-09-26 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/HTML/CanvasGradient.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
3
 * Copyright (c) 2023, MacDue <macdue@dueutil.tech>
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include <LibGfx/PaintStyle.h>
11
#include <LibWeb/Bindings/PlatformObject.h>
12
13
namespace Web::HTML {
14
15
class CanvasGradient final : public Bindings::PlatformObject {
16
    WEB_PLATFORM_OBJECT(CanvasGradient, Bindings::PlatformObject);
17
    JS_DECLARE_ALLOCATOR(CanvasGradient);
18
19
public:
20
    static WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> create_radial(JS::Realm&, double x0, double y0, double r0, double x1, double y1, double r1);
21
    static WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> create_linear(JS::Realm&, double x0, double y0, double x1, double y1);
22
    static WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> create_conic(JS::Realm&, double start_angle, double x, double y);
23
24
    WebIDL::ExceptionOr<void> add_color_stop(double offset, StringView color);
25
26
    ~CanvasGradient();
27
28
0
    NonnullRefPtr<Gfx::PaintStyle> to_gfx_paint_style() { return m_gradient; }
29
30
private:
31
    CanvasGradient(JS::Realm&, Gfx::GradientPaintStyle& gradient);
32
33
    virtual void initialize(JS::Realm&) override;
34
35
    NonnullRefPtr<Gfx::GradientPaintStyle> m_gradient;
36
};
37
38
}