Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / painting / svg_mask_paintable.lucb

#==============================================================================================
#
#   svg_mask_paintable - Painting::SVGMaskPaintable: the paintable of a <mask>
#
#   DESCRIPTION:
#       Port of LibWeb/Painting/SVGMaskPaintable.cpp (lines 1-23) and SVGMaskPaintable.h:
#       creation; a mask's subtree is painted only for the elements that reference it.
#
#       Copyright (c) 2024, MacDue <macdue@dueutil.tech>
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

## Ported from Libraries/LibWeb/Painting/SVGMaskPaintable.cpp:13 Web::Painting::SVGMaskPaintable::create.
pub func paint_svg_mask_paintable_create(layout_box: LayoutSvgMaskBox*) -> PaintSvgMaskPaintable*:
    let heap = gc.cell_heap(layout_box.cell())
    let this = (PaintSvgMaskPaintable*)web_heap_allocate_cell(heap, &paint_svg_mask_paintable_class)
    gc.heap_defer_gc(heap)
    paint_svg_mask_paintable_construct(this, layout_box)
    gc.heap_undefer_gc(heap)
    return this

## Ported from Libraries/LibWeb/Painting/SVGMaskPaintable.h:21 Web::Painting::SVGMaskPaintable::forms_unconnected_subtree (override).
pub func paint_svg_mask_paintable_forms_unconnected_subtree_impl(base: PaintPaintable*) -> bool:
    _ = base
    # Masks should not be painted (i.e. reachable) unless referenced by another element.
    return true

## Ported from Libraries/LibWeb/Painting/SVGMaskPaintable.cpp:18 Web::Painting::SVGMaskPaintable::SVGMaskPaintable.
pub func paint_svg_mask_paintable_construct(this: PaintSvgMaskPaintable*, layout_box: LayoutSvgMaskBox*):
    paint_svg_graphics_paintable_construct(this.paint_svg_graphics_paintable(), layout_box.layout_svg_graphics_box())
    paint_svg_graphics_paintable_set_maskable_class(this.paint_svg_graphics_paintable(), &paint_svg_mask_paintable_svg_maskable_vtable)