WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
88932
scrollIntoViewIfNeeded has no effect for BR element
https://bugs.webkit.org/show_bug.cgi?id=88932
Summary
scrollIntoViewIfNeeded has no effect for BR element
matthew
Reported
2012-06-12 15:35:53 PDT
Calling scrollIntoViewIfNeeded has no effect if the calling element is a BR. Here is some example code using Vala and WebKitGtk+: const string HTML = """ <HTML><BODY contenteditable="true"> Top <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <BR id='bottom_br' /> <span id='bottom_span'>Bottom</span> </BODY>"""; WebKit.WebView web_view; void on_clicked() { WebKit.DOM.Document document = web_view.get_dom_document(); // Works document.get_element_by_id("bottom_span").scroll_into_view_if_needed(false); // Doesn't work //document.get_element_by_id("bottom_br").scroll_into_view_if_needed(false); } void main(string[] args) { Gtk.init(ref args); Gtk.Window window = new Gtk.Window(); window.destroy.connect(Gtk.main_quit); window.set_default_size(300, 200); Gtk.Box box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); window.add(box); Gtk.ScrolledWindow scrolled_window = new Gtk.ScrolledWindow(null, null); box.pack_start(scrolled_window); web_view = new WebKit.WebView(); web_view.load_string(HTML, "text/html", "UTF8", ""); scrolled_window.add(web_view); Gtk.Button button = new Gtk.Button(); box.pack_start(button, false, false); button.label = "Click Me!"; button.clicked.connect(on_clicked); window.show_all(); Gtk.main(); }
Attachments
Add attachment
proposed patch, testcase, etc.
matthew
Comment 1
2012-06-12 15:46:06 PDT
It appears that this happens for any node with an empty node_value, not just BRs. For example, try removing "Bottom" from the span in the example HTML that I posted.
Martin Robinson
Comment 2
2022-01-19 09:01:01 PST
The WebKitGTK DOM bindings are long gone, but I tried this with JavaScript and small MiniBrowser window and it seems to be working properly. I think this can be closed, but feel free to reopen if this is still an issue.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug