summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Clip.h
blob: 7d4a72fd7a414e1ef0c3b865b141be228f9f0b0c (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
/*
 * Copyright (c) 2022, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/CSS/EdgeRect.h>

namespace Web::CSS {

class Clip {
public:
    enum class Type {
        Auto,
        Rect
    };

    Clip(Type type, EdgeRect edge_rect);
    Clip(EdgeRect edge_rect);

    static Clip make_auto();

    bool is_auto() const { return m_type == Type::Auto; }
    bool is_rect() const { return m_type == Type::Rect; }

    EdgeRect to_rect() const { return m_edge_rect; }

private:
    Type m_type;
    EdgeRect m_edge_rect;
};

}