Bug 240232 - [GTK] Add a way to set and get the scrollbar position in a WebView
Summary: [GTK] Add a way to set and get the scrollbar position in a WebView
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P3 Enhancement
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2022-05-09 06:32 PDT by Disable Graphics
Modified: 2022-05-09 10:34 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Disable Graphics 2022-05-09 06:32:56 PDT
Hobbyist developers like me don't have the time to read the JavaScriptCore API documentation and WebKitWebExtensions won't show the scrollbar position since they only execute when the page loads (Probably I'm missing something, if so, please correct me), so webkit_dom_dom_window_get_scroll_y() will always return 0 (And it's deprecated). Also, there's only one decent tutorial about WebKitWebExtensions (this one: https://blogs.igalia.com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/), and the other one is in the official WebKitGTK documentation. These two don't cover anything related to this issue.

Adding a way to get and set the scrollbar position would ease the task for many developers, hobbyist or not, as it would not require to write an extension (Requiring, in most cases, reading lots and lots of documentation, which can or cannot be understood)

The functions that I'm proposing would be:

    gdouble webkit_web_view_get_scroll_y(WebKitWebView * web_view)

    gdouble webkit_web_view_get_scroll_x(WebKitWebView * web_view)

    void webkit_web_view_set_scroll_y(WebKitWebView * web_view, gdouble y)

    void webkit_web_view_set_scroll_x(WebKitWebView * web_view, gdouble x)

The ranges would be between 0.0 and 1.0. The y's are for vertical scroll and the x's for horizontal.