blob: 4720712b5134b37f1847a54cadf4c997daca903e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <LibGfx/Matrix4x4.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Painting/Paintable.h>
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_box() const { return *m_box->paintable_box(); }
enum class StackingContextPaintPhase {
BackgroundAndBorders,
Floats,
BackgroundAndBordersForInlineLevelAndReplaced,
Foreground,
FocusAndOverlay,
};
void paint_descendants(PaintContext&, Layout::Node const&, StackingContextPaintPhase) const;
void paint(PaintContext&) const;
Optional<HitTestResult> hit_test(CSSPixelPoint, HitTestType) const;
Gfx::FloatMatrix4x4 const& transform_matrix() const { return m_transform; }
Gfx::AffineTransform affine_transform_matrix() const;
void dump(int indent = 0) const;
void sort();
private:
JS::NonnullGCPtr<Layout::Box> m_box;
Gfx::FloatMatrix4x4 m_transform;
Gfx::FloatPoint m_transform_origin;
StackingContext* const m_parent { nullptr };
Vector<StackingContext*> m_children;
void paint_internal(PaintContext&) const;
Gfx::FloatMatrix4x4 get_transformation_matrix(CSS::Transformation const& transformation) const;
Gfx::FloatMatrix4x4 combine_transformations(Vector<CSS::Transformation> const& transformations) const;
Gfx::FloatPoint transform_origin() const { return m_transform_origin; }
Gfx::FloatPoint compute_transform_origin() const;
};
}
|