Bug 1086948 - Remove scroll-behavior: instant CSS value option. r=bz
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Wed, 22 Oct 2014 11:37:00 +0200
changeset 212093 b2ba88cd08c09e5f26951acc6e4ab1a9a58818bd
parent 212092 c2f036dd38b4adf30e260b2f91fbb6da4b551697
child 212094 c1012126b6e9636a71a3926b919ee08eeec9fb04
push id27697
push usercbook@mozilla.com
push dateFri, 24 Oct 2014 13:48:53 +0000
treeherdermozilla-central@de805196bbc4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1086948
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1086948 - Remove scroll-behavior: instant CSS value option. r=bz - Removed "instant" CSS keyword and references used by scroll-behavior. - Updated tests, removing scroll-behavior: instant test cases.
layout/base/ScrollbarStyles.h
layout/generic/nsGfxScrollFrame.cpp
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/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
layout/style/nsStyleConsts.h
layout/style/test/property_database.js
--- a/layout/base/ScrollbarStyles.h
+++ b/layout/base/ScrollbarStyles.h
@@ -13,18 +13,17 @@
 namespace mozilla {
 
 struct ScrollbarStyles
 {
   // Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
   // or NS_STYLE_OVERFLOW_AUTO.
   uint8_t mHorizontal;
   uint8_t mVertical;
-  // Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO,
-  // NS_STYLE_SCROLL_BEHAVIOR_INSTANT, or
+  // Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO or
   // NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
   uint8_t mScrollBehavior;
   ScrollbarStyles(uint8_t aH, uint8_t aV, uint8_t aB) : mHorizontal(aH),
                                                         mVertical(aV),
                                                         mScrollBehavior(aB) {}
   ScrollbarStyles() {}
   bool operator==(const ScrollbarStyles& aStyles) const {
     return aStyles.mHorizontal == mHorizontal && aStyles.mVertical == mVertical &&
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1784,25 +1784,17 @@ ScrollFrameHelper::AsyncScroll::InitTimi
   double dt = 1.0 / normalization * kCurrentVelocityWeighting;
   double dxy = slope / normalization * kCurrentVelocityWeighting;
   aTimingFunction.Init(dt, dxy, 1 - kStopDecelerationWeighting, 1);
 }
 
 bool
 ScrollFrameHelper::IsSmoothScrollingEnabled()
 {
-  if (!Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, false)) {
-    return false;
-  }
-  if (gfxPrefs::ScrollBehaviorEnabled()) {
-    ScrollbarStyles styles = GetScrollbarStylesFromFrame();
-    return styles.mScrollBehavior != NS_STYLE_SCROLL_BEHAVIOR_INSTANT;
-  } else {
-    return true;
-  }
+  return Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, false);
 }
 
 class ScrollFrameActivityTracker MOZ_FINAL : public nsExpirationTracker<ScrollFrameHelper,4> {
 public:
   // Wait for 3-4s between scrolls before we remove our layers.
   // That's 4 generations of 1s each.
   enum { TIMEOUT_MS = 1000 };
   ScrollFrameActivityTracker()
--- a/layout/reftests/scrolling/scroll-behavior-2.html
+++ b/layout/reftests/scrolling/scroll-behavior-2.html
@@ -32,26 +32,23 @@
         }
 
         .scroll_box {
             width: 50px;
             height: 50px;
             overflow: scroll;
         }
 
-        #scroll_1, #scroll_2, #scroll_3, #scroll_7 {
+        #scroll_1, #scroll_2, #scroll_3, #scroll_6 {
             scroll-behavior: smooth;
         }
 
         #scroll_4 {
-            scroll-behavior: instant;
+            scroll-behavior: auto;
         }
-
-        #scroll_5 {
-            scroll-behavior: auto;
 	}
 
     </style>
 </head>
 <body>
   <div id="scroll_1" class="scroll_box">
     <div id="box1a" class="a_box"></div>
     <div id="box1b" class="another_box"></div>
@@ -71,41 +68,36 @@
   <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({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);
+      document.getElementById("box6b").scrollIntoView(false);
 
       // Interrupt any smooth scrolling
-      for (var i=1; i <= 7; i++) {
+      for (var i=1; i <= 6; 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 <= 7; i++) {
+  for (var i=1; i <= 6; i++) {
     document.getElementById("box" + i + "a")
       .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,25 +32,21 @@
         }
 
         .scroll_box {
             width: 50px;
             height: 50px;
             overflow: scroll;
         }
 
-        #scroll_2, #scroll_6, #scroll_9, #scroll_12 {
+        #scroll_1, #scroll_4, #scroll_6, #scroll_8 {
             scroll-behavior: auto;
         }
 
-        #scroll_1, #scroll_5, #scroll_8, #scroll_11 {
-            scroll-behavior: instant;
-        }
-
-        #scroll_4 {
+        #scroll_3 {
             scroll-behavior: smooth;
         }
 
     </style>
 </head>
 <body>
   <div id="scroll_1" class="scroll_box">
     <div id="box1a" class="a_box"></div>
