[Pkg-mozext-commits] [tabmixplus] 11/48: Follow up bug 1320609 part.1 wheel event handler of <scrollbox> should use |_smoothScrollByPixels| instead of |scrollByPixels| when the deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE

David Prévot taffit at moszumanska.debian.org
Sun Aug 20 03:14:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit 9b9cc6673746442a46e1d62d676988545f07ad72
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu Jul 6 16:04:48 2017 +0300

    Follow up bug 1320609 part.1 wheel event handler of <scrollbox> should use |_smoothScrollByPixels| instead of |scrollByPixels| when the deltaMode is DOM_DELTA_LINE or DOM_DELTA_PAGE
---
 chrome/content/tabmix.js | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 2c9d48c..2e3d72f 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1053,21 +1053,34 @@ var TMP_eventListener = {
     } else if (direction !== 0 && !Tabmix.extensions.treeStyleTab) {
       // this code is based on scrollbox.xml wheel/DOMMouseScroll event handler
       let scrollByDelta = function(delta) {
+        let scrollByPixels = true;
+        let scrollAmount = 0;
         if (Tabmix.isVersion(480) &&
             aEvent.deltaMode == aEvent.DOM_DELTA_PIXEL) {
-          tabStrip.scrollByPixels(delta);
+          scrollAmount = delta;
         } else if (Tabmix.isVersion(490) &&
             aEvent.deltaMode == aEvent.DOM_DELTA_PAGE) {
-          tabStrip.scrollByPixels(delta * tabStrip.scrollClientSize);
+          scrollAmount = delta * tabStrip.scrollClientSize;
         } else if (Tabmix.isVersion(530) && !TabmixTabbar.isMultiRow) {
-          tabStrip.scrollByPixels(delta * tabStrip.lineScrollAmount);
+          scrollAmount = delta * tabStrip.lineScrollAmount;
         } else {
           // scroll the tabbar by one tab
           if (orient == "horizontal" || TabmixTabbar.isMultiRow) {
             delta = delta > 0 ? 1 : -1;
           }
+          scrollByPixels = false;
           tabStrip.scrollByIndex(delta);
         }
+
+        if (scrollByPixels) {
+          let useSmoothScroll = Tabmix.isVersion(530) &&
+            aEvent.deltaMode != aEvent.DOM_DELTA_PIXEL && tabStrip.smoothScroll;
+          if (useSmoothScroll) {
+            tabStrip._smoothScrollByPixels(scrollAmount);
+          } else {
+            tabStrip.scrollByPixels(scrollAmount);
+          }
+        }
       };
 
       if (orient == "vertical") {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list