Add WK1 versions of tests from Bugs 145637 and 145642
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jun 2015 16:19:26 +0000 (16:19 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jun 2015 16:19:26 +0000 (16:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145649

Reviewed by Zalan Bujtas.

* platform/mac/fast/scrolling/iframe_in_iframe-expected.txt: Added.
* platform/mac/fast/scrolling/iframe_in_iframe.html: Added.
* platform/mac/fast/scrolling/resources/inner_content.html: Added.
* platform/mac/fast/scrolling/resources/testContent.html: Added.
* platform/mac/fast/scrolling/resources/testImage.png: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/scrolling/iframe_in_iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/scrolling/iframe_in_iframe.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/scrolling/resources/inner_content.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/scrolling/resources/testContent.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/scrolling/resources/testImage.png [new file with mode: 0644]

index 15419e4..a154d82 100644 (file)
@@ -1,3 +1,16 @@
+2015-06-05  Brent Fulgham  <bfulgham@apple.com>
+
+        Add WK1 versions of tests from Bugs 145637 and 145642
+        https://bugs.webkit.org/show_bug.cgi?id=145649
+
+        Reviewed by Zalan Bujtas.
+
+        * platform/mac/fast/scrolling/iframe_in_iframe-expected.txt: Added.
+        * platform/mac/fast/scrolling/iframe_in_iframe.html: Added.
+        * platform/mac/fast/scrolling/resources/inner_content.html: Added.
+        * platform/mac/fast/scrolling/resources/testContent.html: Added.
+        * platform/mac/fast/scrolling/resources/testImage.png: Added.
+
 2015-06-05  Manuel Rego Casasnovas  <rego@igalia.com>
 
         [CSS Grid Layout] Support dots sequences in grid-template-areas
diff --git a/LayoutTests/platform/mac/fast/scrolling/iframe_in_iframe-expected.txt b/LayoutTests/platform/mac/fast/scrolling/iframe_in_iframe-expected.txt
new file mode 100644 (file)
index 0000000..a3dae06
--- /dev/null
@@ -0,0 +1,17 @@
+Inner Frame:
+
+Tests that iframe doesn't pass wheel events to main frame when scrolling inside iframe
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS Page did not receive wheel events.
+PASS iframe did not receive wheel events.
+PASS iframe received wheel events.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/fast/scrolling/iframe_in_iframe.html b/LayoutTests/platform/mac/fast/scrolling/iframe_in_iframe.html
new file mode 100644 (file)
index 0000000..6de4e14
--- /dev/null
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>iFrame in iFrame Test</title>
+        <style>
+        * {
+            box-sizing: border-box;
+        }
+
+        .container {
+            width:100%;
+            overflow:auto;
+            height:auto;
+        }
+
+        .innercontainer {
+            height:100%;
+            width:50%;
+        }
+        </style>
+        <script src="../../../../resources/js-test-pre.js"></script>
+    </head>
+    <body>
+<script>
+
+var iframeTarget;
+var innerIFrameTarget;
+var pageScrollPositionBefore;
+var iFrameScrollPositionBefore;
+var continueCount = 5;
+
+function checkForScroll()
+{
+    // The IFrame should not have scrolled at all.
+    var pageScrollPositionAfter = document.body.scrollTop;
+    var iFrameScrollPositionAfter = window.frames['target'].document.body.scrollTop;
+    var innerIFrameScrollPositionAfter = iframeTarget.contentWindow.frames['target'].document.body.scrollTop;
+
+    if (pageScrollPositionBefore != pageScrollPositionAfter)
+        testFailed("Page received wheel events.");
+    else
+        testPassed("Page did not receive wheel events.");
+
+    if (iFrameScrollPositionBefore != iFrameScrollPositionAfter)
+        testFailed("iframe received wheel events.");
+    else
+        testPassed("iframe did not receive wheel events.");
+
+    if (innerIFrameScrollPositionBefore != innerIFrameScrollPositionAfter)
+        testPassed("iframe received wheel events.");
+    else
+        testFailed("iframe did not receive wheel events.");
+
+    finishJSTest();
+    testRunner.notifyDone();
+}
+
+function scrollTest()
+{
+    pageScrollPositionBefore = document.body.scrollTop;
+
+    iframeTarget = document.getElementById('target');
+
+    var iFrameBody = window.frames['target'].document.body;
+    iFrameScrollPositionBefore = iFrameBody.scrollTop;
+
+    innerIFrameTarget = iframeTarget.contentWindow.frames['target'].document.body;
+    innerIFrameScrollPositionBefore = innerIFrameTarget.scrollTop;
+
+    // Scroll the #source until we reach the #target.
+    var startPosX = Math.round(iframeTarget.offsetLeft) + 20;
+    var startPosY = Math.round(iframeTarget.offsetTop) + 80;
+    eventSender.mouseMoveTo(startPosX, startPosY);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue');
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+    eventSender.callAfterScrollingCompletes(checkForScroll);
+}
+
+function setupTopLevel()
+{
+    if (window.eventSender) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+
+        eventSender.monitorWheelEvents();
+        setTimeout(scrollTest, 0);
+    }
+}
+</script>
+        <div class="container">
+            <div class="innercontainer">
+                <div style="width:100%;">
+                    <div>Inner Frame:</div>
+                    <div style="height:92%;">
+                        <iframe id="target" name="target" src="resources/testContent.html" onload="setupTopLevel();"></iframe>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div id="console"></div>
+        <script>
+        description("Tests that iframe doesn't pass wheel events to main frame when scrolling inside iframe");
+        </script>
+        <script src="../../../../resources/js-test-post.js"></script>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/scrolling/resources/inner_content.html b/LayoutTests/platform/mac/fast/scrolling/resources/inner_content.html
new file mode 100644 (file)
index 0000000..540dd01
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en-US">
+    <head>
+        <title>Inner iFrame Example</title>
+        <meta charset="utf-8">
+    </head>
+    <body style="position: relative; min-height: 100%; top: 0px;">
+        <div style="overflow:auto;">
+            <img src="testImage.png">
+            <div>TEST CASE TEST CASE TEST CASE TEST CASE</div>
+        </div>
+        <div style="overflow:auto;">
+            <h1>TEST HEADING</h1>
+            <p>Test paragraph.</p>
+            <div>TEST BUTTON 1</div>
+            <div>TEST BUTTON 2</div>      
+        </div>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/scrolling/resources/testContent.html b/LayoutTests/platform/mac/fast/scrolling/resources/testContent.html
new file mode 100644 (file)
index 0000000..abc0f11
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<p>An iframe where scrollbars are always shown:</p>
+<iframe id="target" name="target" src="./inner_content.html" width="200" height="200" scrolling="yes">
+  <p>Your browser does not support iframes.</p>
+</iframe>
+
+<p>An iframe where scrollbars are never shown:</p>
+<iframe src="./inner_content.html" width="200" height="200" scrolling="no">
+  <p>Your browser does not support iframes.</p>
+</iframe>
+
+<p>The scrolling attribute is not supported in HTML5. Use CSS instead.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/scrolling/resources/testImage.png b/LayoutTests/platform/mac/fast/scrolling/resources/testImage.png
new file mode 100644 (file)
index 0000000..8c79978
Binary files /dev/null and b/LayoutTests/platform/mac/fast/scrolling/resources/testImage.png differ