Bug 384575 - Remove SeaMonkey's autoscroll now that its improvements have been ported to toolkit's

r=mano on the toolkit change
r+sr=neil on the rest
This commit is contained in:
cst%yecc.com 2007-07-22 02:42:01 +00:00
Родитель f9ff208fd5
Коммит 2a26a6eeec
13 изменённых файлов: 54 добавлений и 466 удалений

Просмотреть файл

@ -140,7 +140,6 @@
<browser id="messagepane" context="messagePaneContext"
style="height: 0px; min-height: 1px" flex="1" name="messagepane"
disablesecurity="true" disablehistory="true" type="content-primary"
onmousedown="return contentAreaMouseDown(event);"
src="about:blank" onclick="return messagePaneOnClick(event);" autofind="false"/>
</vbox>
</vbox>

Просмотреть файл

@ -186,7 +186,6 @@
<browser id="messagepane" name="messagepane" height="0" flex="1"
context="messagePaneContext" minwidth="1" minheight="1"
disablesecurity="true" disablehistory="true" autofind="false"
onmousedown="return contentAreaMouseDown(event);"
type="content-primary" onclick="return messagePaneOnClick(event);"/>
</vbox>
</box>

Просмотреть файл

@ -350,7 +350,6 @@
contentcontextmenu="contentAreaContextMenu"
onnewtab="BrowserOpenTab();"
onbookmarkgroup="addGroupmarkAs();"
onmousedown="return contentAreaMouseDown(event);"
onclick="return contentAreaClick(event);"/>
</hbox>
</vbox>

Просмотреть файл

@ -120,7 +120,7 @@
</xul:tabs>
</xul:hbox>
<xul:tabpanels flex="1" class="plain" selectedIndex="0" anonid="panelcontainer">
<xul:browser type="content-primary" xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu" autoscroll="false"/>
<xul:browser type="content-primary" xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu"/>
</xul:tabpanels>
</xul:tabbox>
<children/>
@ -1017,7 +1017,6 @@
b.setAttribute("type", "content-targetable");
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
b.setAttribute("autoscroll", "false");
this.mPanelContainer.appendChild(b);

Просмотреть файл

@ -100,7 +100,6 @@
<browser id="content" type="content-primary" name="content" src="about:blank" flex="1"
disablehistory="true" disablesecurity="true"
onmousedown="startScrolling(event);"
context="viewSourceContextMenu"/>
</vbox>

Просмотреть файл

