Viewport.h 785 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/DOM/Document.h>
  8. #include <LibWeb/Layout/BlockContainer.h>
  9. namespace Web::Layout {
  10. class Viewport final : public BlockContainer {
  11. JS_CELL(Viewport, BlockContainer);
  12. public:
  13. explicit Viewport(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>);
  14. virtual ~Viewport() override;
  15. const DOM::Document& dom_node() const { return static_cast<const DOM::Document&>(*Node::dom_node()); }
  16. private:
  17. virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
  18. virtual bool is_viewport() const override { return true; }
  19. };
  20. template<>
  21. inline bool Node::fast_is<Viewport>() const { return is_viewport(); }
  22. }