@@ -87,69 +83,49 @@
   <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>
-  <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({block: "end"});
       document.getElementById("box2b").scrollIntoView({block: "end"});
-      document.getElementById("box3b").scrollIntoView({block: "end"});
+      document.getElementById("box3b").scrollIntoView({block: "end", behavior: "instant"});
       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);
+      document.getElementById("box6b").scrollIntoView({block: "end", behavior: "auto"});
+      document.getElementById("box7b").scrollIntoView({block: "end", behavior: "auto"});
+      document.getElementById("box8b").scrollIntoView(false);
+      document.getElementById("box9b").scrollIntoView(false);
 
-      // Scroll_14 is a control, expected to scroll smoothly
-      document.getElementById("box14b").scrollIntoView({block: "end", behavior: "smooth"});
+      // Scroll_10 is a control, expected to scroll smoothly
+      document.getElementById("box10b").scrollIntoView({block: "end", behavior: "smooth"});
 
       // Interrupt any smooth scrolling
-      for (var i=1; i <= 14; i++) {
+      for (var i=1; i <= 10; 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 14
-      for (var i=1; i <= 13; i++) {
+      // Scroll all boxes except box 10
+      for (var i=1; i <= 9; i++) {
         document.getElementById("box" + i + "b").scrollIntoView({block: "end", behavior: "instant"});
       }
     }
     document.documentElement.removeAttribute("class");
   }
 
-  for (var i=1; i <= 14; i++) {
+  for (var i=1; i <= 10; i++) {
     document.getElementById("box" + i + "a")
       .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
@@ -37,21 +37,17 @@
             height: 50px;
             overflow: scroll;
         }
 
         #scroll_1 {
             scroll-behavior: auto;
         }
 
-        #scroll_1, #scroll_5, #scroll_8 {
-            scroll-behavior: instant;
-        }
-
-        #scroll_4 {
+        #scroll_3 {
             scroll-behavior: smooth;
         }
 
     </style>
 </head>
 <body>
   <div id="scroll_1" class="scroll_box">
     <div id="box1a" class="a_box"></div>
@@ -60,47 +56,43 @@
   <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
+      // Scroll_1 to Scroll_2 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({block: "end", behavior: "smooth"});
+      // Scroll_3 is expected to scroll smoothly
+      document.getElementById("box3b").scrollIntoView({block: "end", behavior: "smooth"});
 
       // Interrupt any smooth scrolling
-      for (var i=1; i <= 4; i++) {
+      for (var i=1; i <= 3; 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++) {
+      // Scroll all boxes except for Scroll_3
+      for (var i=1; i <= 2; i++) {
         document.getElementById("box" + i + "b").scrollIntoView({block: "end", behavior: "instant"});
       }
     }
     document.documentElement.removeAttribute("class");
   }
 
-  for (var i=1; i <= 4; i++) {
+  for (var i=1; i <= 3; i++) {
     document.getElementById("box" + i + "a")
       .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,21 @@
         }
 
         .scroll_box {
             width: 50px;
             height: 50px;
             overflow: scroll;
         }
 
-        #scroll_2, #scroll_5 {
+        #scroll_2, #scroll_4 {
             scroll-behavior: auto;
         }
 
-        #scroll_3, #scroll_6 {
-            scroll-behavior: instant;
-        }
-
-        #scroll_7, #scroll_8 {
+        #scroll_5, #scroll_6 {
             scroll-behavior: smooth;
         }
 
     </style>
 </head>
 <body>
   <div id="scroll_1" class="scroll_box">
     <div id="box1a" class="a_box"></div>