@ -43,7 +43,6 @@
* - [ Dependencies ] ---------------------------------------------------------
* utilityOverlay.js:
* - gatherTextUnder
* - startScrolling
*/
var pref = null;
@ -200,42 +199,6 @@
return true;
}
function contentAreaMouseDown(event)
{
if (event.button == 1 && (event.target != event.currentTarget)
&& !hrefAndLinkNodeForClickEvent(event)
&& !isAutoscrollBlocker(event.originalTarget)) {
startScrolling(event);
return false;
}
return true;
}
function isAutoscrollBlocker(node)
{
if (!pref)
return false;
if (pref.getBoolPref("middlemouse.contentLoadURL"))
return true;
if (!pref.getBoolPref("middlemouse.paste"))
return false;
if (node.ownerDocument.designMode == "on")
return true;
while (node) {
if (node instanceof HTMLTextAreaElement ||
(node instanceof HTMLInputElement &&
(node.type == "text" || node.type == "password")))
return true;
node = node.parentNode;
}
return false;
}
function openNewTabOrWindow(event, href, doc)
{
// should we open it in a new tab?

Просмотреть файл

@ -591,138 +591,3 @@ function validateFileName(aFileName)
return aFileName.replace(re, "_");
}
// autoscroll
var gStartX;
var gStartY;
var gCurrX;
var gCurrY;
var gScrollingView;
var gAutoScrollTimer;
var gIgnoreMouseEvents;
var gAutoScrollPopup = null;
var gAccumulatedScrollErrorX;
var gAccumulatedScrollErrorY;
function startScrolling(event)
{
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (gScrollingView || event.button != 1)
return;
if (!pref.getBoolPref("general.autoScroll"))
return;
if (event.originalTarget instanceof XULElement &&
((event.originalTarget.localName == "thumb")
|| (event.originalTarget.localName == "slider")
|| (event.originalTarget.localName == "scrollbarbutton")))
return;
if (!gAutoScrollPopup) {
const XUL_NS
= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
gAutoScrollPopup = document.createElementNS(XUL_NS, "popup");
gAutoScrollPopup.id = "autoscroller";
if (screen.colorDepth > 8) { // need high colour for transparency
// Exclude second-rate platforms
gAutoScrollPopup.setAttribute("transparent", !/BeOS|Mac|OS\/2|Photon/.test(navigator.appVersion));
// Enable translucency on W2K+ (but not WinNT4.0)
gAutoScrollPopup.setAttribute("translucent", /^Windows NT /.test(navigator.oscpu));
}
gAutoScrollPopup.addEventListener("popuphidden", stopScrolling, true);
document.documentElement.appendChild(gAutoScrollPopup);
}
gScrollingView = event.originalTarget.ownerDocument.defaultView;
var scrollingDir;
if (gScrollingView.scrollMaxX > 0) {
gAutoScrollPopup.setAttribute("scrolldir", gScrollingView.scrollMaxY > 0 ? "NSEW" : "EW");
}
else if (gScrollingView.scrollMaxY > 0) {
gAutoScrollPopup.setAttribute("scrolldir", "NS");
}
else {
gScrollingView = null; // abort scrolling
return;
}
document.popupNode = null;
gAutoScrollPopup.showPopup(document.documentElement, event.screenX, event.screenY,
"popup", null, null);
gIgnoreMouseEvents = true;
gStartX = event.screenX;
gStartY = event.screenY;
gCurrX = event.screenX;
gCurrY = event.screenY;
addEventListener('mousemove', handleMouseMove, true);
addEventListener('mouseup', handleMouseUpDown, true);
addEventListener('mousedown', handleMouseUpDown, true);
addEventListener('contextmenu', handleMouseUpDown, true);
gAutoScrollTimer = setInterval(autoScrollLoop, 10);
gAccumulatedScrollErrorX = 0;
gAccumulatedScrollErrorY = 0;
}
function handleMouseMove(event)
{
gCurrX = event.screenX;
gCurrY = event.screenY;
}
function roundToZero(num)
{
if (num > 0)
return Math.floor(num);
return Math.ceil(num);
}
function accelerate(curr, start)
{
var speed = 12;
var val = (curr - start) / speed;
if (val > 1)
return val * Math.sqrt(val) - 1;
if (val < -1)
return val * Math.sqrt(-val) + 1;
return 0;
}
function autoScrollLoop()
{
var x = accelerate(gCurrX, gStartX);
var y = accelerate(gCurrY, gStartY);
if (x || y)
gIgnoreMouseEvents = false;
var desiredScrollX = gAccumulatedScrollErrorX + x;
var actualScrollX = roundToZero(desiredScrollX);
gAccumulatedScrollErrorX = (desiredScrollX - actualScrollX);
var desiredScrollY = gAccumulatedScrollErrorY + y;
var actualScrollY = roundToZero(desiredScrollY);
gAccumulatedScrollErrorY = (desiredScrollY - actualScrollY);
gScrollingView.scrollBy(actualScrollX, actualScrollY);
}
function handleMouseUpDown(event)
{
if (!gIgnoreMouseEvents)
gAutoScrollPopup.hidePopup();
gIgnoreMouseEvents = false;
}
function stopScrolling()
{
if (gScrollingView) {
gScrollingView = null;
removeEventListener('mousemove', handleMouseMove, true);
removeEventListener('mousedown', handleMouseUpDown, true);
removeEventListener('mouseup', handleMouseUpDown, true);
removeEventListener('contextmenu', handleMouseUpDown, true);
clearInterval(gAutoScrollTimer);
}
}

