Bug 88932
Summary: | scrollIntoViewIfNeeded has no effect for BR element | ||
---|---|---|---|
Product: | WebKit | Reporter: | matthew |
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WORKSFORME | ||
Severity: | Normal | CC: | matthew, mrobinson |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | Linux |
matthew
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
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
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.