Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / painting / box_model_metrics.lucb

#==============================================================================================
#
#   box_model_metrics - Painting::BoxModelMetrics: the margin, padding and border box offsets
#
#   DESCRIPTION:
#       Port of Libraries/LibWeb/Painting/BoxModelMetrics.cpp (lines 1-41): each box's
#       offsets from the content box, summed over the box model's layers.
#
#       Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

## Ported from Libraries/LibWeb/Painting/BoxModelMetrics.cpp:11 Web::Painting::BoxModelMetrics::margin_box.
pub func paint_box_model_metrics_margin_box(this: const PaintBoxModelMetrics*) -> PaintPixelBox:
    return PaintPixelBox(top = this.margin.top.add(this.border.top).add(this.padding.top),
                         right = this.margin.right.add(this.border.right).add(this.padding.right),
                         bottom = this.margin.bottom.add(this.border.bottom).add(this.padding.bottom),
                         left = this.margin.left.add(this.border.left).add(this.padding.left))

## Ported from Libraries/LibWeb/Painting/BoxModelMetrics.cpp:21 Web::Painting::BoxModelMetrics::padding_box.
pub func paint_box_model_metrics_padding_box(this: const PaintBoxModelMetrics*) -> PaintPixelBox:
    return PaintPixelBox(top = this.padding.top, right = this.padding.right, bottom = this.padding.bottom, left = this.padding.left)

## Ported from Libraries/LibWeb/Painting/BoxModelMetrics.cpp:31 Web::Painting::BoxModelMetrics::border_box.
pub func paint_box_model_metrics_border_box(this: const PaintBoxModelMetrics*) -> PaintPixelBox:
    return PaintPixelBox(top = this.border.top.add(this.padding.top),
                         right = this.border.right.add(this.padding.right),
                         bottom = this.border.bottom.add(this.padding.bottom),
                         left = this.border.left.add(this.padding.left))