Просмотреть файл

@ -1,147 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
* Manuel Reimer <Manuel.Reimer@gmx.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* ==== communicator.css ====================================================
== Styles shared everywhere throughout the Communicator suite.
========================================================================== */
@import url("chrome://global/skin/");
@import url("chrome://communicator/content/communicator.css");
@import url("chrome://communicator/skin/brand.css");
@import url("chrome://communicator/skin/button.css");
@import url("chrome://communicator/skin/toolbar.css");
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* ::::: toolbar-primary ::::: */
.toolbar-primary {
-moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#grippytoolbar-primary");
}
/* ::::: online/offline icons ::::: */
#offline-status[offline="true"] {
list-style-image: url("chrome://communicator/skin/icons/offline.png");
}
#offline-status {
list-style-image: url("chrome://communicator/skin/icons/online.png");
}
/* ::::: spell checker ::::: */
.spell-suggestion {
font-weight: bold;
}
/* ::::: directional button icons ::::: */
.up {
min-width: 0px;
list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
}
.up[disabled="true"] {
list-style-image: url("chrome://global/skin/arrow/arrow-up-dis.gif");
}
.down {
min-width: 0px;
list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
}
.down[disabled="true"] {
list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.gif");
}
.sidebarTree {
border: none;
margin: 0px !important;
}
/* ::::: download manager ::::: */
#downloadView > treechildren::-moz-tree-image(Name) {
margin-right: 2px;
}
/* :::::: autoscroll popup ::::: */
#autoscroller {
height: 28px;
width: 28px;
border: 0px;
margin: -14px;
padding: 0px;
background-image: url("chrome://communicator/skin/icons/autoscroll.png");
background-color: transparent;
-moz-appearance: none;
}
#autoscroller[scrolldir="NS"] {
background-position: left center;
}
#autoscroller[scrolldir="EW"] {
background-position: left bottom;
}
#autoscroller[transparent="true"] {
background-position: center top;
}
#autoscroller[transparent="true"][scrolldir="NS"] {
background-position: center center;
}
#autoscroller[transparent="true"][scrolldir="EW"] {
background-position: center bottom;
}
#autoscroller[translucent="true"] {
background-position: right top;
}
#autoscroller[translucent="true"][scrolldir="NS"] {
background-position: right center;
}
#autoscroller[translucent="true"][scrolldir="EW"] {
background-position: right bottom;
}

Просмотреть файл

@ -72,7 +72,6 @@ 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.png (communicator/icons/autoscroll.png)
skin/classic/communicator/icons/close-button.gif (communicator/icons/close-button.gif)
skin/classic/communicator/icons/offline.png (communicator/icons/offline.png)
skin/classic/communicator/icons/online.png (communicator/icons/online.png)

Просмотреть файл

