LibWeb: Add stubs for the Screen Orientation API

As defined in: https://w3c.github.io/screen-orientation
This commit is contained in:
Shannon Booth
2024-04-02 22:44:05 +02:00
committed by Sam Atkins
parent 7fb09bf95b
commit ccebc7a905
9 changed files with 156 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/ScreenPrototype.h>
#include <LibWeb/CSS/Screen.h>
#include <LibWeb/CSS/ScreenOrientation.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Page/Page.h>
@@ -36,6 +37,7 @@ void Screen::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_window);
visitor.visit(m_orientation);
}
Gfx::IntRect Screen::screen_rect() const
@@ -49,4 +51,11 @@ Gfx::IntRect Screen::screen_rect() const
};
}
JS::NonnullGCPtr<ScreenOrientation> Screen::orientation()
{
if (!m_orientation)
m_orientation = ScreenOrientation::create(realm());
return *m_orientation;
}
}