Bug 121419

Summary: [GTK] [Stable] [Regression] document.body.scrollTop is always 0
Product: WebKit Reporter: Guillaume Desmottes <gdesmott>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: gustavo, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Guillaume Desmottes 2013-09-16 03:21:04 PDT
Original bug report: https://bugzilla.gnome.org/show_bug.cgi?id=707781

- Start an empathy chat and reduce the window size so the vertical scrollbar appears
- Move up the scrollbar so the latest lines aren't visible
- Send a message

Expected result: the window scroll down so the sent message is visible
Actual result: the window doesn't scroll down

Empathy uses a nearBottom() JS function (empathy/data/Template.html) to check if it should automatically scroll down when a new message is displayed. This function is broken because document.body.scrollTop is always 0, ignoring the actual position of the scrollbar.

This can also be easily reproduced using the WebKit inspector to check the value of scrollTop. Just use 'gsettings set org.gnome.Empathy.conversation enable-webkit-developer-tools true' and then right click in the chat window.

I can only reproduce this bug using webkit-2.2 branch. It works fine using 2.0.4 so that's probably a regression.
Comment 1 Zan Dobersek 2013-09-16 07:39:09 PDT
document.body.scrollTop and document.body.scrollLeft are returning 0 if the document is not in quirks mode after r154614.
http://trac.webkit.org/changeset/154614

The simplest way to enter the quirks mode is to remove the DOCTYPE or change it into something that would induce the quirks mode, for instance
<!DOCTYPE html PUBLIC>

Could you give that a go?
Comment 2 Guillaume Desmottes 2013-09-16 08:27:29 PDT
Indeed removing the DOCTYPE solves this problem. I guess that's not really a bug then?
Comment 3 Zan Dobersek 2013-09-16 08:38:48 PDT
No, this is an intended change in behavior.