@ -1,139 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* ==== communicator.css ====================================================
== Styles shared everywhere throughout the Communicator suite.
========================================================================== */
@import url("chrome://global/skin/");
@import url("chrome://communicator/content/communicator.css");
@import url("chrome://communicator/skin/brand.css");
@import url("chrome://communicator/skin/button.css");
@import url("chrome://communicator/skin/toolbar.css");
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* ::::: online/offline icons ::::: */
#offline-status[offline="true"] {
list-style-image: url("chrome://communicator/skin/icons/offline.gif");
}
#offline-status {
list-style-image: url("chrome://communicator/skin/icons/online.gif");
}
/* ::::: spell checker ::::: */
.spell-suggestion {
font-weight: bold;
}
/* ::::: directional button icons ::::: */
.up {
min-width: 0px;
list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
}
.up[disabled="true"] {
list-style-image: url("chrome://global/skin/arrow/arrow-up-dis.gif");
}
.down {
min-width: 0px;
list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
}
.down[disabled="true"] {
list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.gif");
}
.sidebarTree {
border: none;
margin: 0px !important;
}
/* ::::: download manager ::::: */
#downloadView > treechildren::-moz-tree-image(Name) {
margin-right: 2px;
}
/* :::::: autoscroll popup ::::: */
#autoscroller {
height: 28px;
width: 28px;
border: 0px;
margin: -14px;
padding: 0px;
background-image: url("chrome://communicator/skin/icons/autoscroll.png");
background-color: transparent;
}
#autoscroller[scrolldir="NS"] {
background-position: left center;
}
#autoscroller[scrolldir="EW"] {
background-position: left bottom;
}
#autoscroller[transparent="true"] {
background-position: center top;
}
#autoscroller[transparent="true"][scrolldir="NS"] {
background-position: center center;
}
#autoscroller[transparent="true"][scrolldir="EW"] {
background-position: center bottom;
}
#autoscroller[translucent="true"] {
background-position: right top;
}
#autoscroller[translucent="true"][scrolldir="NS"] {
background-position: right center;
}
#autoscroller[translucent="true"][scrolldir="EW"] {
background-position: right bottom;
}

Просмотреть файл

@ -178,3 +178,47 @@ resizer[dir="bottomright"] {
description.error {
color: #FF0000;
}
/* :::::: autoscroll popup ::::: */
#autoscroller {
height: 28px;
width: 28px;
border: none;
margin: -14px;
padding: 0;
background-image: url("chrome://global/skin/icons/autoscroll.png");
background-color: transparent;
-moz-appearance: none;
}
#autoscroller[scrolldir="NS"] {
background-position: left center;
}
#autoscroller[scrolldir="EW"] {
background-position: left bottom;
}
#autoscroller[transparent="true"] {
background-position: center top;
}
#autoscroller[transparent="true"][scrolldir="NS"] {
background-position: center center;
}
#autoscroller[transparent="true"][scrolldir="EW"] {
background-position: center bottom;
}
#autoscroller[translucent="true"] {
background-position: right top;
}
#autoscroller[translucent="true"][scrolldir="NS"] {
background-position: right center;
}
#autoscroller[translucent="true"][scrolldir="EW"] {
background-position: right bottom;
}

Просмотреть файл

@ -42,7 +42,6 @@ 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.png (communicator/icons/autoscroll.png)
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)
@ -230,6 +229,7 @@ modern.jar:
skin/modern/global/icons/alert-message.gif (global/icons/alert-message.gif)
skin/modern/global/icons/alert-question.gif (global/icons/alert-question.gif)
skin/modern/global/icons/alert-security.gif (global/icons/alert-security.gif)
skin/modern/global/icons/autoscroll.png (global/icons/autoscroll.png)
skin/modern/global/icons/close-dis.gif (global/icons/close-dis.gif)
skin/modern/global/icons/close-act.gif (global/icons/close-act.gif)
skin/modern/global/icons/close.gif (global/icons/close.gif)

Просмотреть файл

@ -731,6 +731,14 @@
this._autoScrollPopup.addEventListener("popuphidden", this, true);
// we need these attributes so themers don't need to create per-platform packages
if (screen.colorDepth > 8) { // need high color for transparency
// Exclude second-rate platforms
this._autoScrollPopup.setAttribute("transparent", !/BeOS|Mac|OS\/2|Photon/.test(navigator.appVersion));
// Enable translucency on W2K+ (but not WinNT4.0)
this._autoScrollPopup.setAttribute("translucent", /^Windows NT /.test(navigator.oscpu));
}
this._scrollingView = event.originalTarget.ownerDocument.defaultView;
if (this._scrollingView.scrollMaxX > 0) {
this._autoScrollPopup.setAttribute("scrolldir", this._scrollingView.scrollMaxY > 0 ? "NSEW" : "EW");