-
https://webkit.org/b/106133commit-queue@webkit.org authored
<https://webkit.org/b/106133> document.body.scrollTop & document.documentElement.scrollTop differ cross-browser Patch by Gurpreet Kaur <gur.trio@gmail.com> on 2013-08-26 Reviewed by Darin Adler. Source/WebCore: Webkit always uses document.body.scrollTop whether quirks or standard mode. Similiar behaviour is for document.body.scrollLeft. As per the specification webkit should return document.body.scrollTop for quirks mode and document.documentElement.scrollTop for standard mode. Same for document.body.scrollLeft and document.documentElement.scrollLeft. Tests: fast/dom/Element/scrollLeft-Quirks.html fast/dom/Element/scrollLeft.html fast/dom/Element/scrollTop-Quirks.html fast/dom/Element/scrollTop.html * dom/Element.cpp: (WebCore::Element::scrollLeft): (WebCore::Element::scrollTop): If the element does not have any associated CSS layout box or the element is the root element and the Document is in quirks mode return zero. Else If the element is the root element return the value of scrollY for scrollTop and scrollX for scrollLeft. * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::scrollLeft): (WebCore::HTMLBodyElement::scrollTop): If the element is the HTML body element, the Document is in quirks mode, return the value of scrollY for scrollTop and scrollX for scrollLeft. LayoutTests: * fast/dom/Element/scrollLeft-Quirks-expected.txt: Added. * fast/dom/Element/scrollLeft-Quirks.html: Added. * fast/dom/Element/scrollLeft-expected.txt: Added. * fast/dom/Element/scrollLeft.html: Added. * fast/dom/Element/scrollTop-Quirks-expected.txt: Added. * fast/dom/Element/scrollTop-Quirks.html: Added. * fast/dom/Element/scrollTop-expected.txt: Added. * fast/dom/Element/scrollTop.html: Added. Added new tests for verifying our behavior for document.body.scrollTop/scrollLeft and document.documentElement.scrollTop/scrollLeft for both Quirks as well as Standard mode. * fast/css/zoom-body-scroll-expected.txt: * fast/css/zoom-body-scroll.html: * fast/events/mouse-cursor.html: * http/tests/navigation/anchor-frames-expected.txt: * http/tests/navigation/anchor-frames-gbk-expected.txt: * http/tests/navigation/resources/frame-with-anchor-gbk.html: * http/tests/navigation/resources/frame-with-anchor-same-origin.html: * http/tests/navigation/resources/frame-with-anchor.html: * platform/mac-wk2/tiled-drawing/resources/scroll-and-load-page.html: * platform/mac-wk2/tiled-drawing/tiled-drawing-scroll-position-page-cache-restoration.html: * platform/win/fast/css/zoom-body-scroll-expected.txt: Rebaselining existing tests as per the new behavior. The test cases are changed to use quirks mode because it uses document.body.scrollTop/scrollLeft and as per the new code document.body.scrollTop/scrollLeft will return correct value if document is in quirk mode Also test cases have been modified so that it tests what it used to. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1cff1882