Changeset 154614 in webkit
- Timestamp:
- Aug 26, 2013 10:48:49 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r154612 r154614 1 2013-08-26 Gurpreet Kaur <gur.trio@gmail.com> 2 3 <https://webkit.org/b/106133> document.body.scrollTop & document.documentElement.scrollTop differ cross-browser 4 5 Reviewed by Darin Adler. 6 7 * fast/dom/Element/scrollLeft-Quirks-expected.txt: Added. 8 * fast/dom/Element/scrollLeft-Quirks.html: Added. 9 * fast/dom/Element/scrollLeft-expected.txt: Added. 10 * fast/dom/Element/scrollLeft.html: Added. 11 * fast/dom/Element/scrollTop-Quirks-expected.txt: Added. 12 * fast/dom/Element/scrollTop-Quirks.html: Added. 13 * fast/dom/Element/scrollTop-expected.txt: Added. 14 * fast/dom/Element/scrollTop.html: Added. 15 Added new tests for verifying our behavior for document.body.scrollTop/scrollLeft and 16 document.documentElement.scrollTop/scrollLeft for both Quirks as well as Standard mode. 17 18 * fast/css/zoom-body-scroll-expected.txt: 19 * fast/css/zoom-body-scroll.html: 20 * fast/events/mouse-cursor.html: 21 * http/tests/navigation/anchor-frames-expected.txt: 22 * http/tests/navigation/anchor-frames-gbk-expected.txt: 23 * http/tests/navigation/resources/frame-with-anchor-gbk.html: 24 * http/tests/navigation/resources/frame-with-anchor-same-origin.html: 25 * http/tests/navigation/resources/frame-with-anchor.html: 26 * platform/mac-wk2/tiled-drawing/resources/scroll-and-load-page.html: 27 * platform/mac-wk2/tiled-drawing/tiled-drawing-scroll-position-page-cache-restoration.html: 28 * platform/win/fast/css/zoom-body-scroll-expected.txt: 29 Rebaselining existing tests as per the new behavior. The test cases are changed to use 30 quirks mode because it uses document.body.scrollTop/scrollLeft and as per the new code 31 document.body.scrollTop/scrollLeft will return correct value if document is in quirk mode 32 Also test cases have been modified so that it tests what it used to. 33 1 34 2013-08-26 Gavin Barraclough <barraclough@apple.com> 2 35 -
trunk/LayoutTests/fast/css/zoom-body-scroll-expected.txt
r53424 r154614 10 10 scrollHeight: 1000 11 11 scrollWidth: 1000 12 scrollTop: 012 scrollTop: 100 13 13 scrollLeft: 50 14 14 -
trunk/LayoutTests/fast/css/zoom-body-scroll.html
r120683 r154614 1 <!DOCTYPE HTML>2 1 <html> 3 <body >2 <body onload="bodyScroll()"> 4 3 <div style="width: 1000px; height: 1000px; position: absolute; top: 0; left: 0;"></div> 5 4 <div style="width: 100px; height: 100px; position: absolute; top: 100px; left: 0; background: green"></div> … … 16 15 } 17 16 18 if (window.testRunner) { 19 testRunner.dumpAsText(); 20 var body = document.body; 21 log("scrollHeight: " + body.scrollHeight); 22 log("scrollWidth: " + body.scrollWidth); 17 function bodyScroll() { 18 if (window.testRunner) { 19 testRunner.dumpAsText(); 20 var body = document.body; 21 window.scrollTo(50,100); 22 log("scrollHeight: " + body.scrollHeight); 23 log("scrollWidth: " + body.scrollWidth); 23 24 24 log("\nScrolling right to 50");25 body.scrollLeft = 50;26 log("scrollLeft: " + body.scrollLeft);25 log("\nScrolling right to 50"); 26 body.scrollLeft = 50; 27 log("scrollLeft: " + body.scrollLeft); 27 28 28 log("\nZooming in");29 eventSender.zoomPageIn();30 log("scrollHeight: " + body.scrollHeight);31 log("scrollWidth: " + body.scrollWidth);32 log("scrollTop: " + body.scrollTop);33 log("scrollLeft: " + body.scrollLeft);29 log("\nZooming in"); 30 eventSender.zoomPageIn(); 31 log("scrollHeight: " + body.scrollHeight); 32 log("scrollWidth: " + body.scrollWidth); 33 log("scrollTop: " + body.scrollTop); 34 log("scrollLeft: " + body.scrollLeft); 34 35 35 log("\nScrolling down to 100");36 body.scrollTop = 100;37 log("scrollTop: " + body.scrollTop);36 log("\nScrolling down to 100"); 37 body.scrollTop = 100; 38 log("scrollTop: " + body.scrollTop); 38 39 39 log("\nZooming back out"); 40 eventSender.zoomPageOut(); 41 log("scrollTop: " + body.scrollTop); 42 log("scrollLeft: " + body.scrollLeft); 40 log("\nZooming back out"); 41 eventSender.zoomPageOut(); 42 log("scrollTop: " + body.scrollTop); 43 log("scrollLeft: " + body.scrollLeft); 44 } 43 45 } 44 46 </script> -
trunk/LayoutTests/fast/events/mouse-cursor.html
r138857 r154614 1 <!DOCTYPE html>2 1 <html> 3 2 <head> … … 10 9 <p id="description"></p> 11 10 <p><a href=https://bugs.webkit.org/show_bug.cgi?id=100550>Bug 100550</a></p> 12 <svg xmlns="http://www.w3.org/2000/svg" 11 <svg xmlns="http://www.w3.org/2000/svg" 13 12 xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0"> 14 13 <defs> … … 46 45 47 46 var testContainer = document.getElementById('test-container'); 48 47 49 48 function runTests() { 50 49 // Can't do anything useful here without eventSender … … 69 68 testContainer.style.display = 'none'; 70 69 } 71 70 72 71 finishJSTest(); 73 72 } -
trunk/LayoutTests/http/tests/navigation/anchor-frames-expected.txt
r67033 r154614 9 9 10 10 11 PASS document.body.offsetHeight > document.documentElement.clientHeight is true11 PASS document.body.offsetHeight > window.innerHeight is true 12 12 PASS document.body.scrollTop > 0 is true 13 13 PASS document.body.scrollTop + document.documentElement.clientHeight > 2000 is true -
trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk-expected.txt
r105691 r154614 9 9 10 10 11 PASS document.body.offsetHeight > document.documentElement.clientHeight is true11 PASS document.body.offsetHeight > window.innerHeight is true 12 12 PASS document.body.scrollTop > 0 is true 13 13 PASS document.body.scrollTop + document.documentElement.clientHeight > 2000 is true -
trunk/LayoutTests/http/tests/navigation/resources/frame-with-anchor-gbk.html
r105691 r154614 1 <!DOCTYPE html>2 1 <html> 3 2 <head> … … 13 12 // Make sure that the body is taller than the viewport (i.e. scrolling is 14 13 // required). 15 shouldBeTrue('document.body.offsetHeight > document.documentElement.clientHeight');14 shouldBeTrue('document.body.offsetHeight > window.innerHeight'); 16 15 17 16 // We should be scrolled at least a little bit 18 17 shouldBeTrue('document.body.scrollTop > 0'); 19 18 20 19 // And the bottom of the viewable area should be at least 2000 pixels from the top, due to the spacer element above. 21 20 shouldBeTrue('document.body.scrollTop + document.documentElement.clientHeight > 2000'); 22 21 23 finishJSTest(); 22 finishJSTest(); 24 23 }, 0); 25 24 } 26 25 27 26 var jsTestIsAsync = true; 28 </script> 27 </script> 29 28 </head> 30 29 <body onload="runTest()"> -
trunk/LayoutTests/http/tests/navigation/resources/frame-with-anchor-same-origin.html
r114406 r154614 1 <!DOCTYPE html>2 1 <html> 3 2 <head> … … 11 10 shouldBeTrue('document.body.scrollTop > 0'); 12 11 shouldBeTrue('document.body.scrollLeft == 0'); 13 finishJSTest(); 12 finishJSTest(); 14 13 }, 0); 15 14 } 16 15 var jsTestIsAsync = true; 17 </script> 16 </script> 18 17 </head> 19 18 <body> -
trunk/LayoutTests/http/tests/navigation/resources/frame-with-anchor.html
r99258 r154614 1 <!DOCTYPE html>2 1 <html> 3 2 <head> … … 12 11 // Make sure that the body is taller than the viewport (i.e. scrolling is 13 12 // required). 14 shouldBeTrue('document.body.offsetHeight > document.documentElement.clientHeight');15 13 shouldBeTrue('document.body.offsetHeight > window.innerHeight'); 14 16 15 // We should be scrolled at least a little bit 17 16 shouldBeTrue('document.body.scrollTop > 0'); 18 17 19 18 // And the bottom of the viewable area should be at least 2000 pixels from the top, due to the spacer element above. 20 19 shouldBeTrue('document.body.scrollTop + document.documentElement.clientHeight > 2000'); 21 22 finishJSTest(); 20 21 finishJSTest(); 23 22 }, 0); 24 23 } 25 24 26 25 var jsTestIsAsync = true; 27 </script> 26 </script> 28 27 </head> 29 28 <body onload="runTest()"> -
trunk/LayoutTests/platform/mac-wk2/tiled-drawing/resources/scroll-and-load-page.html
r142416 r154614 1 <!DOCTYPE html>2 1 <html> 3 2 <head> -
trunk/LayoutTests/platform/mac-wk2/tiled-drawing/tiled-drawing-scroll-position-page-cache-restoration.html
r142416 r154614 1 <!DOCTYPE html>2 1 <html> 3 2 <head> … … 11 10 12 11 window.finishedTest = function (layerTree) 13 { 12 { 14 13 document.getElementById('layers').innerText = layerTree; 15 14 testRunner.notifyDone(); -
trunk/LayoutTests/platform/win/fast/css/zoom-body-scroll-expected.txt
r149090 r154614 10 10 scrollHeight: 1000 11 11 scrollWidth: 1000 12 scrollTop: 012 scrollTop: 100 13 13 scrollLeft: 50 14 14 … … 17 17 18 18 Zooming back out 19 scrollTop: 9920 scrollLeft: 4919 scrollTop: 100 20 scrollLeft: 50 21 21 -
trunk/Source/WebCore/ChangeLog
r154613 r154614 1 2013-08-26 Gurpreet Kaur <gur.trio@gmail.com> 2 3 <https://webkit.org/b/106133> document.body.scrollTop & document.documentElement.scrollTop differ cross-browser 4 5 Reviewed by Darin Adler. 6 7 Webkit always uses document.body.scrollTop whether quirks or 8 standard mode. Similiar behaviour is for document.body.scrollLeft. 9 As per the specification webkit should return document.body.scrollTop 10 for quirks mode and document.documentElement.scrollTop for standard mode. 11 Same for document.body.scrollLeft and document.documentElement.scrollLeft. 12 13 Tests: fast/dom/Element/scrollLeft-Quirks.html 14 fast/dom/Element/scrollLeft.html 15 fast/dom/Element/scrollTop-Quirks.html 16 fast/dom/Element/scrollTop.html 17 18 * dom/Element.cpp: 19 (WebCore::Element::scrollLeft): 20 (WebCore::Element::scrollTop): 21 If the element does not have any associated CSS layout box or the element 22 is the root element and the Document is in quirks mode return zero. 23 Else If the element is the root element return the value of scrollY 24 for scrollTop and scrollX for scrollLeft. 25 * html/HTMLBodyElement.cpp: 26 (WebCore::HTMLBodyElement::scrollLeft): 27 (WebCore::HTMLBodyElement::scrollTop): 28 If the element is the HTML body element, the Document is in quirks mode, 29 return the value of scrollY for scrollTop and scrollX for scrollLeft. 30 1 31 2013-08-26 Antti Koivisto <antti@apple.com> 2 32 -
trunk/Source/WebCore/dom/Element.cpp
r154541 r154614 761 761 int Element::scrollLeft() 762 762 { 763 if (document()->documentElement() == this && document()->inQuirksMode()) 764 return 0; 765 763 766 document()->updateLayoutIgnorePendingStylesheets(); 767 if (document()->documentElement() == this) { 768 if (RenderView* renderView = document()->renderView()) { 769 if (FrameView* view = &renderView->frameView()) 770 return adjustForAbsoluteZoom(view->scrollX(), renderView); 771 } 772 } 764 773 if (RenderBox* rend = renderBox()) 765 774 return adjustForAbsoluteZoom(rend->scrollLeft(), rend); … … 769 778 int Element::scrollTop() 770 779 { 780 if (document()->documentElement() == this && document()->inQuirksMode()) 781 return 0; 782 771 783 document()->updateLayoutIgnorePendingStylesheets(); 784 if (document()->documentElement() == this) { 785 if (RenderView* renderView = document()->renderView()) { 786 if (FrameView* view = &renderView->frameView()) 787 return adjustForAbsoluteZoom(view->scrollY(), renderView); 788 } 789 } 772 790 if (RenderBox* rend = renderBox()) 773 791 return adjustForAbsoluteZoom(rend->scrollTop(), rend); -
trunk/Source/WebCore/html/HTMLBodyElement.cpp
r152889 r154614 262 262 int HTMLBodyElement::scrollLeft() 263 263 { 264 // Update the document's layout. 265 Document* document = this->document(); 264 Document* document = this->document(); 265 if (!document->inQuirksMode()) 266 return 0; 266 267 document->updateLayoutIgnorePendingStylesheets(); 267 268 FrameView* view = document->view(); … … 284 285 int HTMLBodyElement::scrollTop() 285 286 { 286 // Update the document's layout. 287 Document* document = this->document(); 287 Document* document = this->document(); 288 if (!document->inQuirksMode()) 289 return 0; 288 290 document->updateLayoutIgnorePendingStylesheets(); 289 291 FrameView* view = document->view();
Note: See TracChangeset
for help on using the changeset viewer.