diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-04-02 19:37:59 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-04-02 19:37:59 +0000 |
commit | b751be0135c1878b21c50ebb75c563bb41706d57 (patch) | |
tree | 439a9363624cdfadef45c34c779e5a5906904504 /third_party/WebKit/LayoutTests/fast/overflow/scroll-div-hide-show-expected.txt | |
parent | 5c6ba92bf30986729d95623bed28150678789fc4 (diff) | |
download | chromium_src-b751be0135c1878b21c50ebb75c563bb41706d57.zip chromium_src-b751be0135c1878b21c50ebb75c563bb41706d57.tar.gz chromium_src-b751be0135c1878b21c50ebb75c563bb41706d57.tar.bz2 |
Scroll position is lost after hide/show element
https://bugs.webkit.org/show_bug.cgi?id=72852
Source/WebCore:
Maintain the scroll position of an overflowing element in the ElementRareData when the scrollable
RenderLayer is destroyed, which can be used to restore the scroll position if the same element gets
back a RenderLayer.
WebKit behaviour will be the same as Firefox and IE. It differs from Opera as it does not reset the
scroll position when an element is moved to another location in the same document. However Opera resets
the scroll position for elements moved to another document, which matches other browsers.
Patch by Rakesh KN <rakesh.kn@motorola.com> on 2012-04-02
Reviewed by Julien Chaffraix.
Test: fast/overflow/scroll-div-hide-show.html
* dom/Element.cpp:
(WebCore::Element::removedFromDocument):
Reset the saved scroll offset if the node is moved to another location in the same document or another one.
(WebCore::Element::savedLayerScrollOffset):
(WebCore::Element::setSavedLayerScrollOffset):
* dom/Element.h:
Add helper functions to access the layer scroll offset from the element's rare data.
* dom/ElementRareData.h:
(ElementRareData):
Add the scroll offset book-keeping.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
Restore the scroll offset.
(WebCore::RenderLayer::~RenderLayer):
Store the scroll offset if document is not being destroyed.
LayoutTests:
Patch by Rakesh KN <rakesh.kn@motorola.com> on 2012-04-02
Reviewed by Julien Chaffraix.
* fast/overflow/scroll-div-hide-show-expected.txt: Added.
* fast/overflow/scroll-div-hide-show.html: Added.
git-svn-id: svn://svn.chromium.org/blink/trunk@112919 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/overflow/scroll-div-hide-show-expected.txt')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/overflow/scroll-div-hide-show-expected.txt | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/overflow/scroll-div-hide-show-expected.txt b/third_party/WebKit/LayoutTests/fast/overflow/scroll-div-hide-show-expected.txt new file mode 100644 index 0000000..9f48945 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/overflow/scroll-div-hide-show-expected.txt @@ -0,0 +1,78 @@ +Scrolled position should be restored when the div is hidden and shown again + +Div will be moved here. + +Scrolling to 0, 75 +Div's display is none now +PASS e.scrollTop is 0 +Div's display is block again +PASS e.scrollTop is 75 + +Test that after changing the scroll position to different values the scroll position is restored +Scrolling to 50, 50 +Div's display is none now +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +Div's display is block again +PASS e.scrollTop is 50 +PASS e.scrollLeft is 50 +Scrolling to 30, 10 +Div's display is none now +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +Div's display is block again +PASS e.scrollTop is 10 +PASS e.scrollLeft is 30 +Scrolling to 100, 0 +Div's display is none now +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +Div's display is block again +PASS e.scrollTop is 0 +PASS e.scrollLeft is 100 + +Testing that scroll position is restored when height and width of scrolling area is changed +Scrolling to 35, 75 +Div's display is none now +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +Div's display is block again +PASS e.scrollTop is 75 +PASS e.scrollLeft is 35 +Adding some more text to div +Scrolling to 125, 100 +Div's display is none now +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +Div's display is block again +PASS e.scrollTop is 100 +PASS e.scrollLeft is 125 + +Test that scroll position is reset when the node is moved to different location in the document +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 + +Testing that scroll position is restored for RTL texts +Scrolling to 50, 150 +Div's display is none now +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +Div's display is block again +PASS e.scrollTop is 150 +PASS e.scrollLeft is 50 + +Test iframe scrolling +Scrolling Iframe to (50, 75) +Iframe's display is none now +Iframe's display is block again +PASS frame.contentWindow.pageYOffset is 75 +PASS frame.contentWindow.pageXOffset is 50 + +Testing scroll offset getting reset when moved to other document +Scrolling div to (50, 75) +PASS e.scrollTop is 0 +PASS e.scrollLeft is 0 +PASS successfullyParsed is true + +TEST COMPLETE + |