1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Move window.scroll{X,Y} from wrapper into DOM::Window

The less we do in WindowObject, the easier it will be to eventually
auto-generate the entire thing.
This commit is contained in:
Andreas Kling 2021-09-24 21:49:31 +02:00
parent 38157a6093
commit 2c0987c93b
3 changed files with 21 additions and 6 deletions

View file

@ -510,9 +510,7 @@ JS_DEFINE_NATIVE_GETTER(WindowObject::scroll_x_getter)
auto* impl = impl_from(vm, global_object);
if (!impl)
return {};
if (!impl->page())
return JS::Value(0);
return JS::Value(impl->page()->top_level_browsing_context().viewport_scroll_offset().x());
return JS::Value(impl->scroll_x());
}
// https://www.w3.org/TR/cssom-view/#dom-window-scrolly
@ -521,9 +519,7 @@ JS_DEFINE_NATIVE_GETTER(WindowObject::scroll_y_getter)
auto* impl = impl_from(vm, global_object);
if (!impl)
return {};
if (!impl->page())
return JS::Value(0);
return JS::Value(impl->page()->top_level_browsing_context().viewport_scroll_offset().y());
return JS::Value(impl->scroll_y());
}
enum class ScrollBehavior {