@@ -586,26 +586,6 @@ bool Window::dispatch_event(DOM::Event& event)
586
586
return DOM::EventDispatcher::dispatch (*this , event, true );
587
587
}
588
588
589
- // https://www.w3.org/TR/cssom-view-1/#dom-window-innerwidth
590
- int Window::inner_width () const
591
- {
592
- // The innerWidth attribute must return the viewport width including the size of a rendered scroll bar (if any),
593
- // or zero if there is no viewport.
594
- if (auto const * browsing_context = associated_document ().browsing_context ())
595
- return browsing_context->viewport_rect ().width ().value ();
596
- return 0 ;
597
- }
598
-
599
- // https://www.w3.org/TR/cssom-view-1/#dom-window-innerheight
600
- int Window::inner_height () const
601
- {
602
- // The innerHeight attribute must return the viewport height including the size of a rendered scroll bar (if any),
603
- // or zero if there is no viewport.
604
- if (auto const * browsing_context = associated_document ().browsing_context ())
605
- return browsing_context->viewport_rect ().height ().value ();
606
- return 0 ;
607
- }
608
-
609
589
Page* Window::page ()
610
590
{
611
591
return associated_document ().page ();
@@ -1030,8 +1010,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
1030
1010
MUST_OR_THROW_OOM (Bindings::WindowGlobalMixin::initialize (realm, *this ));
1031
1011
1032
1012
// FIXME: These should be native accessors, not properties
1033
- define_native_accessor (realm, " innerWidth" , inner_width_getter, {}, JS::Attribute::Enumerable);
1034
- define_native_accessor (realm, " innerHeight" , inner_height_getter, {}, JS::Attribute::Enumerable);
1035
1013
define_native_accessor (realm, " devicePixelRatio" , device_pixel_ratio_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
1036
1014
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable;
1037
1015
define_native_function (realm, " setInterval" , set_interval, 1 , attr);
@@ -1335,6 +1313,26 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CSS::Screen>> Window::screen()
1335
1313
return JS::NonnullGCPtr { *m_screen };
1336
1314
}
1337
1315
1316
+ // https://w3c.github.io/csswg-drafts/cssom-view/#dom-window-innerwidth
1317
+ i32 Window::inner_width () const
1318
+ {
1319
+ // The innerWidth attribute must return the viewport width including the size of a rendered scroll bar (if any),
1320
+ // or zero if there is no viewport.
1321
+ if (auto const * browsing_context = associated_document ().browsing_context ())
1322
+ return browsing_context->viewport_rect ().width ().value ();
1323
+ return 0 ;
1324
+ }
1325
+
1326
+ // https://w3c.github.io/csswg-drafts/cssom-view/#dom-window-innerheight
1327
+ i32 Window::inner_height () const
1328
+ {
1329
+ // The innerHeight attribute must return the viewport height including the size of a rendered scroll bar (if any),
1330
+ // or zero if there is no viewport.
1331
+ if (auto const * browsing_context = associated_document ().browsing_context ())
1332
+ return browsing_context->viewport_rect ().height ().value ();
1333
+ return 0 ;
1334
+ }
1335
+
1338
1336
// https://w3c.github.io/hr-time/#dom-windoworworkerglobalscope-performance
1339
1337
WebIDL::ExceptionOr<JS::NonnullGCPtr<HighResolutionTime::Performance>> Window::performance ()
1340
1338
{
@@ -1531,18 +1529,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::location_setter)
1531
1529
return JS::js_undefined ();
1532
1530
}
1533
1531
1534
- JS_DEFINE_NATIVE_FUNCTION (Window::inner_width_getter)
1535
- {
1536
- auto * impl = TRY (impl_from (vm));
1537
- return JS::Value (impl->inner_width ());
1538
- }
1539
-
1540
- JS_DEFINE_NATIVE_FUNCTION (Window::inner_height_getter)
1541
- {
1542
- auto * impl = TRY (impl_from (vm));
1543
- return JS::Value (impl->inner_height ());
1544
- }
1545
-
1546
1532
JS_DEFINE_NATIVE_FUNCTION (Window::device_pixel_ratio_getter)
1547
1533
{
1548
1534
auto * impl = TRY (impl_from (vm));
0 commit comments