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.
29 lines
784 B
C++
29 lines
784 B
C++
/*
|
|
* Copyright (c) 2025-2026, Jonathan Gamble <gamblej@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Layout/TextAreaBox.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
GC_DEFINE_ALLOCATOR(TextAreaBox);
|
|
|
|
TextAreaBox::TextAreaBox(DOM::Document& document, GC::Ptr<DOM::Element> element, CSS::ComputedProperties const& style)
|
|
: BlockContainer(document, element, style)
|
|
{
|
|
}
|
|
|
|
CSS::SizeWithAspectRatio TextAreaBox::compute_auto_content_box_size() const
|
|
{
|
|
auto width = CSS::Length(dom_node().cols(), CSS::LengthUnit::Ch).to_px(*this);
|
|
auto height = CSS::Length(dom_node().rows(), CSS::LengthUnit::Lh).to_px(*this);
|
|
|
|
if (this->computed_values().writing_mode() != CSS::WritingMode::HorizontalTb)
|
|
swap(width, height);
|
|
|
|
return { width, height, {} };
|
|
}
|
|
|
|
}
|