StackingContext.h 886 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Vector.h>
  8. #include <LibWeb/Layout/Node.h>
  9. namespace Web::Layout {
  10. class StackingContext {
  11. public:
  12. StackingContext(Box&, StackingContext* parent);
  13. StackingContext* parent() { return m_parent; }
  14. const StackingContext* parent() const { return m_parent; }
  15. enum class StackingContextPaintPhase {
  16. BackgroundAndBorders,
  17. Floats,
  18. Foreground,
  19. FocusAndOverlay,
  20. };
  21. void paint_descendants(PaintContext&, Node&, StackingContextPaintPhase);
  22. void paint(PaintContext&);
  23. HitTestResult hit_test(const Gfx::IntPoint&, HitTestType) const;
  24. void dump(int indent = 0) const;
  25. private:
  26. Box& m_box;
  27. StackingContext* const m_parent { nullptr };
  28. Vector<StackingContext*> m_children;
  29. };
  30. }