@@ -69,55 +65,45 @@
     <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 id="box6b" class="another_box"></div>
   </div>
 <script>
   function doTest() {
     if (document.location.search != '?ref') {
       // Expect instantaneous scroll:
       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_3").scrollTo(0, 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_7").scrollTo({left: 0, top: 0});
-      document.getElementById("scroll_8").scrollTo(0, 0);
+      document.getElementById("scroll_5").scrollTo({left: 0, top: 0});
+      document.getElementById("scroll_6").scrollTo(0, 0);
 
       // Interrupt any smooth scrolling
-      for (var i=1; i <= 8; i++) {
+      for (var i=1; i <= 6; i++) {
         document.getElementById("scroll_" + i).scrollTo();
       }
     } else {
-      // Scroll all boxes except for box7a and box8a
-      for (var i=1; i <= 6; i++) {
+      // Scroll all boxes except for box5a and box6a
+      for (var i=1; i <= 4; i++) {
         document.getElementById("box" + i + "a").scrollIntoView({block: "end", behavior: "instant"});
       }
     }
     document.documentElement.removeAttribute("class");
   }
 
-  for (var i=1; i <= 8; i++) {
+  for (var i=1; i <= 6; i++) {
     document.getElementById("box" + i + "b")
       .scrollIntoView({block: "start", behavior: "instant"});
   }
 
   window.addEventListener("MozReftestInvalidate", doTest, false);
 </script>
 </body>
 </html>
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -305,17 +305,16 @@ CSS_KEY(initial, initial)
 CSS_KEY(inline, inline)
 CSS_KEY(inline-axis, inline_axis)
 CSS_KEY(inline-block, inline_block)
 CSS_KEY(inline-flex, inline_flex)
 CSS_KEY(inline-grid, inline_grid)
 CSS_KEY(inline-table, inline_table)
 CSS_KEY(inset, inset)
 CSS_KEY(inside, inside)
-CSS_KEY(instant, instant)
 CSS_KEY(interpolatematrix, interpolatematrix)
 CSS_KEY(isolate, isolate)
 CSS_KEY(invert, invert)
 CSS_KEY(italic, italic)
 CSS_KEY(japanese-formal, japanese_formal)
 CSS_KEY(japanese-informal, japanese_informal)
 CSS_KEY(jis78, jis78)
 CSS_KEY(jis83, jis83)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1587,17 +1587,16 @@ const KTableValue nsCSSProps::kResizeKTa
   eCSSKeyword_both,       NS_STYLE_RESIZE_BOTH,
   eCSSKeyword_horizontal, NS_STYLE_RESIZE_HORIZONTAL,
   eCSSKeyword_vertical,   NS_STYLE_RESIZE_VERTICAL,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const KTableValue nsCSSProps::kScrollBehaviorKTable[] = {
   eCSSKeyword_auto,       NS_STYLE_SCROLL_BEHAVIOR_AUTO,
-  eCSSKeyword_instant,    NS_STYLE_SCROLL_BEHAVIOR_INSTANT,
   eCSSKeyword_smooth,     NS_STYLE_SCROLL_BEHAVIOR_SMOOTH,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const KTableValue nsCSSProps::kStackSizingKTable[] = {
   eCSSKeyword_ignore, NS_STYLE_STACK_SIZING_IGNORE,
   eCSSKeyword_stretch_to_fit, NS_STYLE_STACK_SIZING_STRETCH_TO_FIT,
   eCSSKeyword_UNKNOWN,-1
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -1066,18 +1066,17 @@ static inline mozilla::css::Side operato
 #define NS_STYLE_COUNTER_SPEAKAS_BULLETS    0
 #define NS_STYLE_COUNTER_SPEAKAS_NUMBERS    1
 #define NS_STYLE_COUNTER_SPEAKAS_WORDS      2
 #define NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT  3
 #define NS_STYLE_COUNTER_SPEAKAS_OTHER      255 // refer to another style
 
 // See nsStyleDisplay::mScrollBehavior
 #define NS_STYLE_SCROLL_BEHAVIOR_AUTO       0
-#define NS_STYLE_SCROLL_BEHAVIOR_INSTANT    1
-#define NS_STYLE_SCROLL_BEHAVIOR_SMOOTH     2
+#define NS_STYLE_SCROLL_BEHAVIOR_SMOOTH     1
 
 /*****************************************************************************
  * Constants for media features.                                             *
  *****************************************************************************/
 
 // orientation
 #define NS_STYLE_ORIENTATION_PORTRAIT           0
 #define NS_STYLE_ORIENTATION_LANDSCAPE          1
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -5642,17 +5642,17 @@ if (SpecialPowers.getBoolPref("layout.cs
 }
 
 if (SpecialPowers.getBoolPref("layout.css.scroll-behavior.property-enabled")) {
   gCSSProperties["scroll-behavior"] = {
     domProp: "scrollBehavior",
     inherited: false,
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "auto" ],
-    other_values: [ "instant", "smooth" ],
+    other_values: [ "smooth" ],
     invalid_values: [ "none",  "1px" ]
   };
 }
 
 if (SpecialPowers.getBoolPref("layout.css.unset-value.enabled")) {
   gCSSProperties["animation-direction"].invalid_values.push("normal, unset");
   gCSSProperties["animation-name"].invalid_values.push("bounce, unset", "unset, bounce");
   gCSSProperties["-moz-border-bottom-colors"].invalid_values.push("red unset", "unset red");