diff --git a/mozilla/themes/classic/communicator/communicator.css b/mozilla/themes/classic/communicator/communicator.css
index a32ef2efa74..faa74235b87 100644
--- a/mozilla/themes/classic/communicator/communicator.css
+++ b/mozilla/themes/classic/communicator/communicator.css
@@ -92,3 +92,13 @@
margin-right: 2px;
}
+/* :::::: autoscroll popup ::::: */
+
+#autoscroller {
+ height: 28px;
+ width: 28px;
+ border: 0px;
+ margin: -14px;
+ padding: 0px;
+ background-image: url("chrome://communicator/skin/icons/autoscroll.gif");
+}
diff --git a/mozilla/themes/classic/communicator/icons/autoscroll.gif b/mozilla/themes/classic/communicator/icons/autoscroll.gif
new file mode 100644
index 00000000000..7108e6cd2d6
Binary files /dev/null and b/mozilla/themes/classic/communicator/icons/autoscroll.gif differ
diff --git a/mozilla/themes/classic/jar.mn b/mozilla/themes/classic/jar.mn
index 3e45cad7fe3..ad21fbe9652 100644
--- a/mozilla/themes/classic/jar.mn
+++ b/mozilla/themes/classic/jar.mn
@@ -55,6 +55,7 @@ classic.jar:
skin/classic/communicator/brand/throbber-anim.gif (communicator/brand/throbber-anim.gif)
skin/classic/communicator/brand/throbber16-single.gif (communicator/brand/throbber16-single.gif)
skin/classic/communicator/brand/throbber16-anim.gif (communicator/brand/throbber16-anim.gif)
+ skin/classic/communicator/icons/autoscroll.gif (communicator/icons/autoscroll.gif)
skin/classic/communicator/icons/offline.gif (communicator/icons/offline.gif)
skin/classic/communicator/icons/online.gif (communicator/icons/online.gif)
skin/classic/communicator/icons/search-act.gif (communicator/icons/search-act.gif)
diff --git a/mozilla/themes/modern/communicator/communicator.css b/mozilla/themes/modern/communicator/communicator.css
index 987a0f4b00a..e2642b2aa5a 100644
--- a/mozilla/themes/modern/communicator/communicator.css
+++ b/mozilla/themes/modern/communicator/communicator.css
@@ -89,3 +89,13 @@
margin-right: 2px;
}
+/* :::::: autoscroll popup ::::: */
+
+#autoscroller {
+ height: 28px;
+ width: 28px;
+ border: 0px;
+ margin: -14px;
+ padding: 0px;
+ background-image: url("chrome://communicator/skin/icons/autoscroll.gif");
+}
diff --git a/mozilla/themes/modern/communicator/icons/autoscroll.gif b/mozilla/themes/modern/communicator/icons/autoscroll.gif
new file mode 100644
index 00000000000..7108e6cd2d6
Binary files /dev/null and b/mozilla/themes/modern/communicator/icons/autoscroll.gif differ
diff --git a/mozilla/themes/modern/jar.mn b/mozilla/themes/modern/jar.mn
index e5ab08fdff4..8f0b6d9848e 100644
--- a/mozilla/themes/modern/jar.mn
+++ b/mozilla/themes/modern/jar.mn
@@ -28,6 +28,7 @@ modern.jar:
skin/modern/communicator/directory/file-folder-open.gif (communicator/directory/file-folder-open.gif)
skin/modern/communicator/directory/file-icon.gif (communicator/directory/file-icon.gif)
skin/modern/communicator/directory/directory.css (communicator/directory/directory.css)
+ skin/modern/communicator/icons/autoscroll.gif (communicator/icons/autoscroll.gif)
skin/modern/communicator/icons/loading.gif (communicator/icons/loading.gif)
skin/modern/communicator/icons/lock-broken.gif (communicator/icons/lock-broken.gif)
skin/modern/communicator/icons/lock-insecure.gif (communicator/icons/lock-insecure.gif)
diff --git a/mozilla/xpfe/browser/resources/content/navigator.xul b/mozilla/xpfe/browser/resources/content/navigator.xul
index fe7cacb0433..5002aa9c66e 100644
--- a/mozilla/xpfe/browser/resources/content/navigator.xul
+++ b/mozilla/xpfe/browser/resources/content/navigator.xul
@@ -139,6 +139,8 @@
+
+
@@ -346,6 +348,7 @@
contentcontextmenu="contentAreaContextMenu"
onnewtab="BrowserOpenTab();"
onbookmarkgroup="addGroupmarkAs();"
+ onmousedown="return contentAreaMouseDown(event);"
onclick="return contentAreaClick(event);"/>
diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaClick.js b/mozilla/xpfe/communicator/resources/content/contentAreaClick.js
index 8eb0453d6ba..5063a09b6b9 100644
--- a/mozilla/xpfe/communicator/resources/content/contentAreaClick.js
+++ b/mozilla/xpfe/communicator/resources/content/contentAreaClick.js
@@ -49,6 +49,14 @@
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
+ var startX;
+ var startY;
+ var currX;
+ var currY;
+ var scrollingView;
+ var autoScrollTimer;
+ var ignoreMouseEvents;
+
// Prefill a single text field
function prefillTextBox(target) {
// obtain values to be used for prefilling
@@ -201,6 +209,71 @@
return true;
}
+ function contentAreaMouseDown(event)
+ {
+ if (event.button == 1 && (event.target != event.currentTarget)
+ && !hrefAndLinkNodeForClickEvent(event)
+ && (!pref || !pref.getBoolPref("middlemouse.contentLoadURL"))) {
+ startScrolling(event);
+ ignoreMouseEvents = true;
+ return false;
+ }
+ return true;
+ }
+
+ function startScrolling(event)
+ {
+ var scroller = document.getElementById("autoscroller");
+ if (scrollingView || !scroller)
+ return;
+ document.popupNode = null;
+ scroller.showPopup(scroller.parentNode, event.screenX, event.screenY,
+ "popup", null, null);
+ startX = event.screenX;
+ startY = event.screenY;
+ currX = event.screenX;
+ currY = event.screenY;
+ addEventListener('mousemove', handleMouseMove, true);
+ addEventListener('mouseup', handleMouseUpDown, true);
+ addEventListener('mousedown', handleMouseUpDown, true);
+ autoScrollTimer = setInterval(autoScrollLoop, 10);
+ scrollingView = event.originalTarget.ownerDocument.defaultView;
+ }
+
+ function handleMouseMove(event)
+ {
+ currX = event.screenX;
+ currY = event.screenY;
+ }
+
+ function autoScrollLoop()
+ {
+ var x = currX - startX;
+ var y = currY - startY;
+ const speed = 4;
+ if (Math.abs(x) >= speed || Math.abs(y) >= speed)
+ ignoreMouseEvents = false;
+ scrollingView.scrollBy(x / speed, y / speed);
+ }
+
+ function handleMouseUpDown(event)
+ {
+ if (!ignoreMouseEvents)
+ document.getElementById("autoscroller").hidePopup();
+ ignoreMouseEvents = false;
+ }
+
+ function stopScrolling()
+ {
+ if (scrollingView) {
+ scrollingView = null;
+ removeEventListener('mousemove', handleMouseMove, true);
+ removeEventListener('mousedown', handleMouseUpDown, true);
+ removeEventListener('mouseup', handleMouseUpDown, true);
+ clearInterval(autoScrollTimer);
+ }
+ }
+
function openNewTabOrWindow(event, href, sendReferrer)
{
// should we open it in a new tab?