/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::Painting { class StackingContext { public: StackingContext(Layout::Box&, StackingContext* parent); StackingContext* parent() { return m_parent; } StackingContext const* parent() const { return m_parent; } PaintableBox const& paintable() const { return *m_box.paint_box(); } enum class StackingContextPaintPhase { BackgroundAndBorders, Floats, BackgroundAndBordersForInlineLevelAndReplaced, Foreground, FocusAndOverlay, }; void paint_descendants(PaintContext&, Layout::Node&, StackingContextPaintPhase) const; void paint(PaintContext&) const; Optional hit_test(Gfx::FloatPoint const&, HitTestType) const; void dump(int indent = 0) const; void sort(); private: Layout::Box& m_box; StackingContext* const m_parent { nullptr }; Vector m_children; void paint_internal(PaintContext&) const; Gfx::FloatMatrix4x4 get_transformation_matrix(CSS::Transformation const& transformation) const; Gfx::FloatMatrix4x4 combine_transformations(Vector const& transformations) const; Gfx::AffineTransform combine_transformations_2d(Vector const& transformations) const; Gfx::FloatPoint transform_origin() const; }; }