Bug 1217715 - Don't limit the system scroll override to the root content. r=botond, r=masayuki, a=ritu
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 19 Aug 2016 06:52:25 -0400
changeset 349951 4afc101231caed04859bf7dc98c846336cd76065
parent 349950 4cb3737983b122768aaf7bbff06d540f1783d303
child 349952 b0bdfbe111a24b0fc74a976646932c2e38781ee8
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, masayuki, ritu
bugs1217715
milestone50.0a2
Bug 1217715 - Don't limit the system scroll override to the root content. r=botond, r=masayuki, a=ritu MozReview-Commit-ID: EH94OR5rEsX
dom/events/WheelHandlingHelper.cpp
dom/events/test/test_wheel_default_action.html
gfx/layers/apz/src/AsyncPanZoomController.cpp
modules/libpref/init/all.js
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -408,22 +408,16 @@ WheelTransaction::OverrideSystemScrollSp
   MOZ_ASSERT(aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
 
   // If the event doesn't scroll to both X and Y, we don't need to do anything
   // here.
   if (!aEvent->mDeltaX && !aEvent->mDeltaY) {
     return DeltaValues(aEvent);
   }
 
-  // We shouldn't override the scrolling speed on non root scroll frame.
-  if (sTargetFrame !=
-        sTargetFrame->PresContext()->PresShell()->GetRootScrollFrame()) {
-    return DeltaValues(aEvent);
-  }
-
   return DeltaValues(aEvent->OverriddenDeltaX(),
                      aEvent->OverriddenDeltaY());
 }
 
 /******************************************************************/
 /* mozilla::ScrollbarsForWheel                                    */
 /******************************************************************/
 
--- a/dom/events/test/test_wheel_default_action.html
+++ b/dom/events/test/test_wheel_default_action.html
@@ -11,19 +11,26 @@
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
+SpecialPowers.pushPrefEnv({"set": [
+    ["mousewheel.system_scroll_override_on_root_content.enabled", false]
+]}, runTest);
 
-var subWin = window.open("window_wheel_default_action.html", "_blank",
-                         "width=500,height=500,scrollbars=yes");
+var subWin = null;
+
+function runTest() {
+  subWin = window.open("window_wheel_default_action.html", "_blank",
+                       "width=500,height=500,scrollbars=yes");
+}
 
 function finish()
 {
   subWin.close();
   SimpleTest.finish();
 }
 
 </script>
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1492,24 +1492,22 @@ AllowsScrollingMoreThanOnePage(double aM
   return Abs(aMultiplier) >= kMinAllowPageScroll;
 }
 
 ParentLayerPoint
 AsyncPanZoomController::GetScrollWheelDelta(const ScrollWheelInput& aEvent) const
 {
   ParentLayerSize scrollAmount;
   ParentLayerSize pageScrollSize;
-  bool isRootContent = false;
 
   {
     // Grab the lock to access the frame metrics.
     ReentrantMonitorAutoEnter lock(mMonitor);
     LayoutDeviceIntSize scrollAmountLD = mScrollMetadata.GetLineScrollAmount();
     LayoutDeviceIntSize pageScrollSizeLD = mScrollMetadata.GetPageScrollAmount();
-    isRootContent = mFrameMetrics.IsRootContent();
     scrollAmount = scrollAmountLD /
       mFrameMetrics.GetDevPixelsPerCSSPixel() * mFrameMetrics.GetZoom();
     pageScrollSize = pageScrollSizeLD /
       mFrameMetrics.GetDevPixelsPerCSSPixel() * mFrameMetrics.GetZoom();
   }
 
   ParentLayerPoint delta;
   switch (aEvent.mDeltaType) {
@@ -1532,19 +1530,19 @@ AsyncPanZoomController::GetScrollWheelDe
   }
 
   // Apply user-set multipliers.
   delta.x *= aEvent.mUserDeltaMultiplierX;
   delta.y *= aEvent.mUserDeltaMultiplierY;
 
   // For the conditions under which we allow system scroll overrides, see
   // EventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction
-  // and WheelTransaction::OverrideSystemScrollSpeed.
-  if (isRootContent &&
-      gfxPrefs::MouseWheelHasRootScrollDeltaOverride() &&
+  // and WheelTransaction::OverrideSystemScrollSpeed. Note that we do *not*
+  // restrict this to the root content, see bug 1217715 for discussion on this.
+  if (gfxPrefs::MouseWheelHasRootScrollDeltaOverride() &&
       !aEvent.IsCustomizedByUserPrefs() &&
       aEvent.mDeltaType == ScrollWheelInput::SCROLLDELTA_LINE &&
       aEvent.mAllowToOverrideSystemScrollSpeed) {
     delta.x = WidgetWheelEvent::ComputeOverriddenDelta(delta.x, false);
     delta.y = WidgetWheelEvent::ComputeOverriddenDelta(delta.y, true);
   }
 
   // If this is a line scroll, and this event was part of a scroll series, then
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2207,20 +2207,20 @@ pref("mousewheel.transaction.ignoremoved
 
 // prefs for app level mouse wheel scrolling acceleration.
 // number of mousewheel clicks when acceleration starts
 // acceleration can be turned off if pref is set to -1
 pref("mousewheel.acceleration.start", -1);
 // factor to be multiplied for constant acceleration
 pref("mousewheel.acceleration.factor", 10);
 
-// Prefs for override the system mouse wheel scrolling speed on the root
+// Prefs for override the system mouse wheel scrolling speed on
 // content of the web pages.  When
 // "mousewheel.system_scroll_override_on_root_content.enabled" is true and the system
-// scrolling speed isn't customized by the user, the root content scrolling
+// scrolling speed isn't customized by the user, the content scrolling
 // speed is multiplied by the following factors.  The value will be used as
 // 1/100.  E.g., 200 means 2.00.
 // NOTE: Even if "mousewheel.system_scroll_override_on_root_content.enabled" is
 // true, when Gecko detects the user customized the system scrolling speed
 // settings, the override isn't executed.
 pref("mousewheel.system_scroll_override_on_root_content.vertical.factor", 200);
 pref("mousewheel.system_scroll_override_on_root_content.horizontal.factor", 200);