mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-22 08:51:57 +00:00
Previously, calling `BlockContainer::paintable_with_lines()` would cast a `PaintableBox` to a `PaintableWithLines` without verifying that the cast was valid, which isn't the cast for `FieldsetPaintable`, for example. This method now returns null if it isn't poossible to cast to `PaintableWithLines`.
34 lines
898 B
C++
34 lines
898 B
C++
/*
|
|
* Copyright (c) 2018-2022, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Layout/BlockContainer.h>
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, GC::Ref<CSS::ComputedProperties> style)
|
|
: Box(document, node, move(style))
|
|
{
|
|
}
|
|
|
|
BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullOwnPtr<CSS::ComputedValues> computed_values)
|
|
: Box(document, node, move(computed_values))
|
|
{
|
|
}
|
|
|
|
BlockContainer::~BlockContainer() = default;
|
|
|
|
Painting::PaintableWithLines const* BlockContainer::paintable_with_lines() const
|
|
{
|
|
return as_if<Painting::PaintableWithLines>(Box::paintable_box());
|
|
}
|
|
|
|
GC::Ptr<Painting::Paintable> BlockContainer::create_paintable() const
|
|
{
|
|
return Painting::PaintableWithLines::create(*this);
|
|
}
|
|
|
|
}
|