mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +00:00
LibWeb: Stub out Window-Management proposal extensions to Screen API
As defined in https://w3c.github.io/window-management
This commit is contained in:
parent
b79815c5a5
commit
97bf9e7953
|
@ -22,7 +22,7 @@ JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
|
|||
}
|
||||
|
||||
Screen::Screen(HTML::Window& window)
|
||||
: PlatformObject(window.realm())
|
||||
: DOM::EventTarget(window.realm())
|
||||
, m_window(window)
|
||||
{
|
||||
}
|
||||
|
@ -58,4 +58,23 @@ JS::NonnullGCPtr<ScreenOrientation> Screen::orientation()
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class Screen final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(Screen, Bindings::PlatformObject);
|
||||
class Screen final : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(Screen, DOM::EventTarget);
|
||||
JS_DECLARE_ALLOCATOR(Screen);
|
||||
|
||||
public:
|
||||
|
@ -28,6 +29,11 @@ public:
|
|||
u32 pixel_depth() const { return 24; }
|
||||
JS::NonnullGCPtr<ScreenOrientation> orientation();
|
||||
|
||||
bool is_extended() const;
|
||||
|
||||
void set_onchange(JS::GCPtr<WebIDL::CallbackType> event_handler);
|
||||
JS::GCPtr<WebIDL::CallbackType> onchange();
|
||||
|
||||
private:
|
||||
explicit Screen(HTML::Window&);
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#import <CSS/ScreenOrientation.idl>
|
||||
#import <DOM/EventHandler.idl>
|
||||
#import <DOM/EventTarget.idl>
|
||||
|
||||
// https://w3c.github.io/csswg-drafts/cssom-view-1/#screen
|
||||
[Exposed=Window]
|
||||
interface Screen {
|
||||
interface Screen : EventTarget {
|
||||
readonly attribute long availWidth;
|
||||
readonly attribute long availHeight;
|
||||
readonly attribute long width;
|
||||
|
@ -12,4 +14,8 @@ interface Screen {
|
|||
|
||||
// https://w3c.github.io/screen-orientation/#extensions-to-the-screen-interface
|
||||
[SameObject] readonly attribute ScreenOrientation orientation;
|
||||
|
||||
// https://w3c.github.io/window-management/#api-extensions-to-screen
|
||||
[SecureContext] readonly attribute boolean isExtended;
|
||||
[SecureContext] attribute EventHandler onchange;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue