Screen.cpp 760 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGfx/Rect.h>
  7. #include <LibWeb/CSS/Screen.h>
  8. #include <LibWeb/DOM/Document.h>
  9. #include <LibWeb/Page/Page.h>
  10. namespace Web::CSS {
  11. JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
  12. {
  13. return *window.heap().allocate<Screen>(window.realm(), window);
  14. }
  15. Screen::Screen(HTML::Window& window)
  16. : PlatformObject(window.realm())
  17. , m_window(window)
  18. {
  19. set_prototype(&window.cached_web_prototype("Screen"));
  20. }
  21. void Screen::visit_edges(Cell::Visitor& visitor)
  22. {
  23. Base::visit_edges(visitor);
  24. visitor.visit(m_window.ptr());
  25. }
  26. Gfx::IntRect Screen::screen_rect() const
  27. {
  28. return window().page()->screen_rect();
  29. }
  30. }