Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / css / clip.lucb

#==============================================================================================
#
#   clip - Clip: the value of the clip property (auto or a rect)
#
#   DESCRIPTION:
#       Port of LibWeb/CSS/Clip.cpp (lines 1-28) and the inline members of Clip.h.
#
#       Copyright (c) 2022, the SerenityOS developers.
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

## Ported from Libraries/LibWeb/CSS/Clip.cpp:11 Web::CSS::Clip::Clip.
pub func css_clip_construct_css_clip_type(this: CssClip*, type_: CssClipType, edge_rect: CssEdgeRect):
    this.m_type = type_
    this.m_edge_rect = edge_rect

## Ported from Libraries/LibWeb/CSS/Clip.cpp:17 Web::CSS::Clip::Clip.
pub func css_clip_construct_css_edge_rect(this: CssClip*, edge_rect: CssEdgeRect):
    this.m_type = CssClipType.rect
    this.m_edge_rect = edge_rect

## Ported from Libraries/LibWeb/CSS/Clip.cpp:23 Web::CSS::Clip::make_auto.
pub func css_clip_make_auto() -> CssClip:
    var clip: CssClip = ---
    css_clip_construct_css_clip_type(&clip, CssClipType.auto, CssEdgeRect(top_edge = css_length_or_auto_make_auto(), right_edge = css_length_or_auto_make_auto(), bottom_edge = css_length_or_auto_make_auto(), left_edge = css_length_or_auto_make_auto()))
    return clip

## Ported from Libraries/LibWeb/CSS/Clip.h:25 Web::CSS::Clip::is_auto.
pub func css_clip_is_auto(this: const CssClip*) -> bool:
    return this.m_type == CssClipType.auto

## Ported from Libraries/LibWeb/CSS/Clip.h:26 Web::CSS::Clip::is_rect.
pub func css_clip_is_rect(this: const CssClip*) -> bool:
    return this.m_type == CssClipType.rect

## Ported from Libraries/LibWeb/CSS/Clip.h:28 Web::CSS::Clip::to_rect.
pub func css_clip_to_rect(this: const CssClip*) -> CssEdgeRect:
    return this.m_edge_rect