summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/BoxModelMetrics.cpp
blob: 6b816e40f51891c41c26f730e2812b0e73ecb73f (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
37
38
39
40
41
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibWeb/Layout/BoxModelMetrics.h>

namespace Web::Layout {

PixelBox BoxModelMetrics::margin_box() const
{
    return {
        margin.top + border.top + padding.top,
        margin.right + border.right + padding.right,
        margin.bottom + border.bottom + padding.bottom,
        margin.left + border.left + padding.left,
    };
}

PixelBox BoxModelMetrics::padding_box() const
{
    return {
        padding.top,
        padding.right,
        padding.bottom,
        padding.left,
    };
}

PixelBox BoxModelMetrics::border_box() const
{
    return {
        border.top + padding.top,
        border.right + padding.right,
        border.bottom + padding.bottom,
        border.left + padding.left,
    };
}

}