/* * Copyright (c) 2018-2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #include #include namespace Web::Layout { BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullRefPtr style) : Box(document, node, move(style)) { } BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, CSS::ComputedValues computed_values) : Box(document, node, move(computed_values)) { } BlockContainer::~BlockContainer() = default; bool BlockContainer::is_scrollable() const { // FIXME: Support horizontal scroll as well (overflow-x) return computed_values().overflow_y() == CSS::Overflow::Scroll; } void BlockContainer::set_scroll_offset(Gfx::FloatPoint const& offset) { // FIXME: If there is horizontal and vertical scroll ignore only part of the new offset if (offset.y() < 0 || m_scroll_offset == offset) return; m_scroll_offset = offset; set_needs_display(); } Painting::PaintableWithLines const* BlockContainer::paint_box() const { return static_cast(Box::paint_box()); } RefPtr BlockContainer::create_paintable() const { return Painting::PaintableWithLines::create(*this); } }