Legacy scroll behavior on HTMLBodyElement should only apply to the first body element...
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Apr 2015 04:42:53 +0000 (04:42 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Apr 2015 04:42:53 +0000 (04:42 +0000)
commit8ce4d1c6f58b2ef60c32387e880e80c11c015be0
treea4fdf4dd1c478a2b5ad5347742e70706d0a1b948
parent1d12763a630640619f8a77f54f1005ae8fc4db8b
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
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/body-scrollHeight-basics-quirks-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollHeight-basics-quirks.html [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollLeft-basics-quirks-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollLeft-basics-quirks.html [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollTop-basics-quirks-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollTop-basics-quirks.html [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollWidth-basics-quirks-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/body-scrollWidth-basics-quirks.html [new file with mode: 0644]
LayoutTests/fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollLeft-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollLeft.html [new file with mode: 0644]
LayoutTests/fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollTop-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollTop.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLBodyElement.h