ladybird/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.h
Timothy Flynn dba261f79b LibWeb: Propagate body background properties to root HTML element
The Acid1 test has a bit of an unusual background - the html and body
tags have different background colors. Our painting order of the DOM was
such that the body background was painted first, then all other elements
were painted in-phase according to Appendix E of CSS 2.1. So the html
element's background color was painted over the body background.

This removes the special handling of the body background from
InitialContainingBlockBox and now all boxes are painted in-phase. Doing
this also exposed that we weren't handling Section 2.11.2 of the spec;
when the html background is unset, the body's background should be
propagated to the html element.
2021-05-13 16:16:25 +02:00

37 lines
961 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Layout/BlockBox.h>
namespace Web::Layout {
class InitialContainingBlockBox final : public BlockBox {
public:
explicit InitialContainingBlockBox(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>);
virtual ~InitialContainingBlockBox() override;
const DOM::Document& dom_node() const { return static_cast<const DOM::Document&>(*Node::dom_node()); }
void paint_all_phases(PaintContext&);
virtual HitTestResult hit_test(const Gfx::IntPoint&, HitTestType) const override;
const LayoutRange& selection() const { return m_selection; }
void set_selection(const LayoutRange&);
void set_selection_end(const LayoutPosition&);
void build_stacking_context_tree();
void recompute_selection_states();
private:
LayoutRange m_selection;
};
}