Bug 1010538 - Part 6 - Anchor Link Scrolling Tests. r=mstange
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Fri, 10 Oct 2014 13:43:40 -0700
changeset 227596 d3d806ad2b26adc7ebe50a9040f98dad6ddb2d6c
parent 227595 1c3fcc7507fcb99399e8feced99173cfa110c186
child 227597 61ef66e30c4009921a22ea973dd2ed6e10b76a77
push id7326
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:58:42 +0000
treeherdermozilla-aurora@d3a3b2a0f2f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1010538
milestone36.0a1
Bug 1010538 - Part 6 - Anchor Link Scrolling Tests. r=mstange scroll-behavior-4.html - Anchor Link Scrolling - Navigate to Anchor, for <div> tag with no ‘scroll-behavior’ attribute. Expected to be instantaneous. - Navigate to Anchor, for <div> tag with ‘scroll-behavior: auto’. Expected to be instantaneous. - Navigate to Anchor, for <div> tag with ‘scroll-behavior: instant’. Expected to be instantaneous. - Navigate to Anchor, for <div> tag with ‘scroll-behavior: smooth’. Expected to be smooth.
layout/reftests/scrolling/reftest.list
layout/reftests/scrolling/scroll-behavior-4.html
--- a/layout/reftests/scrolling/reftest.list
+++ b/layout/reftests/scrolling/reftest.list
@@ -7,16 +7,17 @@ skip-if(B2G) random-if(gtk2Widget) fuzzy
 HTTP == fixed-text-2.html fixed-text-2.html?ref
 random-if(Android&&!browserIsRemote) skip-if(B2G&&browserIsRemote) == iframe-border-radius.html iframe-border-radius-ref.html # bug 760269
 random-if(Android) HTTP == image-1.html image-1.html?ref
 random-if(Android&&!browserIsRemote) HTTP == opacity-mixed-scrolling-1.html opacity-mixed-scrolling-1.html?ref # bug 760269
 skip-if(B2G) random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357
 skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-1.html scroll-behavior-1.html?ref # see bug 1041833
 skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-2.html scroll-behavior-2.html?ref # see bug 1041833
 skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-3.html scroll-behavior-3.html?ref # see bug 1041833
+skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-4.html scroll-behavior-4.html?ref # see bug 1041833
 skip-if(B2G&&browserIsRemote) HTTP == simple-1.html simple-1.html?ref
 skip-if(B2G) HTTP == subpixel-1.html#d subpixel-1-ref.html#d
 fuzzy-if(Android,4,120) HTTP == text-1.html text-1.html?ref
 fuzzy-if(Android,4,120) HTTP == text-2.html?up text-2.html?ref
 skip-if(B2G) fuzzy-if(Android&&AndroidVersion<15,251,722) fuzzy-if(d2d,1,4) HTTP == transformed-1.html transformed-1.html?ref
 HTTP == transformed-1.html?up transformed-1.html?ref
 fuzzy-if(Android,5,20000) == uncovering-1.html uncovering-1-ref.html
 fuzzy-if(Android,5,20000) == uncovering-2.html uncovering-2-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/scrolling/scroll-behavior-4.html
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+    <meta charset="utf-8">
+    <title>Testcase for bug 1010538 - Anchor Link Scrolling</title>
+    <style type="text/css">
+
+        html,body {
+            color: black;
+            background-color: white;
+            font-size: 16px;
+            padding: 0;
+            margin: 0;
+        }
+
+        .a_box {
+            position: relative;
+            left: 0px;
+            top: 0px;
+            width: 20px;
+            height: 20px;
+            background: blue;
+        }
+
+        .another_box {
+            position: relative;
+            left: 2000px;
+            top: 2000px;
+            width: 20px;
+            height: 20px;
+	    background: green;
+	    display: inline-block;
+        }
+
+        .scroll_box {
+            width: 50px;
+            height: 50px;
+            overflow: scroll;
+        }
+
+        #scroll_1 {
+            scroll-behavior: auto;
+        }
+
+        #scroll_1, #scroll_5, #scroll_8 {
+            scroll-behavior: instant;
+        }
+
+        #scroll_4 {
+            scroll-behavior: smooth;
+        }
+
+    </style>
+</head>
+<body>
+  <div id="scroll_1" class="scroll_box">
+    <div id="box1a" class="a_box"></div>
+    <a name="test_anchor_1" id="box1b" class="another_box"></a>
+  </div>
+  <div id="scroll_2" class="scroll_box">
+    <div id="box2a" class="a_box"></div>
+    <a name="test_anchor_2" id="box2b" class="another_box"></a>
+  </div>
+  <div id="scroll_3" class="scroll_box">
+    <div id="box3a" class="a_box"></div>
+    <a name="test_anchor_3" id="box3b" class="another_box"></a>
+  </div>
+  <div id="scroll_4" class="scroll_box">
+    <div id="box4a" class="a_box"></div>
+    <a name="test_anchor_4" id="box4b" class="another_box"></a>
+  </div>
+<script>
+  function doTest() {
+    if (document.location.search != '?ref') {
+      // Scroll_1 to Scroll_3 are expected to scroll instantly
+      window.location.hash = "test_anchor_1";
+      window.location.hash = "test_anchor_2";
+      window.location.hash = "test_anchor_3";
+
+      // Scroll_4 is expected to scroll smoothly
+      document.getElementById("box4b").scrollIntoView(false, {behavior: "smooth"});
+
+      // Interrupt any smooth scrolling
+      for (var i=1; i <= 4; i++) {
+        document.getElementById("scroll_" + i).scrollLeft
+          = document.getElementById("scroll_" + i).scrollLeft;
+        document.getElementById("scroll_" + i).scrollTop
+          = document.getElementById("scroll_" + i).scrollTop;
+      }
+    } else {
+      for (var i=1; i <= 3; i++) {
+        document.getElementById("box" + i + "b").scrollIntoView(false, {behavior: "instant"});
+      }
+    }
+    document.documentElement.removeAttribute("class");
+  }
+
+  for (var i=1; i <= 4; i++) {
+    document.getElementById("box" + i + "a")
+      .scrollIntoView(true, {behavior: "instant"});
+  }
+
+  window.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</body>
+</html>