mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
80
Libraries/LibWeb/CSS/Screen.cpp
Normal file
80
Libraries/LibWeb/CSS/Screen.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Rect.h>
|
||||
#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>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Screen);
|
||||
|
||||
JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
|
||||
{
|
||||
return window.heap().allocate<Screen>(window.realm(), window);
|
||||
}
|
||||
|
||||
Screen::Screen(HTML::Window& window)
|
||||
: DOM::EventTarget(window.realm())
|
||||
, m_window(window)
|
||||
{
|
||||
}
|
||||
|
||||
void Screen::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(Screen);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
auto screen_rect_in_css_pixels = window().page().web_exposed_screen_area();
|
||||
return {
|
||||
screen_rect_in_css_pixels.x().to_int(),
|
||||
screen_rect_in_css_pixels.y().to_int(),
|
||||
screen_rect_in_css_pixels.width().to_int(),
|
||||
screen_rect_in_css_pixels.height().to_int()
|
||||
};
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<ScreenOrientation> Screen::orientation()
|
||||
{
|
||||
if (!m_orientation)
|
||||
m_orientation = ScreenOrientation::create(realm());
|
||||
return *m_orientation;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/window-management/#dom-screen-isextended
|
||||
bool Screen::is_extended() const
|
||||
{
|
||||
dbgln("FIXME: Unimplemented Screen::is_extended");
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/window-management/#dom-screen-onchange
|
||||
void Screen::set_onchange(JS::GCPtr<WebIDL::CallbackType> event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::change, event_handler);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/window-management/#dom-screen-onchange
|
||||
JS::GCPtr<WebIDL::CallbackType> Screen::onchange()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::change);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue