Bug 1045754 - Part 2 - Tests. r=bz
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Thu, 02 Oct 2014 17:29:22 -0700
changeset 227600 5eeef6a33a628e12ac0cd56eb969c22369efeda6
parent 227599 8247fd8795427cf500a1c96ac7b6203f604ed0d3
child 227601 bb856489ba05d4956adb13cf87b19c66217b4d97
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)
reviewersbz
bugs1045754
milestone36.0a1
Bug 1045754 - Part 2 - Tests. r=bz - Updated smooth scroll behavior mochitest and reftests to match new CSSOM-View DOM scrolling method parameters. - Added tests for Element.ScrollBy and Element.ScrollTo.
layout/generic/test/test_scroll_behavior.html
layout/reftests/scrolling/reftest.list
layout/reftests/scrolling/scroll-behavior-1.html
layout/reftests/scrolling/scroll-behavior-2.html
layout/reftests/scrolling/scroll-behavior-3.html
layout/reftests/scrolling/scroll-behavior-4.html
layout/reftests/scrolling/scroll-behavior-5.html
layout/reftests/scrolling/scroll-behavior-6.html
layout/reftests/scrolling/scroll-behavior-7.html
--- a/layout/generic/test/test_scroll_behavior.html
+++ b/layout/generic/test/test_scroll_behavior.html
@@ -53,17 +53,17 @@
       window.scrollTo(10, 9);
       ok(window.scrollX == 10 && window.scrollY == 9,
         "instant scroll-behavior must be synchronous when setting initial position");
 
       window.scrollTo(15, 16);
       ok(window.scrollX == 15 && window.scrollY == 16,
         "instant scroll-behavior must be synchronous when setting new position");
 
-      window.scrollTo(100, 200, {behavior: 'smooth'});
+      window.scrollTo({left: 100, top: 200, behavior: 'smooth'});
       ok(window.scrollX == 15 && window.scrollY == 16,
         "smooth scroll-behavior must be asynchronous");
 
       SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(100);
       waitForAllPaintsFlushed(function() {
         ok(window.scrollX != 15 && window.scrollY != 16
            && window.scrollX != 100 && window.scrollY != 200,
           "smooth scroll-behavior must be triggered by window.scrollTo");
@@ -233,17 +233,17 @@
     var frameCountAtDestination = 0;
 
     // Take control of refresh driver so we can synthesize
     // various frame rates
     SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(0);
     waitForAllPaintsFlushed(function() {
 
       window.scrollTo(startX, startY);
-      window.scrollTo(endX, endY, {behavior: 'smooth'});
+      window.scrollTo({left: endX, top: endY, behavior: 'smooth'});
 
       var currentTime = 0; // ms
 
       function advanceTime() {
         if(currentTime < maxTime && frameCountAtDestination < 15) {
 
           positionSamples.push([window.scrollX, window.scrollY]);
 
--- a/layout/reftests/scrolling/reftest.list
+++ b/layout/reftests/scrolling/reftest.list
@@ -9,16 +9,18 @@ random-if(Android&&!browserIsRemote) ski
 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(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-5.html scroll-behavior-5.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-6.html scroll-behavior-6.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-7.html scroll-behavior-7.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
--- a/layout/reftests/scrolling/scroll-behavior-1.html
+++ b/layout/reftests/scrolling/scroll-behavior-1.html
@@ -38,18 +38,18 @@
     </style>
 </head>
 <body>
   <div id="a_box"></div>
   <div id="another_box"></div>
 <script>
   function doTest() {
     if (document.location.search != '?ref') {
-      window.scrollTo(500, 500);
-      window.scrollTo(window.scrollX, window.scrollY);
+      window.scrollTo({left: 500, top: 500});
+      window.scrollTo({left: window.scrollX, top: window.scrollY});
     }
     document.documentElement.removeAttribute("class");
   }
-  window.scrollTo(0,0, {behavior: "instant"});
+  window.scrollTo({left: 0, top: 0, behavior: "instant"});
   window.addEventListener("MozReftestInvalidate", doTest, false);
 </script>
 </body>
 </html>
--- a/layout/reftests/scrolling/scroll-behavior-2.html
+++ b/layout/reftests/scrolling/scroll-behavior-2.html
@@ -32,17 +32,17 @@
         }
 
         .scroll_box {
             width: 50px;
             height: 50px;
             overflow: scroll;
         }
 
-        #scroll_1, #scroll_2, #scroll_3 {
+        #scroll_1, #scroll_2, #scroll_3, #scroll_7 {
             scroll-behavior: smooth;
         }
 
         #scroll_4 {
             scroll-behavior: instant;
         }
 
         #scroll_5 {
@@ -71,36 +71,41 @@
   <div id="scroll_5" class="scroll_box">
     <div id="box5a" class="a_box"></div>
     <div id="box5b" class="another_box"></div>
   </div>
   <div id="scroll_6" class="scroll_box">
     <div id="box6a" class="a_box"></div>
     <div id="box6b" class="another_box"></div>
   </div>
+  <div id="scroll_7" class="scroll_box">
+    <div id="box7a" class="a_box"></div>
+    <div id="box7b" class="another_box"></div>
+  </div>
 <script>
   function doTest() {
     if (document.location.search != '?ref') {
-      document.getElementById("box1b").scrollIntoView(false);
-      document.getElementById("box2b").scrollIntoView(false, {behavior: "auto"});
-      document.getElementById("box3b").scrollIntoView(false, {behavior: "smooth"});
-      document.getElementById("box4b").scrollIntoView(false, {behavior: "smooth"});
-      document.getElementById("box5b").scrollIntoView(false, {behavior: "smooth"});
-      document.getElementById("box6b").scrollIntoView(false, {behavior: "smooth"});
+      document.getElementById("box1b").scrollIntoView({block: "end"});
+      document.getElementById("box2b").scrollIntoView({block: "end", behavior: "auto"});
+      document.getElementById("box3b").scrollIntoView({block: "end", behavior: "smooth"});
+      document.getElementById("box4b").scrollIntoView({block: "end", behavior: "smooth"});
+      document.getElementById("box5b").scrollIntoView({block: "end", behavior: "smooth"});
+      document.getElementById("box6b").scrollIntoView({block: "end", behavior: "smooth"});
+      document.getElementById("box7b").scrollIntoView(false);
 
       // Interrupt any smooth scrolling
-      for (var i=1; i <= 6; i++) {
+      for (var i=1; i <= 7; i++) {
         document.getElementById("scroll_" + i).scrollLeft
           = document.getElementById("scroll_" + i).scrollLeft;
         document.getElementById("scroll_" + i).scrollTop
           = document.getElementById("scroll_" + i).scrollTop;
       }
     }
     document.documentElement.removeAttribute("class");
   }
-  for (var i=1; i <= 6; i++) {
+  for (var i=1; i <= 7; i++) {
     document.getElementById("box" + i + "a")
-      .scrollIntoView(true, {behavior: "instant"});
+      .scrollIntoView({block: "start", behavior: "instant"});
   }
   window.addEventListener("MozReftestInvalidate", doTest, false);
 </script>
 </body>
 </html>
--- a/layout/reftests/scrolling/scroll-behavior-3.html
+++ b/layout/reftests/scrolling/scroll-behavior-3.html
@@ -32,21 +32,21 @@
         }
 
         .scroll_box {
             width: 50px;
             height: 50px;
             overflow: scroll;
         }
 
-        #scroll_2, #scroll_6, #scroll_9 {
+        #scroll_2, #scroll_6, #scroll_9, #scroll_12 {
             scroll-behavior: auto;
         }
 
-        #scroll_1, #scroll_5, #scroll_8 {
+        #scroll_1, #scroll_5, #scroll_8, #scroll_11 {
             scroll-behavior: instant;
         }
 
         #scroll_4 {
             scroll-behavior: smooth;
         }
 
     </style>
@@ -91,50 +91,65 @@
   <div id="scroll_10" class="scroll_box">
     <div id="box10a" class="a_box"></div>
     <div id="box10b" class="another_box"></div>
   </div>
   <div id="scroll_11" class="scroll_box">
     <div id="box11a" class="a_box"></div>
     <div id="box11b" class="another_box"></div>
   </div>
+  <div id="scroll_12" class="scroll_box">
+    <div id="box12a" class="a_box"></div>
+    <div id="box12b" class="another_box"></div>
+  </div>
+  <div id="scroll_13" class="scroll_box">
+    <div id="box13a" class="a_box"></div>
+    <div id="box13b" class="another_box"></div>
+  </div>
+  <div id="scroll_14" class="scroll_box">
+    <div id="box14a" class="a_box"></div>
+    <div id="box14b" class="another_box"></div>
+  </div>
 <script>
   function doTest() {
     if (document.location.search != '?ref') {
-      document.getElementById("box1b").scrollIntoView(false);
-      document.getElementById("box2b").scrollIntoView(false);
-      document.getElementById("box3b").scrollIntoView(false);
-      document.getElementById("box4b").scrollIntoView(false, {behavior: "instant"});
-      document.getElementById("box5b").scrollIntoView(false, {behavior: "instant"});
-      document.getElementById("box6b").scrollIntoView(false, {behavior: "instant"});
-      document.getElementById("box7b").scrollIntoView(false, {behavior: "instant"});
-      document.getElementById("box8b").scrollIntoView(false, {behavior: "auto"});
-      document.getElementById("box9b").scrollIntoView(false, {behavior: "auto"});
-      document.getElementById("box10b").scrollIntoView(false, {behavior: "auto"});
+      document.getElementById("box1b").scrollIntoView({block: "end"});
+      document.getElementById("box2b").scrollIntoView({block: "end"});
+      document.getElementById("box3b").scrollIntoView({block: "end"});
+      document.getElementById("box4b").scrollIntoView({block: "end", behavior: "instant"});
+      document.getElementById("box5b").scrollIntoView({block: "end", behavior: "instant"});
+      document.getElementById("box6b").scrollIntoView({block: "end", behavior: "instant"});
+      document.getElementById("box7b").scrollIntoView({block: "end", behavior: "instant"});
+      document.getElementById("box8b").scrollIntoView({block: "end", behavior: "auto"});
+      document.getElementById("box9b").scrollIntoView({block: "end", behavior: "auto"});
+      document.getElementById("box10b").scrollIntoView({block: "end", behavior: "auto"});
+      document.getElementById("box11b").scrollIntoView(false);
+      document.getElementById("box12b").scrollIntoView(false);
+      document.getElementById("box13b").scrollIntoView(false);
 
-      // Scroll_11 is a control, expected to scroll smoothly
-      document.getElementById("box11b").scrollIntoView(false, {behavior: "smooth"});
+      // Scroll_14 is a control, expected to scroll smoothly
+      document.getElementById("box14b").scrollIntoView({block: "end", behavior: "smooth"});
 
       // Interrupt any smooth scrolling
-      for (var i=1; i <= 11; i++) {
+      for (var i=1; i <= 14; i++) {
         document.getElementById("scroll_" + i).scrollLeft
           = document.getElementById("scroll_" + i).scrollLeft;
         document.getElementById("scroll_" + i).scrollTop
           = document.getElementById("scroll_" + i).scrollTop;
       }
     } else {
-      // Scroll all boxes except box 11
-      for (var i=1; i <= 10; i++) {
-        document.getElementById("box" + i + "b").scrollIntoView(false, {behavior: "instant"});
+      // Scroll all boxes except box 14
+      for (var i=1; i <= 13; i++) {
+        document.getElementById("box" + i + "b").scrollIntoView({block: "end", behavior: "instant"});
       }
     }
     document.documentElement.removeAttribute("class");
   }
 
-  for (var i=1; i <= 11; i++) {
+  for (var i=1; i <= 14; i++) {
     document.getElementById("box" + i + "a")
-      .scrollIntoView(true, {behavior: "instant"});
+      .scrollIntoView({block: "start", behavior: "instant"});
   }
 
   window.addEventListener("MozReftestInvalidate", doTest, false);
 </script>
 </body>
 </html>
--- a/layout/reftests/scrolling/scroll-behavior-4.html
+++ b/layout/reftests/scrolling/scroll-behavior-4.html
@@ -73,34 +73,34 @@
   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"});
+      document.getElementById("box4b").scrollIntoView({block: "end", 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.getElementById("box" + i + "b").scrollIntoView({block: "end", behavior: "instant"});
       }
     }
     document.documentElement.removeAttribute("class");
   }
 
   for (var i=1; i <= 4; i++) {
     document.getElementById("box" + i + "a")
-      .scrollIntoView(true, {behavior: "instant"});
+      .scrollIntoView({block: "start", behavior: "instant"});
   }
 
   window.addEventListener("MozReftestInvalidate", doTest, false);
 </script>
 </body>
 </html>
--- a/layout/reftests/scrolling/scroll-behavior-5.html
+++ b/layout/reftests/scrolling/scroll-behavior-5.html
@@ -32,25 +32,25 @@
         }
 
         .scroll_box {
             width: 50px;
             height: 50px;
             overflow: scroll;
         }
 
-        #scroll_2 {
+        #scroll_2, #scroll_5 {
             scroll-behavior: auto;
         }
 
-        #scroll_3 {
+        #scroll_3, #scroll_6 {
             scroll-behavior: instant;
         }
 
-        #scroll_4 {
+        #scroll_7, #scroll_8 {
             scroll-behavior: smooth;
         }
 
     </style>
 </head>
 <body>
   <div id="scroll_1" class="scroll_box">
     <div id="box1a" class="a_box"></div>
@@ -63,48 +63,61 @@
   <div id="scroll_3" class="scroll_box">
     <div id="box3a" class="a_box"></div>
     <div id="box3b" class="another_box"></div>
   </div>
   <div id="scroll_4" class="scroll_box">
     <div id="box4a" class="a_box"></div>
     <div id="box4b" class="another_box"></div>
   </div>
+  <div id="scroll_5" class="scroll_box">
+    <div id="box5a" class="a_box"></div>
+    <div id="box5b" class="another_box"></div>
+  </div>
+  <div id="scroll_6" class="scroll_box">
+    <div id="box6a" class="a_box"></div>
+    <div id="box6b" class="another_box"></div>
+  </div>
+  <div id="scroll_7" class="scroll_box">
+    <div id="box7a" class="a_box"></div>
+    <div id="box7b" class="another_box"></div>
+  </div>
+  <div id="scroll_8" class="scroll_box">
+    <div id="box8a" class="a_box"></div>
+   <div id="box8b" class="another_box"></div>
+  </div>
 <script>
   function doTest() {
     if (document.location.search != '?ref') {
       // Expect instantaneous scroll:
-      document.getElementById("scroll_1").scrollLeft = 0;
-      document.getElementById("scroll_1").scrollTop = 0;
-      document.getElementById("scroll_2").scrollLeft = 0;
-      document.getElementById("scroll_2").scrollTop = 0;
-      document.getElementById("scroll_3").scrollLeft = 0;
-      document.getElementById("scroll_3").scrollTop = 0;
+      document.getElementById("scroll_1").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_2").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_3").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_4").scrollTo(0, 0);
+      document.getElementById("scroll_5").scrollTo(0, 0);
+      document.getElementById("scroll_6").scrollTo(0, 0);
 
       // Expect smooth scroll:
-      document.getElementById("scroll_4").scrollLeft = 0;
-      document.getElementById("scroll_4").scrollTop = 0;
+      document.getElementById("scroll_7").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_8").scrollTo(0, 0);
 
       // 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;
+      for (var i=1; i <= 8; i++) {
+        document.getElementById("scroll_" + i).scrollTo();
       }
     } else {
-      // Scroll all boxes except for box4a
-      for (var i=1; i <= 3; i++) {
-        document.getElementById("box" + i + "a").scrollIntoView(false, {behavior: "instant"});
+      // Scroll all boxes except for box7a and box8a
+      for (var i=1; i <= 6; i++) {
+        document.getElementById("box" + i + "a").scrollIntoView({block: "end", behavior: "instant"});
       }
     }
     document.documentElement.removeAttribute("class");
   }
 
-  for (var i=1; i <= 4; i++) {
+  for (var i=1; i <= 8; i++) {
     document.getElementById("box" + i + "b")
-      .scrollIntoView(true, {behavior: "instant"});
+      .scrollIntoView({block: "start", behavior: "instant"});
   }
 
   window.addEventListener("MozReftestInvalidate", doTest, false);
 </script>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/scrolling/scroll-behavior-6.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+    <meta charset="utf-8">
+    <title>Testcase for bug 1010538 - Element.ScrollBy and Element.ScrollTo</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;
+        }
+
+        .scroll_box {
+            width: 50px;
+            height: 50px;
+            overflow: scroll;
+        }
+
+    </style>
+</head>
+<body>
+  <div id="scroll_1" class="scroll_box">
+    <div id="box1a" class="a_box"></div>
+    <div id="box1b" class="another_box"></div>
+  </div>
+  <div id="scroll_2" class="scroll_box">
+    <div id="box2a" class="a_box"></div>
+    <div id="box2b" class="another_box"></div>
+  </div>
+  <div id="scroll_3" class="scroll_box">
+    <div id="box3a" class="a_box"></div>
+    <div id="box3b" class="another_box"></div>
+  </div>
+  <div id="scroll_4" class="scroll_box">
+    <div id="box4a" class="a_box"></div>
+    <div id="box4b" class="another_box"></div>
+  </div>
+  <div id="scroll_5" class="scroll_box">
+    <div id="box5a" class="a_box"></div>
+    <div id="box5b" class="another_box"></div>
+  </div>
+  <div id="scroll_6" class="scroll_box">
+    <div id="box6a" class="a_box"></div>
+    <div id="box6b" class="another_box"></div>
+  </div>
+  <div id="scroll_7" class="scroll_box">
+    <div id="box7a" class="a_box"></div>
+    <div id="box7b" class="another_box"></div>
+  </div>
+  <div id="scroll_8" class="scroll_box">
+    <div id="box8a" class="a_box"></div>
+    <div id="box8b" class="another_box"></div>
+  </div>
+  <div id="scroll_9" class="scroll_box">
+    <div id="box9a" class="a_box"></div>
+    <div id="box9b" class="another_box"></div>
+  </div>
+  <div id="scroll_10" class="scroll_box">
+    <div id="box10a" class="a_box"></div>
+    <div id="box10b" class="another_box"></div>
+  </div>
+<script>
+  function doTest() {
+    if (document.location.search != '?ref') {
+      document.getElementById("scroll_1").scrollTo({left: 5, top: 0});
+      document.getElementById("scroll_2").scrollTo({left: 0, top: 5});
+      document.getElementById("scroll_3").scrollTo({left: 5, top: 5});
+      document.getElementById("scroll_4").scrollTo({left: 5, top: 5});
+      document.getElementById("scroll_5").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_6").scrollTo(0, 5);
+      document.getElementById("scroll_7").scrollTo(5, 0);
+      document.getElementById("scroll_8").scrollTo(0, 5);
+      document.getElementById("scroll_9").scrollTo(5, 5);
+      document.getElementById("scroll_10").scrollTo(0, 0);
+    } else {
+      document.getElementById("scroll_1").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_1").scrollBy({left: 5, top: 0});
+      
+      document.getElementById("scroll_2").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_2").scrollBy({left: 0, top: 5});
+      
+      document.getElementById("scroll_3").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_3").scrollBy({left: 5, top: 5});
+      
+      document.getElementById("scroll_4").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_4").scrollBy({left: 5});
+      document.getElementById("scroll_4").scrollBy({top: 5});
+      
+      document.getElementById("scroll_5").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_5").scrollBy({left: 5, top: 5, behavior: "smooth"});
+      // Expected to interrupt smooth scrolling
+      document.getElementById("scroll_5").scrollBy({});
+      
+      document.getElementById("scroll_6").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_6").scrollBy({left: 5, behavior: "smooth"});
+      // Expected to interrupt smooth scrolling and use the current position
+      // As the default for the axis that are not specified in the target
+      document.getElementById("scroll_6").scrollBy({top: 5, behavior: "smooth"});
+      
+      document.getElementById("scroll_7").scrollTo(0, 0);
+      document.getElementById("scroll_7").scrollBy(5, 0);
+      
+      document.getElementById("scroll_8").scrollTo(0, 0);
+      document.getElementById("scroll_8").scrollBy(0, 5);
+      
+      document.getElementById("scroll_9").scrollTo(0, 0);
+      document.getElementById("scroll_9").scrollBy(5, 5);
+      
+      document.getElementById("scroll_10").scrollTo(0, 0);
+      document.getElementById("scroll_10").scrollBy({left: 5, top: 5, behavior: "smooth"});
+      // Expected to interrupt smooth scrolling
+      document.getElementById("scroll_10").scrollBy(0, 0);
+    }
+    
+    // Allow smooth scrolling to complete before testing result
+    setTimeout(function() {
+      document.documentElement.removeAttribute("class");
+    }, 500);
+  }
+
+  window.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/scrolling/scroll-behavior-7.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+    <meta charset="utf-8">
+    <title>Testcase for bug 1010538, smooth scrolling expected</title>
+    <style type="text/css">
+
+        html,body {
+            color: black;
+            background-color: white;
+            font-size: 16px;
+            padding: 0;
+            margin: 0;
+        }
+
+        body {
+            scroll-behavior: smooth;
+        }
+
+        #a_box {
+            position: relative;
+            left: 10px;
+            top: 10px;
+            width: 20px;
+            height: 20px;
+            background: blue;
+        }
+
+        #another_box {
+            position: relative;
+            left: 2000px;
+            top: 2000px;
+            width: 20px;
+            height: 20px;
+            background: green;
+        }
+
+    </style>
+</head>
+<body>
+  <div id="a_box"></div>
+  <div id="another_box"></div>
+<script>
+  function doTest() {
+    if (document.location.search != '?ref') {
+      window.scrollTo(500, 500);
+      window.scrollTo(window.scrollX, window.scrollY);
+    }
+    document.documentElement.removeAttribute("class");
+  }
+  window.scrollTo({left: 0, top: 0, behavior: "instant"});
+  window.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</body>
+</html>