ladybird/Libraries/LibWeb/Layout/RangeInputBox.cpp
Andreas Kling 7c06c3fd14 LibWeb: Make computed style data refcounted
Move ComputedProperties and CascadedProperties out of the GC. They no
longer contain strong references to GC-managed data.

Keep computed styles alive from DOM elements and animation updates with
RefPtr. Pass style into layout constructors by reference, since layout
only copies the values it needs while building nodes.

Use GC::Weak for cascade source links, so entries no longer keep the
style declaration or shadow root alive.
2026-06-06 23:29:48 +02:00

28 lines
919 B
C++

/*
* Copyright (c) 2026, Tim Ledbetter <timledbetter@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Layout/RangeInputBox.h>
namespace Web::Layout {
GC_DEFINE_ALLOCATOR(RangeInputBox);
RangeInputBox::RangeInputBox(DOM::Document& document, GC::Ptr<DOM::Element> element, CSS::ComputedProperties const& style)
: BlockContainer(document, element, style)
{
}
CSS::SizeWithAspectRatio RangeInputBox::compute_auto_content_box_size() const
{
// AD-HOC: A slider has no in-flow content to size itself from, so provide a default content-box size for when
// its `width` or `height` is `auto`.
// NB: We only support horizontal sliders, so the default size is not adjusted for the writing mode.
auto width = CSS::Length(20, CSS::LengthUnit::Ch).to_px(*this);
auto height = CSS::Length(16, CSS::LengthUnit::Px).to_px(*this);
return { width, height, {} };
}
}