Legacy scroll behavior on HTMLBodyElement should only apply to the first body element of a document
https://bugs.webkit.org/show_bug.cgi?id=143651
Source/WebCore:
Reviewed by Sam Weinig.
WebKit has some very weird behaviors for the scroll methods on body. This patch
address the first bug: only the first body element should have the legacy behavior.
The relevant text in spec:
-http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
-http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
-http://dev.w3.org/csswg/cssom-view/#dom-element-scrollwidth
-http://dev.w3.org/csswg/cssom-view/#dom-element-scrollheight
Tests: fast/dom/Element/body-scrollHeight-basics-quirks.html
fast/dom/Element/body-scrollLeft-basics-quirks.html
fast/dom/Element/body-scrollTop-basics-quirks.html
fast/dom/Element/body-scrollWidth-basics-quirks.html
fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollLeft.html
fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollTop.html
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::isFirstBodyElementOfDocument):
(WebCore::HTMLBodyElement::scrollLeft):
(WebCore::HTMLBodyElement::setScrollLeft):
(WebCore::HTMLBodyElement::scrollTop):
(WebCore::HTMLBodyElement::setScrollTop):
(WebCore::HTMLBodyElement::scrollHeight):
(WebCore::HTMLBodyElement::scrollWidth):
* html/HTMLBodyElement.h:
LayoutTests:
Patch by Benjamin Poulain <benjamin@webkit.org> and Diego Perini <diego.perini@gmail.com> on 2015-04-12
Reviewed by Sam Weinig.
* fast/dom/Element/body-scrollHeight-basics-quirks-expected.txt: Added.
* fast/dom/Element/body-scrollHeight-basics-quirks.html: Added.
* fast/dom/Element/body-scrollLeft-basics-quirks-expected.txt: Added.
* fast/dom/Element/body-scrollLeft-basics-quirks.html: Added.
* fast/dom/Element/body-scrollTop-basics-quirks-expected.txt: Added.
* fast/dom/Element/body-scrollTop-basics-quirks.html: Added.
* fast/dom/Element/body-scrollWidth-basics-quirks-expected.txt: Added.
* fast/dom/Element/body-scrollWidth-basics-quirks.html: Added.
Test the various behaviors.
* fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollLeft-expected.txt: Added.
* fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollLeft.html: Added.
* fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollTop-expected.txt: Added.
* fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollTop.html: Added.
Those tests target specifically the bug.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182677
268f45cc-cd09-0410-ab3c-
d52691b4dbfc