Bug 1518823 - Port bug 1482389: Remove acces via .treeBoxObject and .boxObject. rs=bustage-fix

This commit is contained in:
Jorg K 2019-01-15 10:42:53 +01:00
Родитель 9913cef015
Коммит 396ab0d57e
31 изменённых файлов: 268 добавлений и 308 удалений

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

@ -8,7 +8,7 @@ var hasValue;
var oldValue; var oldValue;
var insertNew; var insertNew;
var itemArray; var itemArray;
var treeBoxObject; var theTree;
var treeSelection; var treeSelection;
var selectElement; var selectElement;
var currentItem = null; var currentItem = null;
@ -94,14 +94,14 @@ optionObject.prototype.cycleCell = function cycleCell(index)
else if (selectedOption) else if (selectedOption)
{ {
selectedOption.removeAttribute("selected"); selectedOption.removeAttribute("selected");
var column = treeBoxObject.columns["SelectSelCol"]; var column = theTree.columns["SelectSelCol"];
treeBoxObject.invalidateColumn(column); theTree.invalidateColumn(column);
selectedOption = null; selectedOption = null;
} }
this.element.setAttribute("selected", ""); this.element.setAttribute("selected", "");
selectedOption = this.element; selectedOption = this.element;
var column = treeBoxObject.columns["SelectSelCol"]; var column = theTree.columns["SelectSelCol"];
treeBoxObject.invalidateCell(index, column); theTree.invalidateCell(index, column);
} }
if (currentItem == this) if (currentItem == this)
// Also update the deck // Also update the deck
@ -178,10 +178,10 @@ optionObject.prototype.moveUp = function moveUp()
if (itemArray[index].level < itemArray[index - 1].level + itemArray[index - 1].container) if (itemArray[index].level < itemArray[index - 1].level + itemArray[index - 1].container)
{ {
// we need to repaint the tree's lines // we need to repaint the tree's lines
treeBoxObject.invalidateRange(getParentIndex(index), index); theTree.invalidateRange(getParentIndex(index), index);
// a) option is just after an optgroup, so it becomes the last child // a) option is just after an optgroup, so it becomes the last child
itemArray[index].level = 2; itemArray[index].level = 2;
treeBoxObject.view.selectionChanged(); theTree.view.selectionChanged();
} }
else else
{ {
@ -206,10 +206,10 @@ optionObject.prototype.moveDown = function moveDown()
if (index + 1 == itemArray.length || itemArray[index].level > itemArray[index + 1].level) if (index + 1 == itemArray.length || itemArray[index].level > itemArray[index + 1].level)
{ {
// we need to repaint the tree's lines // we need to repaint the tree's lines
treeBoxObject.invalidateRange(getParentIndex(index), index); theTree.invalidateRange(getParentIndex(index), index);
// a) option is last child of an optgroup, so it moves just after // a) option is last child of an optgroup, so it moves just after
itemArray[index].level = 1; itemArray[index].level = 1;
treeBoxObject.view.selectionChanged(); theTree.view.selectionChanged();
} }
else else
{ {
@ -292,7 +292,7 @@ optgroupObject.prototype.moveUp = function moveUp()
var endItems = itemArray.splice(index); var endItems = itemArray.splice(index);
itemArray = itemArray.concat(movedItems).concat(endItems); itemArray = itemArray.concat(movedItems).concat(endItems);
// Repaint the lot // Repaint the lot
treeBoxObject.invalidateRange(index, j); theTree.invalidateRange(index, j);
selectTreeIndex(index, true); selectTreeIndex(index, true);
} }
@ -312,7 +312,7 @@ optgroupObject.prototype.moveDown = function moveDown()
var endItems = itemArray.splice(index); var endItems = itemArray.splice(index);
itemArray = itemArray.concat(movedItems).concat(endItems); itemArray = itemArray.concat(movedItems).concat(endItems);
// Repaint the lot // Repaint the lot
treeBoxObject.invalidateRange(index, j); theTree.invalidateRange(index, j);
index += j - i; index += j - i;
selectTreeIndex(index, true); selectTreeIndex(index, true);
} }
@ -321,11 +321,11 @@ optgroupObject.prototype.appendOption = function appendOption(child, parent)
{ {
var index = gDialog.nextChild(parent); var index = gDialog.nextChild(parent);
// XXX need to repaint the lines, tree won't do this // XXX need to repaint the lines, tree won't do this
var primaryCol = treeBoxObject.columns.getPrimaryColumn(); var primaryCol = theTree.columns.getPrimaryColumn();
treeBoxObject.invalidateCell(index - 1, primaryCol); theTree.invalidateCell(index - 1, primaryCol);
// insert the wrapped object as the last child // insert the wrapped object as the last child
itemArray.splice(index, 0, new optionObject(child, 2)); itemArray.splice(index, 0, new optionObject(child, 2));
treeBoxObject.rowCountChanged(index, 1); theTree.rowCountChanged(index, 1);
selectTreeIndex(index, false); selectTreeIndex(index, false);
}; };
@ -432,10 +432,10 @@ function Startup()
{ {
var index = itemArray.length; var index = itemArray.length;
// XXX need to repaint the lines, tree won't do this // XXX need to repaint the lines, tree won't do this
treeBoxObject.invalidateRange(this.lastChild(), index); theTree.invalidateRange(this.lastChild(), index);
// append the wrapped object // append the wrapped object
itemArray.push(new optionObject(child, 1)); itemArray.push(new optionObject(child, 1));
treeBoxObject.rowCountChanged(index, 1); theTree.rowCountChanged(index, 1);
selectTreeIndex(index, false); selectTreeIndex(index, false);
}, },
canDestroy: function canDestroy(prompt) canDestroy: function canDestroy(prompt)
@ -481,8 +481,8 @@ function Startup()
UpdateSelectMultiple(); UpdateSelectMultiple();
// Define a custom view for the tree // Define a custom view for the tree
treeBoxObject = gDialog.tree.treeBoxObject; theTree = gDialog.tree;
treeBoxObject.view = { theTree.view = {
QueryInterface: ChromeUtils.generateQI(["nsITreeView", QueryInterface: ChromeUtils.generateQI(["nsITreeView",
"nsISupportsWeakReference"]), "nsISupportsWeakReference"]),
// useful for debugging // useful for debugging
@ -628,10 +628,10 @@ function AddOptGroup()
var optgroupElement = GetCurrentEditor().createElementWithDefaults("optgroup"); var optgroupElement = GetCurrentEditor().createElementWithDefaults("optgroup");
var index = itemArray.length; var index = itemArray.length;
// XXX need to repaint the lines, tree won't do this // XXX need to repaint the lines, tree won't do this
treeBoxObject.invalidateRange(gDialog.lastChild(), index); theTree.invalidateRange(gDialog.lastChild(), index);
// append the wrapped object // append the wrapped object
itemArray.push(new optgroupObject(optgroupElement)); itemArray.push(new optgroupObject(optgroupElement));
treeBoxObject.rowCountChanged(index, 1); theTree.rowCountChanged(index, 1);
selectTreeIndex(index, false); selectTreeIndex(index, false);
SetTextboxFocus(gDialog.optgroupLabel); SetTextboxFocus(gDialog.optgroupLabel);
} }
@ -651,10 +651,10 @@ function RemoveElement()
if (level == 1) { if (level == 1) {
var last = gDialog.lastChild(); var last = gDialog.lastChild();
if (index > last) if (index > last)
treeBoxObject.invalidateRange(last, index); theTree.invalidateRange(last, index);
} }
selectTreeIndex(index, true); selectTreeIndex(index, true);
treeBoxObject.rowCountChanged(++index, -1); theTree.rowCountChanged(++index, -1);
} }
} }
@ -672,16 +672,16 @@ function onNameInput()
gDialog.accept.disabled = disabled; gDialog.accept.disabled = disabled;
gDialog.element.setAttribute("name", gDialog.selectName.value); gDialog.element.setAttribute("name", gDialog.selectName.value);
// repaint the tree // repaint the tree
var primaryCol = treeBoxObject.columns.getPrimaryColumn(); var primaryCol = theTree.columns.getPrimaryColumn();
treeBoxObject.invalidateCell(treeSelection.currentIndex, primaryCol); theTree.invalidateCell(treeSelection.currentIndex, primaryCol);
} }
function onLabelInput() function onLabelInput()
{ {
currentItem.element.setAttribute("label", gDialog.optgroupLabel.value); currentItem.element.setAttribute("label", gDialog.optgroupLabel.value);
// repaint the tree // repaint the tree
var primaryCol = treeBoxObject.columns.getPrimaryColumn(); var primaryCol = theTree.columns.getPrimaryColumn();
treeBoxObject.invalidateCell(treeSelection.currentIndex, primaryCol); theTree.invalidateCell(treeSelection.currentIndex, primaryCol);
} }
function onTextInput() function onTextInput()
@ -689,13 +689,13 @@ function onTextInput()
currentItem.element.text = gDialog.optionText.value; currentItem.element.text = gDialog.optionText.value;
// repaint the tree // repaint the tree
if (hasValue) { if (hasValue) {
var primaryCol = treeBoxObject.columns.getPrimaryColumn(); var primaryCol = theTree.columns.getPrimaryColumn();
treeBoxObject.invalidateCell(treeSelection.currentIndex, primaryCol); theTree.invalidateCell(treeSelection.currentIndex, primaryCol);
} }
else else
{ {
gDialog.optionValue.value = gDialog.optionText.value; gDialog.optionValue.value = gDialog.optionText.value;
treeBoxObject.invalidateRow(treeSelection.currentIndex); theTree.invalidateRow(treeSelection.currentIndex);
} }
} }
@ -705,8 +705,8 @@ function onValueInput()
oldValue = gDialog.optionValue.value; oldValue = gDialog.optionValue.value;
currentItem.element.setAttribute("value", oldValue); currentItem.element.setAttribute("value", oldValue);
// repaint the tree // repaint the tree
var column = treeBoxObject.columns["SelectValCol"]; var column = theTree.columns["SelectValCol"];
treeBoxObject.invalidateCell(treeSelection.currentIndex, column); theTree.invalidateCell(treeSelection.currentIndex, column);
} }
function onHasValueClick() function onHasValueClick()
@ -724,8 +724,8 @@ function onHasValueClick()
currentItem.element.removeAttribute("value"); currentItem.element.removeAttribute("value");
} }
// repaint the tree // repaint the tree
var column = treeBoxObject.columns["SelectValCol"]; var column = theTree.columns["SelectValCol"];
treeBoxObject.invalidateCell(treeSelection.currentIndex, column); theTree.invalidateCell(treeSelection.currentIndex, column);
} }
function onSelectMultipleClick() function onSelectMultipleClick()
@ -738,7 +738,7 @@ function onSelectMultipleClick()
function selectTreeIndex(index, focus) function selectTreeIndex(index, focus)
{ {
treeSelection.select(index); treeSelection.select(index);
treeBoxObject.ensureRowIsVisible(index); theTree.ensureRowIsVisible(index);
if (focus) if (focus)
gDialog.tree.focus(); gDialog.tree.focus();
} }

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

@ -104,7 +104,7 @@ function InitDialog()
var index = gCharsetInfo.map(info => info.value).indexOf(gCharset); var index = gCharsetInfo.map(info => info.value).indexOf(gCharset);
if (index >= 0) { if (index >= 0) {
tree.view.selection.select(index); tree.view.selection.select(index);
tree.treeBoxObject.ensureRowIsVisible(index); tree.ensureRowIsVisible(index);
} }
} }

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

@ -233,7 +233,6 @@ function searchOnLoad() {
gFolderDisplay.messenger = messenger; gFolderDisplay.messenger = messenger;
gFolderDisplay.msgWindow = msgWindow; gFolderDisplay.msgWindow = msgWindow;
gFolderDisplay.tree = document.getElementById("threadTree"); gFolderDisplay.tree = document.getElementById("threadTree");
gFolderDisplay.treeBox = gFolderDisplay.tree.boxObject;
gFolderDisplay.view.openSearchView(); gFolderDisplay.view.openSearchView();
gFolderDisplay.makeActive(); gFolderDisplay.makeActive();

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

@ -111,12 +111,6 @@ function FolderDisplayWidget(aTabInfo, aMessageDisplayWidget) {
* responsible for setting this. * responsible for setting this.
*/ */
this.tree = null; this.tree = null;
/**
* The nsITreeBoxObject on the XUL tree node, accessible from this.tree as
* this.tree.boxObject and QueryInterfaced as such. The caller is
* responsible for setting this.
*/
this.treeBox = null;
/** /**
* The nsIMsgWindow corresponding to the window that holds us. There is only * The nsIMsgWindow corresponding to the window that holds us. There is only
@ -177,19 +171,19 @@ function FolderDisplayWidget(aTabInfo, aMessageDisplayWidget) {
}); });
/** /**
* Create a fake tree box object for if/when this folder is in the background. * Create a fake tree object for if/when this folder is in the background.
* We need to give it a DOM object to send events to, including the onselect * We need to give it a DOM object to send events to, including the onselect
* event we care about and for which we added a handler above, and all the * event we care about and for which we added a handler above, and all the
* other events we don't care about. * other events we don't care about.
*/ */
this._fakeTreeBox = new FakeTreeBoxObject(domNode); this._fakeTree = new FakeTree(domNode);
/** /**
* Create a fake tree selection for cases where we have opened a background * Create a fake tree selection for cases where we have opened a background
* tab. We'll get rid of this as soon as we've switched to the tab for the * tab. We'll get rid of this as soon as we've switched to the tab for the
* first time, and have a real tree selection. * first time, and have a real tree selection.
*/ */
this._fakeTreeSelection = new JSTreeSelection(this._fakeTreeBox); this._fakeTreeSelection = new JSTreeSelection(this._fakeTree);
this._mostRecentSelectionCounts = []; this._mostRecentSelectionCounts = [];
this._mostRecentCurrentIndices = []; this._mostRecentCurrentIndices = [];
@ -832,7 +826,7 @@ FolderDisplayWidget.prototype = {
this.view.close(); this.view.close();
this.messenger.setWindow(null, null); this.messenger.setWindow(null, null);
this.messenger = null; this.messenger = null;
this._fakeTreeBox = null; this._fakeTree = null;
this._fakeTreeSelection = null; this._fakeTreeSelection = null;
}, },
// @} // @}
@ -944,8 +938,8 @@ FolderDisplayWidget.prototype = {
this._updateThreadDisplay(); this._updateThreadDisplay();
// this creates a new selection object for the view. // this creates a new selection object for the view.
if (this.treeBox) if (this.tree)
this.treeBox.view = this.view.dbView; this.tree.view = this.view.dbView;
FolderDisplayListenerManager._fireListeners("onActiveCreatedView", FolderDisplayListenerManager._fireListeners("onActiveCreatedView",
[this]); [this]);
@ -1636,9 +1630,9 @@ FolderDisplayWidget.prototype = {
// some things only need to happen if we are transitioning from inactive // some things only need to happen if we are transitioning from inactive
// to active // to active
if (wasInactive) { if (wasInactive) {
if (this.treeBox) { if (this.tree) {
// We might have assigned our JS tree selection to // We might have assigned our JS tree selection to
// this.view.dbView.selection back in _hookUpFakeTreeBox. If we've // this.view.dbView.selection back in _hookUpFakeTree. If we've
// done so, null the selection out so that the line after this // done so, null the selection out so that the line after this
// causes a real selection to be created. // causes a real selection to be created.
// If we haven't done so, we're fine as selection would be null here // If we haven't done so, we're fine as selection would be null here
@ -1652,11 +1646,11 @@ FolderDisplayWidget.prototype = {
// out its view so that it won't try and clean up any views or their // out its view so that it won't try and clean up any views or their
// selections. (The actual actions happen in // selections. (The actual actions happen in
// nsTreeBodyFrame::SetView) // nsTreeBodyFrame::SetView)
// - this.view.dbView.selection.tree = this.treeBox // - this.view.dbView.selection.tree = this.tree
// - this.view.dbView.setTree(this.treeBox) // - this.view.dbView.setTree(this.tree)
// - this.treeBox.view = this.view.dbView (in // - this.tree.view = this.view.dbView (in
// nsTreeBodyObject::SetView) // nsTreeBodyObject::SetView)
this.treeBox.view = this.view.dbView; this.tree.view = this.view.dbView;
if (fakeTreeSelection) { if (fakeTreeSelection) {
fakeTreeSelection.duplicateSelection(this.view.dbView.selection); fakeTreeSelection.duplicateSelection(this.view.dbView.selection);
@ -1665,7 +1659,7 @@ FolderDisplayWidget.prototype = {
dontReloadMessage = true; dontReloadMessage = true;
} }
if (this._savedFirstVisibleRow != null) if (this._savedFirstVisibleRow != null)
this.treeBox.scrollToRow(this._savedFirstVisibleRow); this.tree.scrollToRow(this._savedFirstVisibleRow);
} }
} }
@ -1738,14 +1732,14 @@ FolderDisplayWidget.prototype = {
!document.getElementById("folderPaneBox").collapsed; !document.getElementById("folderPaneBox").collapsed;
if (this.view.dbView) { if (this.view.dbView) {
if (this.treeBox) if (this.tree)
this._savedFirstVisibleRow = this.treeBox.getFirstVisibleRow(); this._savedFirstVisibleRow = this.tree.getFirstVisibleRow();
// save the message pane's state only when it is potentially visible // save the message pane's state only when it is potentially visible
this.messagePaneCollapsed = this.messagePaneCollapsed =
document.getElementById("messagepaneboxwrapper").collapsed; document.getElementById("messagepaneboxwrapper").collapsed;
this.hookUpFakeTreeBox(true); this.hookUpFakeTree(true);
} }
this.messageDisplay.makeInactive(); this.messageDisplay.makeInactive();
@ -1762,7 +1756,7 @@ FolderDisplayWidget.prototype = {
* tab, for example. * tab, for example.
* @private * @private
*/ */
hookUpFakeTreeBox(aNullRealTreeBoxView) { hookUpFakeTree(aNullRealTreeBoxView) {
// save off the tree selection object. the nsTreeBodyFrame will make the // save off the tree selection object. the nsTreeBodyFrame will make the
// view forget about it when our view is removed, so it's up to us to // view forget about it when our view is removed, so it's up to us to
// save it. // save it.
@ -1772,15 +1766,15 @@ FolderDisplayWidget.prototype = {
// if we want to, make the tree forget about the view right now so we can // if we want to, make the tree forget about the view right now so we can
// tell the db view about its selection object so it can try and keep it // tell the db view about its selection object so it can try and keep it
// up-to-date even while hidden in the background // up-to-date even while hidden in the background
if (aNullRealTreeBoxView && this.treeBox) if (aNullRealTreeBoxView && this.tree)
this.treeBox.view = null; this.tree.view = null;
// (and tell the db view about its selection again...) // (and tell the db view about its selection again...)
this.view.dbView.selection = treeSelection; this.view.dbView.selection = treeSelection;
// hook the dbview up to the fake tree box // hook the dbview up to the fake tree box
this._fakeTreeBox.view = this.view.dbView; this._fakeTree.view = this.view.dbView;
this.view.dbView.setTree(this._fakeTreeBox); this.view.dbView.setTree(this._fakeTree);
treeSelection.tree = this._fakeTreeBox; treeSelection.tree = this._fakeTree;
}, },
/** /**
@ -2405,7 +2399,7 @@ FolderDisplayWidget.prototype = {
// If we can get the height of the folder pane, treat the values as // If we can get the height of the folder pane, treat the values as
// percentages of that. // percentages of that.
if (this.treeBox) { if (this.tree) {
let topPercentPadding = Services.prefs.getIntPref( let topPercentPadding = Services.prefs.getIntPref(
"mail.threadpane.padding.top_percent"); "mail.threadpane.padding.top_percent");
let bottomPercentPadding = Services.prefs.getIntPref( let bottomPercentPadding = Services.prefs.getIntPref(
@ -2413,7 +2407,7 @@ FolderDisplayWidget.prototype = {
// Assume the bottom row is half-visible and should generally be ignored. // Assume the bottom row is half-visible and should generally be ignored.
// (We could actually do the legwork to see if there is a partial one...) // (We could actually do the legwork to see if there is a partial one...)
let paneHeight = this.treeBox.getPageLength() - 1; let paneHeight = this.tree.getPageLength() - 1;
// Convert from percentages to absolute row counts. // Convert from percentages to absolute row counts.
topPadding = Math.ceil((topPercentPadding / 100) * paneHeight); topPadding = Math.ceil((topPercentPadding / 100) * paneHeight);
@ -2461,21 +2455,21 @@ FolderDisplayWidget.prototype = {
}, 0); }, 0);
} }
let treeBox = this.treeBox; let tree = this.tree;
if (!treeBox || !treeBox.view) if (!tree || !tree.view)
return; return;
// try and trigger a reflow... // try and trigger a reflow...
treeBox.height; tree.height;
let maxIndex = treeBox.view.rowCount - 1; let maxIndex = tree.view.rowCount - 1;
let first = treeBox.getFirstVisibleRow(); let first = tree.getFirstVisibleRow();
// Assume the bottom row is half-visible and should generally be ignored. // Assume the bottom row is half-visible and should generally be ignored.
// (We could actually do the legwork to see if there is a partial one...) // (We could actually do the legwork to see if there is a partial one...)
const halfVisible = 1; const halfVisible = 1;
let last = treeBox.getLastVisibleRow() - halfVisible; let last = tree.getLastVisibleRow() - halfVisible;
let span = treeBox.getPageLength() - halfVisible; let span = tree.getPageLength() - halfVisible;
let [topPadding, bottomPadding] = this.visibleRowPadding; let [topPadding, bottomPadding] = this.visibleRowPadding;
let target; let target;
@ -2490,7 +2484,7 @@ FolderDisplayWidget.prototype = {
return; return;
// this sets the first visible row // this sets the first visible row
treeBox.scrollToRow(target); tree.scrollToRow(target);
}, },
/** /**
@ -2517,13 +2511,13 @@ FolderDisplayWidget.prototype = {
}, 0); }, 0);
} }
let treeBox = this.treeBox; let tree = this.tree;
if (!treeBox) if (!tree)
return; return;
let first = treeBox.getFirstVisibleRow(); let first = tree.getFirstVisibleRow();
const halfVisible = 1; const halfVisible = 1;
let last = treeBox.getLastVisibleRow() - halfVisible; let last = tree.getLastVisibleRow() - halfVisible;
let span = treeBox.getPageLength() - halfVisible; let span = tree.getPageLength() - halfVisible;
let [topPadding, bottomPadding] = this.visibleRowPadding; let [topPadding, bottomPadding] = this.visibleRowPadding;
// bail if the range is already visible with padding constraints handled // bail if the range is already visible with padding constraints handled
@ -2543,7 +2537,7 @@ FolderDisplayWidget.prototype = {
let halfSpare = Math.floor((span - rowSpan - topPadding - bottomPadding) / 2); let halfSpare = Math.floor((span - rowSpan - topPadding - bottomPadding) / 2);
target = aMinRow - halfSpare - topPadding; target = aMinRow - halfSpare - topPadding;
} }
treeBox.scrollToRow(target); tree.scrollToRow(target);
}, },
/** /**
@ -2585,11 +2579,11 @@ FolderDisplayWidget.prototype = {
* an event listener for onselect already attached), and pass its boxObject in * an event listener for onselect already attached), and pass its boxObject in
* whenever nsTreeSelection QIs us to nsIBoxObject. * whenever nsTreeSelection QIs us to nsIBoxObject.
*/ */
function FakeTreeBoxObject(aDOMNode) { function FakeTree(aDOMNode) {
this.domNode = aDOMNode; this.domNode = aDOMNode;
this.view = null; this.view = null;
} }
FakeTreeBoxObject.prototype = { FakeTree.prototype = {
view: null, view: null,
ensureRowIsVisible() { ensureRowIsVisible() {
// NOP // NOP
@ -2660,7 +2654,7 @@ FakeTreeBoxObject.prototype = {
return this.domNode.boxObject.removeProperty(propertyName); return this.domNode.boxObject.removeProperty(propertyName);
}, },
QueryInterface: ChromeUtils.generateQI(["nsIBoxObject", QueryInterface: ChromeUtils.generateQI(["nsIBoxObject",
"nsITreeBoxObject"]), "XULTreeElement"]),
}; };
/* /*
* Provide attribute and function implementations that complain very loudly if * Provide attribute and function implementations that complain very loudly if
@ -2697,7 +2691,7 @@ function FTBO_stubOutMethods(aObj, aMethodNames) {
}; };
} }
} }
FTBO_stubOutAttributes(FakeTreeBoxObject.prototype, [ FTBO_stubOutAttributes(FakeTree.prototype, [
"columns", "columns",
"focused", "focused",
"treeBody", "treeBody",
@ -2706,7 +2700,7 @@ FTBO_stubOutAttributes(FakeTreeBoxObject.prototype, [
"horizontalPosition", "horizontalPosition",
"selectionRegion", "selectionRegion",
]); ]);
FTBO_stubOutMethods(FakeTreeBoxObject.prototype, [ FTBO_stubOutMethods(FakeTree.prototype, [
"getFirstVisibleRow", "getFirstVisibleRow",
"getLastVisibleRow", "getLastVisibleRow",
"getPageLength", "getPageLength",

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

@ -267,8 +267,7 @@ var gFolderTreeView = {
aEvent.originalTarget.localName == "scrollbarbutton") aEvent.originalTarget.localName == "scrollbarbutton")
return; return;
let row = gFolderTreeView._treeElement.treeBoxObject.getRowAt(aEvent.clientX, let row = gFolderTreeView._treeElement.getRowAt(aEvent.clientX, aEvent.clientY);
aEvent.clientY);
let folderItem = gFolderTreeView._rowMap[row]; let folderItem = gFolderTreeView._rowMap[row];
if (folderItem) if (folderItem)
folderItem.command(); folderItem.command();
@ -278,7 +277,7 @@ var gFolderTreeView = {
}, },
getFolderAtCoords(aX, aY) { getFolderAtCoords(aX, aY) {
let row = gFolderTreeView._treeElement.treeBoxObject.getRowAt(aX, aY); let row = gFolderTreeView._treeElement.getRowAt(aX, aY);
if (row in gFolderTreeView._rowMap) if (row in gFolderTreeView._rowMap)
return gFolderTreeView._rowMap[row]._folder; return gFolderTreeView._rowMap[row]._folder;
return null; return null;
@ -574,7 +573,7 @@ var gFolderTreeView = {
} }
this.selection.select(folderIndex); this.selection.select(folderIndex);
this._treeElement.treeBoxObject.ensureRowIsVisible(folderIndex); this._treeElement.ensureRowIsVisible(folderIndex);
return true; return true;
}, },

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

@ -206,16 +206,15 @@ class MozFolderTooltip extends MozFolderSummary {
return true; return true;
} }
let row = {}, col = {}; let treeCellInfo = gFolderTreeView._tree.getCellAt(event.clientX, event.clientY);
gFolderTreeView._tree.getCellAt(event.clientX, event.clientY, row, col, {}); if (treeCellInfo.col.id == "folderNameCol") {
if (col.value.id == "folderNameCol") { let cropped = gFolderTreeView._tree.isCellCropped(treeCellInfo.row, treeCellInfo.col);
let cropped = gFolderTreeView._tree.isCellCropped(row.value, col.value);
if (this._addLocationInfo(msgFolder, cropped, tooltipnode)) { if (this._addLocationInfo(msgFolder, cropped, tooltipnode)) {
return true; return true;
} }
} }
let counts = gFolderTreeView.getSummarizedCounts(row.value, col.value.id); let counts = gFolderTreeView.getSummarizedCounts(treeCellInfo.row, treeCellInfo.col.id);
return this._addSummarizeExplain(counts, tooltipnode); return this._addSummarizeExplain(counts, tooltipnode);
} }

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

@ -306,8 +306,7 @@ function ComposeMessage(type, format, folder, messageArray) {
function NewMessageToSelectedAddresses(type, format, identity) { function NewMessageToSelectedAddresses(type, format, identity) {
var abSidebarPanel = document.commandDispatcher.focusedWindow; var abSidebarPanel = document.commandDispatcher.focusedWindow;
var abResultsTree = abSidebarPanel.document.getElementById("abResultsTree"); var abResultsTree = abSidebarPanel.document.getElementById("abResultsTree");
var abResultsBoxObject = abResultsTree.treeBoxObject; var abView = abResultsTree.view;
var abView = abResultsBoxObject.view;
abView = abView.QueryInterface(Ci.nsIAbView); abView = abView.QueryInterface(Ci.nsIAbView);
var addresses = abView.selectedAddresses; var addresses = abView.selectedAddresses;
var params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams); var params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);

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

@ -34,7 +34,7 @@ function RestoreSelectionWithoutContentLoad(tree) {
gRightMouseButtonSavedSelection = null; gRightMouseButtonSavedSelection = null;
if (tree) if (tree)
tree.treeBoxObject.invalidate(); tree.invalidate();
UpdateMailToolbar("RestoreSelectionWithoutContentLoad"); UpdateMailToolbar("RestoreSelectionWithoutContentLoad");
} }
@ -66,7 +66,7 @@ function fillMailContextMenu(event) {
// No menu on grouped header row currently, any command would be an implied // No menu on grouped header row currently, any command would be an implied
// multiselect. // multiselect.
if (gFolderDisplay.tree) { if (gFolderDisplay.tree) {
let row = gFolderDisplay.treeBox.getRowAt(event.clientX, event.clientY); let row = gFolderDisplay.tree.getRowAt(event.clientX, event.clientY);
if (gFolderDisplay.view.isGroupedByHeaderAtIndex(row)) { if (gFolderDisplay.view.isGroupedByHeaderAtIndex(row)) {
RestoreSelectionWithoutContentLoad(gFolderDisplay.tree); RestoreSelectionWithoutContentLoad(gFolderDisplay.tree);
return false; return false;
@ -228,7 +228,7 @@ function OpenMessageByHeader(messageHeader, openInNewWindow) {
} }
if (tree && tree.currentIndex != -1) if (tree && tree.currentIndex != -1)
tree.treeBoxObject.ensureRowIsVisible(tree.currentIndex); tree.ensureRowIsVisible(tree.currentIndex);
} }
} }

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

@ -358,7 +358,7 @@ var mailTabType = {
} else { } else {
// We don't want to null out the real tree box view, as that // We don't want to null out the real tree box view, as that
// corresponds to the _current_ tab, not the new one // corresponds to the _current_ tab, not the new one
aTab.folderDisplay.hookUpFakeTreeBox(false); aTab.folderDisplay.hookUpFakeTree(false);
} }
}, },
persistTab(aTab) { persistTab(aTab) {
@ -499,7 +499,6 @@ var mailTabType = {
aTab.folderDisplay = new FolderDisplayWidget(aTab, aTab.messageDisplay); aTab.folderDisplay = new FolderDisplayWidget(aTab, aTab.messageDisplay);
aTab.folderDisplay.msgWindow = msgWindow; aTab.folderDisplay.msgWindow = msgWindow;
aTab.folderDisplay.tree = document.getElementById("threadTree"); aTab.folderDisplay.tree = document.getElementById("threadTree");
aTab.folderDisplay.treeBox = aTab.folderDisplay.tree.boxObject;
aTab.folderDisplay.folderPaneVisible = aFolderPaneVisible; aTab.folderDisplay.folderPaneVisible = aFolderPaneVisible;
if (aIsFirstTab) { if (aIsFirstTab) {

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

@ -1835,10 +1835,9 @@
<parameter name="event"/> <parameter name="event"/>
<body> <body>
<![CDATA[ <![CDATA[
var box = this.tree.treeBoxObject; if (event.originalTarget == this.tree.treeBody) {
if (event.originalTarget == box.treeBody) { var index = this.tree.getRowAt(event.clientX, event.clientY);
var index = box.getRowAt(event.clientX, event.clientY); this.tree.view.selection.select(index);
box.view.selection.select(index);
return index; return index;
} }
return -1; return -1;
@ -1870,17 +1869,16 @@
self: this, self: this,
tree: this.tree, tree: this.tree,
parentNode: this.parentNode, parentNode: this.parentNode,
getLastVisibleRow(box) { getLastVisibleRow(tree) {
var f = box.getFirstVisibleRow(); var f = tree.getFirstVisibleRow();
var p = box.getPageLength(); var p = tree.getPageLength();
var l = box.view.rowCount; var l = tree.view.rowCount;
return (l < f + p ? l : f + p) - 1; return (l < f + p ? l : f + p) - 1;
}, },
handleEvent(event) { handleEvent(event) {
if (event.altKey) if (event.altKey)
return; return;
var index; var index;
var box = this.tree.treeBoxObject;
if (this.parentNode.hasAttribute("open")) { if (this.parentNode.hasAttribute("open")) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@ -1909,24 +1907,24 @@
break; break;
case event.DOM_VK_DOWN: case event.DOM_VK_DOWN:
index++; index++;
if (index == box.view.rowCount) if (index == this.tree.view.rowCount)
return; return;
break; break;
case event.DOM_VK_PAGE_UP: case event.DOM_VK_PAGE_UP:
if (index == box.getFirstVisibleRow()) if (index == this.tree.getFirstVisibleRow())
box.scrollByPages(-1); this.tree.scrollByPages(-1);
index = box.getFirstVisibleRow(); index = this.tree.getFirstVisibleRow();
break; break;
case event.DOM_VK_PAGE_DOWN: case event.DOM_VK_PAGE_DOWN:
if (index == this.getLastVisibleRow(box)) if (index == this.getLastVisibleRow(this.tree))
box.scrollByPages(1); this.tree.scrollByPages(1);
index = this.getLastVisibleRow(box); index = this.getLastVisibleRow(this.tree);
break; break;
case event.DOM_VK_HOME: case event.DOM_VK_HOME:
index = 0; index = 0;
break; break;
case event.DOM_VK_END: case event.DOM_VK_END:
index = box.view.rowCount - 1; index = this.tree.view.rowCount - 1;
break; break;
default: default:
if (event.charCode > 0 && !event.ctrlKey && !event.metaKey) { if (event.charCode > 0 && !event.ctrlKey && !event.metaKey) {
@ -1937,9 +1935,9 @@
} }
return; return;
} }
box.view.selection.select(index); this.tree.view.selection.select(index);
if (this.parentNode.hasAttribute("open")) if (this.parentNode.hasAttribute("open"))
box.ensureRowIsVisible(index); this.tree.ensureRowIsVisible(index);
else else
this.self.fire(); this.self.fire();
}, },
@ -1996,14 +1994,13 @@
<handler event="popupshowing"> <handler event="popupshowing">
<![CDATA[ <![CDATA[
this.parentNode.addEventListener("blur", this.onBlurMenuList); this.parentNode.addEventListener("blur", this.onBlurMenuList);
var box = this.tree.treeBoxObject; this.tree.focused = true;
box.focused = true;
var index = this.setInitialSelection(); var index = this.setInitialSelection();
var height = box.view.rowCount * box.rowHeight; var height = this.tree.view.rowCount * this.tree.rowHeight;
height += this.boxObject.height - box.treeBody.boxObject.height; height += this.boxObject.height - this.tree.treeBody.boxObject.height;
this.height = height; this.height = height;
if (index >= 0) if (index >= 0)
setTimeout(function() { box.ensureRowIsVisible(index); }, 0); setTimeout(function() { this.tree.ensureRowIsVisible(index); }, 0);
]]> ]]>
</handler> </handler>
<handler event="popuphiding"> <handler event="popuphiding">

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

@ -91,7 +91,7 @@ StandaloneFolderDisplayWidget.prototype = {
* the fake tree box so it will actually do something in NoteChange. * the fake tree box so it will actually do something in NoteChange.
*/ */
onCreatedView() { onCreatedView() {
this._fakeTreeBox.view = this.view.dbView; this._fakeTree.view = this.view.dbView;
// Need to clear out this reference later. // Need to clear out this reference later.
this._magicTreeSelection.view = this.view.dbView; this._magicTreeSelection.view = this.view.dbView;
@ -102,7 +102,7 @@ StandaloneFolderDisplayWidget.prototype = {
// showing an .eml file to go to a real message, at least in terms of // showing an .eml file to go to a real message, at least in terms of
// having the selection object properly associated with the tree. // having the selection object properly associated with the tree.
if (!this.messageDisplay.isDummy) { if (!this.messageDisplay.isDummy) {
this.view.dbView.setTree(this._fakeTreeBox); this.view.dbView.setTree(this._fakeTree);
this.view.dbView.selection = this._magicTreeSelection; this.view.dbView.selection = this._magicTreeSelection;
// This lets the dbView know we don't really have a tree, so it can // This lets the dbView know we don't really have a tree, so it can
// avoid operating on messages in collapsed threads. // avoid operating on messages in collapsed threads.

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

@ -397,7 +397,7 @@ var MailPrefObserver = {
++currentDisplayNameVersion); ++currentDisplayNameVersion);
// refresh the thread pane // refresh the thread pane
threadTree.treeBoxObject.invalidate(); threadTree.invalidate();
} }
} }
}, },
@ -1075,15 +1075,10 @@ function ClearMessagePane() {
* aSingleSelect then we create a transient single-row selection. * aSingleSelect then we create a transient single-row selection.
*/ */
function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) { function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) {
var treeBoxObj = tree.treeBoxObject;
if (!treeBoxObj) {
event.stopPropagation();
return;
}
var treeSelection = treeBoxObj.view.selection; var treeSelection = tree.view.selection;
var row = treeBoxObj.getRowAt(event.clientX, event.clientY); var row = tree.getRowAt(event.clientX, event.clientY);
// Only do something if: // Only do something if:
// - the row is valid // - the row is valid
// - it's not already selected (or we want a single selection) // - it's not already selected (or we want a single selection)
@ -1100,12 +1095,12 @@ function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) {
} }
} }
let transientSelection = new JSTreeSelection(treeBoxObj); let transientSelection = new JSTreeSelection(tree);
transientSelection.logAdjustSelectionForReplay(); transientSelection.logAdjustSelectionForReplay();
gRightMouseButtonSavedSelection = { gRightMouseButtonSavedSelection = {
// Need to clear out this reference later. // Need to clear out this reference later.
view: treeBoxObj.view, view: tree.view,
realSelection: treeSelection, realSelection: treeSelection,
transientSelection, transientSelection,
}; };
@ -1114,14 +1109,14 @@ function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) {
// tell it to log calls to adjustSelection // tell it to log calls to adjustSelection
// attach it to the view // attach it to the view
treeBoxObj.view.selection = transientSelection; tree.view.selection = transientSelection;
// Don't generate any selection events! (we never set this to false, because // Don't generate any selection events! (we never set this to false, because
// that would generate an event, and we never need one of those from this // that would generate an event, and we never need one of those from this
// selection object. // selection object.
transientSelection.selectEventsSuppressed = true; transientSelection.selectEventsSuppressed = true;
transientSelection.select(row); transientSelection.select(row);
transientSelection.currentIndex = saveCurrentIndex; transientSelection.currentIndex = saveCurrentIndex;
treeBoxObj.ensureRowIsVisible(row); tree.ensureRowIsVisible(row);
} }
event.stopPropagation(); event.stopPropagation();
} }
@ -1154,11 +1149,8 @@ function FolderPaneOnClick(event) {
FolderPaneContextMenuNewTab(event); FolderPaneContextMenuNewTab(event);
RestoreSelectionWithoutContentLoad(folderTree); RestoreSelectionWithoutContentLoad(folderTree);
} else if (event.button == 0) { } else if (event.button == 0) {
var row = {}; var treeCellInfo = folderTree.getCellAt(event.clientX, event.clientY);
var col = {}; if (treeCellInfo.row == -1) {
var elt = {};
folderTree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, elt);
if (row.value == -1) {
if (event.originalTarget.localName == "treecol") { if (event.originalTarget.localName == "treecol") {
// clicking on the name column in the folder pane should not sort // clicking on the name column in the folder pane should not sort
event.stopPropagation(); event.stopPropagation();

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

@ -32,28 +32,25 @@ function ThreadPaneOnClick(event) {
if (t.localName != "treechildren") if (t.localName != "treechildren")
return; return;
let row = {};
let col = {};
let elt = {};
let tree = GetThreadTree(); let tree = GetThreadTree();
// Figure out what cell the click was in. // Figure out what cell the click was in.
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, elt); let treeCellInfo = tree.getCellAt(event.clientX, event.clientY);
if (row.value == -1) if (treeCellInfo.row == -1)
return; return;
// Grouped By Sort dummy header row non cycler column doubleclick toggles the // Grouped By Sort dummy header row non cycler column doubleclick toggles the
// thread's open/close state; tree.xml handles it. Cyclers are not currently // thread's open/close state; tree.xml handles it. Cyclers are not currently
// implemented in group header rows, a click/doubleclick there should // implemented in group header rows, a click/doubleclick there should
// select/toggle thread state. // select/toggle thread state.
if (gFolderDisplay.view.isGroupedByHeaderAtIndex(row.value)) { if (gFolderDisplay.view.isGroupedByHeaderAtIndex(treeCellInfo.row)) {
if (!col.value.cycler) if (!treeCellInfo.col.cycler)
return; return;
if (event.detail == 1) if (event.detail == 1)
gFolderDisplay.selectViewIndex(row.value); gFolderDisplay.selectViewIndex(treeCellInfo.row);
if (event.detail == 2) if (event.detail == 2)
gFolderDisplay.view.dbView.toggleOpenState(row.value); gFolderDisplay.view.dbView.toggleOpenState(treeCellInfo.row);
event.stopPropagation(); event.stopPropagation();
return; return;
@ -61,16 +58,16 @@ function ThreadPaneOnClick(event) {
// If the cell is in a cycler column or if the user doubleclicked on the // If the cell is in a cycler column or if the user doubleclicked on the
// twisty, don't open the message in a new window. // twisty, don't open the message in a new window.
if (event.detail == 2 && !col.value.cycler && elt.value != "twisty") { if (event.detail == 2 && !treeCellInfo.col.cycler && treeCellInfo.childElt != "twisty") {
ThreadPaneDoubleClick(); ThreadPaneDoubleClick();
// Doubleclicking should not toggle the open/close state of the thread. // Doubleclicking should not toggle the open/close state of the thread.
// This will happen if we don't prevent the event from bubbling to the // This will happen if we don't prevent the event from bubbling to the
// default handler in tree.xml. // default handler in tree.xml.
event.stopPropagation(); event.stopPropagation();
} else if (col.value.id == "junkStatusCol") { } else if (treeCellInfo.col.id == "junkStatusCol") {
MsgJunkMailInfo(true); MsgJunkMailInfo(true);
} else if (col.value.id == "threadCol" && !event.shiftKey && (event.ctrlKey || event.metaKey)) { } else if (treeCellInfo.col.id == "threadCol" && !event.shiftKey && (event.ctrlKey || event.metaKey)) {
gDBView.ExpandAndSelectThreadByIndex(row.value, true); gDBView.ExpandAndSelectThreadByIndex(treeCellInfo.row, true);
event.stopPropagation(); event.stopPropagation();
} }
} }

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

@ -631,7 +631,7 @@ function DirPaneDoubleClick(event) {
return; return;
// Ignore double clicking on invalid rows. // Ignore double clicking on invalid rows.
let row = gDirTree.treeBoxObject.getRowAt(event.clientX, event.clientY); let row = gDirTree.getRowAt(event.clientX, event.clientY);
if (row == -1 || row > gDirTree.view.rowCount - 1) if (row == -1 || row > gDirTree.view.rowCount - 1)
return; return;

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

@ -75,7 +75,7 @@ function contactsListOnClick(aEvent) {
} }
// Any click on gAbResultsTree view (rows or blank space). // Any click on gAbResultsTree view (rows or blank space).
if (target.localName == "treechildren") { if (target.localName == "treechildren") {
let row = gAbResultsTree.treeBoxObject.getRowAt(aEvent.clientX, aEvent.clientY); let row = gAbResultsTree.getRowAt(aEvent.clientX, aEvent.clientY);
if (row < 0 || row >= gAbResultsTree.view.rowCount) { if (row < 0 || row >= gAbResultsTree.view.rowCount) {
// Any click on results tree whitespace. // Any click on results tree whitespace.
if ((aEvent.detail == 1 && aEvent.button == 0) || aEvent.button == 2) { if ((aEvent.detail == 1 && aEvent.button == 0) || aEvent.button == 2) {

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

@ -5,7 +5,7 @@
let gAccount, gFolders; let gAccount, gFolders;
function treeClick(tree, row, column, event) { function treeClick(tree, row, column, event) {
let coords = tree.treeBoxObject.getCoordsForCellItem(row, tree.columns[column], "cell"); let coords = tree.getCoordsForCellItem(row, tree.columns[column], "cell");
let treeChildren = tree.lastElementChild; let treeChildren = tree.lastElementChild;
EventUtils.synthesizeMouse( EventUtils.synthesizeMouse(
treeChildren, treeChildren,

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

@ -482,7 +482,7 @@ var chatHandler = {
if (!treeView.isContainer(index) && if (!treeView.isContainer(index) &&
treeView._rowMap[index].log.time == logTime) { treeView._rowMap[index].log.time == logTime) {
logTree.view.selection.select(index); logTree.view.selection.select(index);
logTree.treeBoxObject.ensureRowIsVisible(index); logTree.ensureRowIsVisible(index);
return true; return true;
} }
if (!treeView._rowMap[index].children.some(i => i.log.time == logTime)) if (!treeView._rowMap[index].children.some(i => i.log.time == logTime))
@ -494,7 +494,7 @@ var chatHandler = {
++index; ++index;
if (treeView._rowMap[index].log.time == logTime) { if (treeView._rowMap[index].log.time == logTime) {
logTree.view.selection.select(index); logTree.view.selection.select(index);
logTree.treeBoxObject.ensureRowIsVisible(index); logTree.ensureRowIsVisible(index);
} }
return true; return true;
} }

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

@ -37,7 +37,7 @@ var gCookiesWindow = {
_populateList(aInitialLoad) { _populateList(aInitialLoad) {
this._loadCookies(); this._loadCookies();
this._tree.treeBoxObject.view = this._view; this._tree.view = this._view;
if (aInitialLoad) if (aInitialLoad)
this.sort("rawHost"); this.sort("rawHost");
if (this._view.rowCount > 0) if (this._view.rowCount > 0)
@ -79,7 +79,7 @@ var gCookiesWindow = {
var oldRowCount = this._view._rowCount; var oldRowCount = this._view._rowCount;
this._view._rowCount = 0; this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -oldRowCount); this._tree.rowCountChanged(0, -oldRowCount);
this._view.selection.clearSelection(); this._view.selection.clearSelection();
} else if (aData == "reload") { } else if (aData == "reload") {
// first, clear any existing entries // first, clear any existing entries
@ -137,7 +137,7 @@ var gCookiesWindow = {
} }
// Make sure the tree display is up to date... // Make sure the tree display is up to date...
this._tree.treeBoxObject.invalidateRow(rowIndex); this._tree.invalidateRow(rowIndex);
// ... and if the cookie is selected, update the displayed metadata too // ... and if the cookie is selected, update the displayed metadata too
if (cookieItem != null && this._view.selection.currentIndex == rowIndex) if (cookieItem != null && this._view.selection.currentIndex == rowIndex)
this._updateCookieData(cookieItem); this._updateCookieData(cookieItem);
@ -166,7 +166,7 @@ var gCookiesWindow = {
// if any to get the position correct.) // if any to get the position correct.)
var oldRowCount = this._rowCount; var oldRowCount = this._rowCount;
this._view._rowCount += rowCountImpact; this._view._rowCount += rowCountImpact;
this._tree.treeBoxObject.rowCountChanged(oldRowCount - 1, rowCountImpact); this._tree.rowCountChanged(oldRowCount - 1, rowCountImpact);
document.getElementById("removeAllCookies").disabled = this._view._filtered; document.getElementById("removeAllCookies").disabled = this._view._filtered;
}, },
@ -403,8 +403,8 @@ var gCookiesWindow = {
var delta = multiplier * item.cookies.length; var delta = multiplier * item.cookies.length;
this._rowCount += delta; this._rowCount += delta;
item.open = !item.open; item.open = !item.open;
gCookiesWindow._tree.treeBoxObject.rowCountChanged(aIndex + 1, delta); gCookiesWindow._tree.rowCountChanged(aIndex + 1, delta);
gCookiesWindow._tree.treeBoxObject.invalidateRow(aIndex); gCookiesWindow._tree.invalidateRow(aIndex);
} }
}, },
cycleHeader(aColumn) {}, cycleHeader(aColumn) {},
@ -608,7 +608,7 @@ var gCookiesWindow = {
// Before SelectedIndex: 1 Before RowCount: 4 // Before SelectedIndex: 1 Before RowCount: 4
// After SelectedIndex: 1 After RowCount: 3 // After SelectedIndex: 1 After RowCount: 3
var seln = this._view.selection; var seln = this._view.selection;
var tbo = this._tree.treeBoxObject; var tbo = this._tree;
if (seln.count < 1) return; if (seln.count < 1) return;
@ -730,8 +730,8 @@ var gCookiesWindow = {
this._view._invalidateCache(0); this._view._invalidateCache(0);
this._view.selection.clearSelection(); this._view.selection.clearSelection();
this._view.selection.select(0); this._view.selection.select(0);
this._tree.treeBoxObject.invalidate(); this._tree.invalidate();
this._tree.treeBoxObject.ensureRowIsVisible(0); this._tree.ensureRowIsVisible(0);
this._lastSortAscending = ascending; this._lastSortAscending = ascending;
this._lastSortProperty = aProperty; this._lastSortProperty = aProperty;
@ -744,12 +744,12 @@ var gCookiesWindow = {
// Clear the Tree Display // Clear the Tree Display
this._view._filtered = false; this._view._filtered = false;
this._view._rowCount = 0; this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -this._view._filterSet.length); this._tree.rowCountChanged(0, -this._view._filterSet.length);
this._view._filterSet = []; this._view._filterSet = [];
// Just reload the list to make sure deletions are respected // Just reload the list to make sure deletions are respected
this._loadCookies(); this._loadCookies();
this._tree.treeBoxObject.view = this._view; this._tree.view = this._view;
// Restore sort order // Restore sort order
var sortby = this._lastSortProperty; var sortby = this._lastSortProperty;
@ -840,10 +840,10 @@ var gCookiesWindow = {
// Clear the display // Clear the display
var oldCount = view._rowCount; var oldCount = view._rowCount;
view._rowCount = 0; view._rowCount = 0;
gCookiesWindow._tree.treeBoxObject.rowCountChanged(0, -oldCount); gCookiesWindow._tree.rowCountChanged(0, -oldCount);
// Set up the filtered display // Set up the filtered display
view._rowCount = view._filterSet.length; view._rowCount = view._filterSet.length;
gCookiesWindow._tree.treeBoxObject.rowCountChanged(0, view.rowCount); gCookiesWindow._tree.rowCountChanged(0, view.rowCount);
// if the view is not empty then select the first item // if the view is not empty then select the first item
if (view.rowCount > 0) if (view.rowCount > 0)

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

@ -175,13 +175,13 @@ var gPermissionManager = {
if (this._lastPermissionSortColumn == "statusCol") { if (this._lastPermissionSortColumn == "statusCol") {
this._resortPermissions(); this._resortPermissions();
} }
this._tree.treeBoxObject.invalidate(); this._tree.invalidate();
}, },
_addPermission(aPermission) { _addPermission(aPermission) {
this._addPermissionToList(aPermission); this._addPermissionToList(aPermission);
++this._view._rowCount; ++this._view._rowCount;
this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, 1); this._tree.rowCountChanged(this._view.rowCount - 1, 1);
// Re-do the sort, since we inserted this new item at the end. // Re-do the sort, since we inserted this new item at the end.
this._resortPermissions(); this._resortPermissions();
}, },
@ -418,8 +418,8 @@ var gPermissionManager = {
if (this._permissions[i].principal.origin == aPrincipal.origin) { if (this._permissions[i].principal.origin == aPrincipal.origin) {
this._permissions.splice(i, 1); this._permissions.splice(i, 1);
this._view._rowCount--; this._view._rowCount--;
this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, -1); this._tree.rowCountChanged(this._view.rowCount - 1, -1);
this._tree.treeBoxObject.invalidate(); this._tree.invalidate();
break; break;
} }
} }

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

@ -320,12 +320,12 @@ function _middle_click_on_collapsed_thread_root_helper(aBackground) {
let folderTab = mc.tabmail.currentTabInfo; let folderTab = mc.tabmail.currentTabInfo;
let treeBox = mc.threadTree.treeBoxObject; let tree = mc.threadTree;
// Scroll to the top, then to the bottom // Scroll to the top, then to the bottom
treeBox.ensureRowIsVisible(0); tree.ensureRowIsVisible(0);
treeBox.scrollByLines(mc.folderDisplay.view.dbView.rowCount); tree.scrollByLines(mc.folderDisplay.view.dbView.rowCount);
// Note the first visible row // Note the first visible row
let preFirstRow = treeBox.getFirstVisibleRow(); let preFirstRow = tree.getFirstVisibleRow();
// Since reflowing a tree (eg when switching tabs) ensures that the current // Since reflowing a tree (eg when switching tabs) ensures that the current
// index is brought into view, we need to set the current index so that we // index is brought into view, we need to set the current index so that we
@ -344,9 +344,9 @@ function _middle_click_on_collapsed_thread_root_helper(aBackground) {
} }
// Make sure the first visible row is still the same // Make sure the first visible row is still the same
if (treeBox.getFirstVisibleRow() != preFirstRow) if (tree.getFirstVisibleRow() != preFirstRow)
throw new Error("The first visible row should have been " + preFirstRow + throw new Error("The first visible row should have been " + preFirstRow +
", but is actually " + treeBox.getFirstVisibleRow() + "."); ", but is actually " + tree.getFirstVisibleRow() + ".");
close_tab(tabMessage); close_tab(tabMessage);
} }
@ -362,13 +362,13 @@ function _middle_click_on_expanded_thread_root_helper(aBackground) {
let folderTab = mc.tabmail.currentTabInfo; let folderTab = mc.tabmail.currentTabInfo;
let treeBox = mc.threadTree.treeBoxObject; let tree = mc.threadTree;
// Scroll to the top, then to near (but not exactly) the bottom // Scroll to the top, then to near (but not exactly) the bottom
treeBox.ensureRowIsVisible(0); tree.ensureRowIsVisible(0);
treeBox.scrollToRow(mc.folderDisplay.view.dbView.rowCount - tree.scrollToRow(mc.folderDisplay.view.dbView.rowCount -
treeBox.getPageLength() - (NUM_MESSAGES_IN_THREAD / 2)); tree.getPageLength() - (NUM_MESSAGES_IN_THREAD / 2));
// Note the first visible row // Note the first visible row
let preFirstRow = treeBox.getFirstVisibleRow(); let preFirstRow = tree.getFirstVisibleRow();
// Since reflowing a tree (eg when switching tabs) ensures that the current // Since reflowing a tree (eg when switching tabs) ensures that the current
// index is brought into view, we need to set the current index so that we // index is brought into view, we need to set the current index so that we
@ -387,9 +387,9 @@ function _middle_click_on_expanded_thread_root_helper(aBackground) {
} }
// Make sure the first visible row is still the same // Make sure the first visible row is still the same
if (treeBox.getFirstVisibleRow() != preFirstRow) if (tree.getFirstVisibleRow() != preFirstRow)
throw new Error("The first visible row should have been " + preFirstRow + throw new Error("The first visible row should have been " + preFirstRow +
", but is actually " + treeBox.getFirstVisibleRow() + "."); ", but is actually " + tree.getFirstVisibleRow() + ".");
close_tab(tabMessage); close_tab(tabMessage);
} }

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

@ -961,11 +961,11 @@ function click_tree_row(aTree, aRowIndex, aController) {
let selection = aTree.view.selection; let selection = aTree.view.selection;
selection.select(aRowIndex); selection.select(aRowIndex);
aTree.treeBoxObject.ensureRowIsVisible(aRowIndex); aTree.ensureRowIsVisible(aRowIndex);
// get cell coordinates // get cell coordinates
let column = aTree.columns[0]; let column = aTree.columns[0];
let coords = aTree.treeBoxObject.getCoordsForCellItem(aRowIndex, column, "text"); let coords = aTree.getCoordsForCellItem(aRowIndex, column, "text");
aController.sleep(0); aController.sleep(0);
EventUtils.synthesizeMouse(aTree.body, coords.x + 4, coords.y + 4, EventUtils.synthesizeMouse(aTree.body, coords.x + 4, coords.y + 4,
@ -1098,9 +1098,8 @@ function select_shift_click_row(aViewIndex, aController, aDoNotRequireLoad) {
function _row_click_helper(aController, aTree, aViewIndex, aButton, aExtra) { function _row_click_helper(aController, aTree, aViewIndex, aButton, aExtra) {
// Force-focus the tree // Force-focus the tree
aTree.focus(); aTree.focus();
let treeBox = aTree.treeBoxObject;
// very important, gotta be able to see the row // very important, gotta be able to see the row
treeBox.ensureRowIsVisible(aViewIndex); aTree.ensureRowIsVisible(aViewIndex);
// coordinates of the upper left of the entire tree widget (headers included) // coordinates of the upper left of the entire tree widget (headers included)
let tx = aTree.boxObject.x, ty = aTree.boxObject.y; let tx = aTree.boxObject.x, ty = aTree.boxObject.y;
// coordinates of the row display region of the tree (below the headers) // coordinates of the row display region of the tree (below the headers)
@ -1118,12 +1117,12 @@ function _row_click_helper(aController, aTree, aViewIndex, aButton, aExtra) {
if (aExtra !== "toggle") if (aExtra !== "toggle")
rowX += 32; rowX += 32;
} }
let rowY = treeBox.rowHeight * (aViewIndex - treeBox.getFirstVisibleRow()) + let rowY = aTree.rowHeight * (aViewIndex - aTree.getFirstVisibleRow()) +
treeBox.rowHeight / 2; aTree.rowHeight / 2;
if (treeBox.getRowAt(x + rowX, y + rowY) != aViewIndex) { if (aTree.getRowAt(x + rowX, y + rowY) != aViewIndex) {
throw new Error("Thought we would find row " + aViewIndex + " at " + throw new Error("Thought we would find row " + aViewIndex + " at " +
rowX + "," + rowY + " but we found " + rowX + "," + rowY + " but we found " +
treeBox.getRowAt(rowX, rowY)); aTree.getRowAt(rowX, rowY));
} }
// Generate a mouse-down for all click types; the transient selection // Generate a mouse-down for all click types; the transient selection
// logic happens on mousedown which our tests assume is happening. (If you // logic happens on mousedown which our tests assume is happening. (If you
@ -1189,10 +1188,10 @@ function middle_click_on_row(aViewIndex) {
* Assert that the given row index is currently visible in the thread pane view. * Assert that the given row index is currently visible in the thread pane view.
*/ */
function assert_row_visible(aViewIndex) { function assert_row_visible(aViewIndex) {
let treeBox = mc.threadTree.treeBoxObject; let tree = mc.threadTree;
if (treeBox.getFirstVisibleRow() > aViewIndex || if (tree.getFirstVisibleRow() > aViewIndex ||
treeBox.getLastVisibleRow() < aViewIndex) tree.getLastVisibleRow() < aViewIndex)
throw new Error("Row " + aViewIndex + " should currently be visible in " + throw new Error("Row " + aViewIndex + " should currently be visible in " +
"the thread pane, but isn't."); "the thread pane, but isn't.");
} }
@ -2227,12 +2226,12 @@ function assert_visible(aViewIndexOrMessage) {
viewIndex = _normalize_view_index(aViewIndexOrMessage); viewIndex = _normalize_view_index(aViewIndexOrMessage);
else else
viewIndex = mc.dbView.findIndexOfMsgHdr(aViewIndexOrMessage, false); viewIndex = mc.dbView.findIndexOfMsgHdr(aViewIndexOrMessage, false);
let treeBox = mc.threadTree.boxObject; let tree = mc.threadTree;
if (viewIndex < treeBox.getFirstVisibleRow() || if (viewIndex < tree.getFirstVisibleRow() ||
viewIndex > treeBox.getLastVisibleRow()) viewIndex > tree.getLastVisibleRow())
throw new Error("View index " + viewIndex + " is not visible! (" + throw new Error("View index " + viewIndex + " is not visible! (" +
treeBox.getFirstVisibleRow() + "-" + tree.getFirstVisibleRow() + "-" +
treeBox.getLastVisibleRow() + " are visible)"); tree.getLastVisibleRow() + " are visible)");
} }
/** /**

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

@ -76,7 +76,7 @@ function SetAbView(aURI)
var actualSortColumn = gAbView.setView(directory, GetAbViewListener(), var actualSortColumn = gAbView.setView(directory, GetAbViewListener(),
sortColumn, sortDirection); sortColumn, sortDirection);
gAbResultsTree.treeBoxObject.view = gAbResultsTree.view =
gAbView.QueryInterface(Ci.nsITreeView); gAbView.QueryInterface(Ci.nsITreeView);
UpdateSortIndicators(actualSortColumn, sortDirection); UpdateSortIndicators(actualSortColumn, sortDirection);
@ -289,8 +289,7 @@ function AbResultsPaneOnClick(event)
} }
else if (t.localName == "treechildren") { else if (t.localName == "treechildren") {
// figure out what row the click was in // figure out what row the click was in
var row = gAbResultsTree.treeBoxObject.getRowAt(event.clientX, var row = gAbResultsTree.getRowAt(event.clientX, event.clientY);
event.clientY);
if (row == -1) if (row == -1)
return; return;
@ -354,7 +353,7 @@ function UpdateSortIndicators(colID, sortDirection)
function InvalidateResultsPane() function InvalidateResultsPane()
{ {
if (gAbResultsTree) if (gAbResultsTree)
gAbResultsTree.treeBoxObject.invalidate(); gAbResultsTree.invalidate();
} }
// Controller object for Results Pane // Controller object for Results Pane

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

@ -68,15 +68,12 @@ var gSelectOffline = {
if (aEvent.button != 0) if (aEvent.button != 0)
return; return;
let row = {}; let treeCellInfo = this._treeElement.getCellAt(aEvent.clientX);
let col = {};
this._treeElement.treeBoxObject
.getCellAt(aEvent.clientX, aEvent.clientY, row, col, {});
if (row.value == -1 || col.value.id != "syncCol") if (treeCellInfo.row == -1 || treeCellInfo.col.id != "syncCol")
return; return;
this._toggle(row.value); this._toggle(treeCellInfo.row);
}, },
_toggle: function(aRow) { _toggle: function(aRow) {

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

@ -128,19 +128,15 @@ function onSynchronizeClick(event)
if (event.button != 0) if (event.button != 0)
return; return;
var row = {} let treeCellInfo = gSynchronizeTree.getCellAt(event.clientX, event.clientY);
var col = {} if (treeCellInfo.row == -1)
var elt = {}
gSynchronizeTree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, elt);
if (row.value == -1)
return; return;
if (elt.value == "twisty") { if (treeCellInfo.childElt == "twisty") {
var folderResource = GetFolderResource(gSynchronizeTree, row.value); var folderResource = GetFolderResource(gSynchronizeTree, treeCellInfo.row);
var folder = folderResource.QueryInterface(Ci.nsIMsgFolder); var folder = folderResource.QueryInterface(Ci.nsIMsgFolder);
if (!(gSynchronizeTree.treeBoxObject.view.isContainerOpen(row.value))) { if (!(gSynchronizeTree.view.isContainerOpen(treeCellInfo.row))) {
var serverType = folder.server.type; var serverType = folder.server.type;
// imap is the only server type that does folder discovery // imap is the only server type that does folder discovery
if (serverType != "imap") return; if (serverType != "imap") return;
@ -158,8 +154,8 @@ function onSynchronizeClick(event)
} }
} }
else { else {
if (col.value.id == "syncCol") { if (treeCellInfo.col.id == "syncCol") {
UpdateNode(GetFolderResource(gSynchronizeTree, row.value), row.value); UpdateNode(GetFolderResource(gSynchronizeTree, treeCellInfo.row), treeCellInfo.row);
} }
} }
} }

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

@ -7,7 +7,6 @@ ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var gSubscribeTree = null; var gSubscribeTree = null;
var gSubscribeBody = null; var gSubscribeBody = null;
var gSearchTree;
var okCallback = null; var okCallback = null;
var gChangeTable = {}; var gChangeTable = {};
var gServerURI = null; var gServerURI = null;
@ -17,7 +16,7 @@ var gNameFieldLabel = null;
var gStatusFeedback; var gStatusFeedback;
var gSubscribeDeck = null; var gSubscribeDeck = null;
var gSearchView = null; var gSearchView = null;
var gSearchTreeBoxObject = null; var gSearchTree = null;
var gSubscribeBundle; var gSubscribeBundle;
function Stop() function Stop()
@ -148,7 +147,7 @@ function SubscribeOnLoad()
gSubscribeTree = document.getElementById("subscribeTree"); gSubscribeTree = document.getElementById("subscribeTree");
gSubscribeBody = document.getElementById("subscribeTreeBody"); gSubscribeBody = document.getElementById("subscribeTreeBody");
gSearchTree = document.getElementById("searchTree"); gSearchTree = document.getElementById("searchTree");
gSearchTreeBoxObject = document.getElementById("searchTree").treeBoxObject; gSearchTree = document.getElementById("searchTree");
gNameField = document.getElementById("namefield"); gNameField = document.getElementById("namefield");
gNameFieldLabel = document.getElementById("namefieldlabel"); gNameFieldLabel = document.getElementById("namefieldlabel");
@ -270,25 +269,24 @@ function SearchOnClick(event)
// we only care about button 0 (left click) events // we only care about button 0 (left click) events
if (event.button != 0 || event.originalTarget.localName != "treechildren") return; if (event.button != 0 || event.originalTarget.localName != "treechildren") return;
var row = {}, col = {}, childElt = {}; let treeCellInfo = gSearchTree.getCellAt(event.clientX, event.clientY);
gSearchTreeBoxObject.getCellAt(event.clientX, event.clientY, row, col, childElt); if (treeCellInfo.row == -1 || treeCellInfo.row > gSearchView.rowCount-1)
if (row.value == -1 || row.value > gSearchView.rowCount-1)
return; return;
if (col.value.id == "subscribedColumn2") { if (treeCellInfo.col.id == "subscribedColumn2") {
if (event.detail != 2) { if (event.detail != 2) {
// single clicked on the check box // single clicked on the check box
// (in the "subscribedColumn2" column) reverse state // (in the "subscribedColumn2" column) reverse state
// if double click, do nothing // if double click, do nothing
ReverseStateFromRow(row.value); ReverseStateFromRow(treeCellInfo.row);
} }
} else if (event.detail == 2) { } else if (event.detail == 2) {
// double clicked on a row, reverse state // double clicked on a row, reverse state
ReverseStateFromRow(row.value); ReverseStateFromRow(treeCellInfo.row);
} }
// invalidate the row // invalidate the row
InvalidateSearchTreeRow(row.value); InvalidateSearchTreeRow(treeCellInfo.row);
} }
function ReverseStateFromRow(aRow) function ReverseStateFromRow(aRow)
@ -356,16 +354,15 @@ function SubscribeOnClick(event)
if (event.button != 0 || event.originalTarget.localName != "treechildren") if (event.button != 0 || event.originalTarget.localName != "treechildren")
return; return;
var row = {}, col = {}, obj = {}; let treeCellInfo = gSubscribeTree.getCellAt(event.clientX, event.clientY);
gSubscribeTree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj); if (treeCellInfo.row == -1 || treeCellInfo.row > (gSubscribeTree.view.rowCount - 1))
if (row.value == -1 || row.value > (gSubscribeTree.view.rowCount - 1))
return; return;
if (event.detail == 2) { if (event.detail == 2) {
// only toggle subscribed state when double clicking something // only toggle subscribed state when double clicking something
// that isn't a container // that isn't a container
if (!gSubscribeTree.view.isContainer(row.value)) { if (!gSubscribeTree.view.isContainer(treeCellInfo.row)) {
ReverseStateFromNode(row.value); ReverseStateFromNode(treeCellInfo.row);
return; return;
} }
} }
@ -373,7 +370,7 @@ function SubscribeOnClick(event)
{ {
// if the user single clicks on the subscribe check box, we handle it here // if the user single clicks on the subscribe check box, we handle it here
if (col.value.id == "subscribedColumn") if (col.value.id == "subscribedColumn")
ReverseStateFromNode(row.value); ReverseStateFromNode(treeCellInfo.row);
} }
} }
@ -412,12 +409,12 @@ function ShowNewGroupsList()
function InvalidateSearchTreeRow(row) function InvalidateSearchTreeRow(row)
{ {
gSearchTreeBoxObject.invalidateRow(row); gSearchTree.invalidateRow(row);
} }
function InvalidateSearchTree() function InvalidateSearchTree()
{ {
gSearchTreeBoxObject.invalidate(); gSearchTree.invalidate();
} }
function SwitchToNormalView() function SwitchToNormalView()
@ -442,7 +439,7 @@ function Search()
if (!gSearchView && gSubscribableServer) { if (!gSearchView && gSubscribableServer) {
gSearchView = gSubscribableServer.QueryInterface(Ci.nsITreeView); gSearchView = gSubscribableServer.QueryInterface(Ci.nsITreeView);
gSearchView.selection = null; gSearchView.selection = null;
gSearchTreeBoxObject.view = gSearchView; gSearchTree.view = gSearchView;
} }
} }
else { else {

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

@ -73,14 +73,11 @@ var gSelectVirtual = {
if (aEvent.button != 0) if (aEvent.button != 0)
return; return;
let row = {}; let treeCellInfo = this._treeElement.getCellAt(aEvent.clientX, aEvent.clientY);
let col = {}; if (treeCellInfo.row == -1 || treeCellInfo.col.id != "selectedCol")
this._treeElement.treeBoxObject
.getCellAt(aEvent.clientX, aEvent.clientY, row, col, {});
if (row.value == -1 || col.value.id != "selectedCol")
return; return;
this._toggle(row.value); this._toggle(treeCellInfo.row);
}, },
_toggle: function(aRow) { _toggle: function(aRow) {

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

@ -197,13 +197,13 @@ function selectServer(server, selectPageId)
let accountTree = document.getElementById("accounttree"); let accountTree = document.getElementById("accounttree");
let index = accountTree.view.getIndexOfItem(pageToSelect); let index = accountTree.view.getIndexOfItem(pageToSelect);
accountTree.view.selection.select(index); accountTree.view.selection.select(index);
accountTree.treeBoxObject.ensureRowIsVisible(index); accountTree.ensureRowIsVisible(index);
let lastItem = accountNode.lastChild.lastChild; let lastItem = accountNode.lastChild.lastChild;
if (lastItem.localName == "treeitem") if (lastItem.localName == "treeitem")
index = accountTree.view.getIndexOfItem(lastItem); index = accountTree.view.getIndexOfItem(lastItem);
accountTree.treeBoxObject.ensureRowIsVisible(index); accountTree.ensureRowIsVisible(index);
} }
function replaceWithDefaultSmtpServer(deletedSmtpServerKey) function replaceWithDefaultSmtpServer(deletedSmtpServerKey)

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

@ -37,8 +37,8 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
* *
* Unit test is in mailnews/base/util/test_jsTreeSelection.js * Unit test is in mailnews/base/util/test_jsTreeSelection.js
*/ */
function JSTreeSelection(aTreeBoxObject) { function JSTreeSelection(aTree) {
this._treeBoxObject = aTreeBoxObject; this._tree = aTree;
this._currentIndex = null; this._currentIndex = null;
this._shiftSelectPivot = null; this._shiftSelectPivot = null;
@ -49,9 +49,9 @@ function JSTreeSelection(aTreeBoxObject) {
} }
JSTreeSelection.prototype = { JSTreeSelection.prototype = {
/** /**
* The current nsITreeBoxObject, appropriately QueryInterfaced. May be null. * The current XULTreeElement, appropriately QueryInterfaced. May be null.
*/ */
_treeBoxObject: null, _tree: null,
/** /**
* Where the focus rectangle (that little dotted thing) shows up. Just * Where the focus rectangle (that little dotted thing) shows up. Just
@ -83,10 +83,10 @@ JSTreeSelection.prototype = {
_view: null, _view: null,
get tree() { get tree() {
return this._treeBoxObject; return this._tree;
}, },
set tree(aTreeBoxObject) { set tree(aTree) {
this._treeBoxObject = aTreeBoxObject; this._tree = aTree;
}, },
set view(aView) { set view(aView) {
@ -138,8 +138,8 @@ JSTreeSelection.prototype = {
this._count = 1; this._count = 1;
this._ranges = [[aViewIndex, aViewIndex]]; this._ranges = [[aViewIndex, aViewIndex]];
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this._fireSelectionChanged(); this._fireSelectionChanged();
}, },
@ -206,8 +206,8 @@ JSTreeSelection.prototype = {
// otherwise we need to keep going // otherwise we need to keep going
} }
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidateRow(aIndex); this._tree.invalidateRow(aIndex);
this._fireSelectionChanged(); this._fireSelectionChanged();
}, },
@ -242,8 +242,8 @@ JSTreeSelection.prototype = {
if (!aAugment) { if (!aAugment) {
this._count = aRangeEnd - aRangeStart + 1; this._count = aRangeEnd - aRangeStart + 1;
this._ranges = [[aRangeStart, aRangeEnd]]; this._ranges = [[aRangeStart, aRangeEnd]];
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this._fireSelectionChanged(); this._fireSelectionChanged();
return; return;
} }
@ -292,8 +292,8 @@ JSTreeSelection.prototype = {
this._ranges.splice(insertionPoint, 0, [aRangeStart, aRangeEnd]); this._ranges.splice(insertionPoint, 0, [aRangeStart, aRangeEnd]);
this._updateCount(); this._updateCount();
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this._fireSelectionChanged(); this._fireSelectionChanged();
}, },
@ -348,8 +348,8 @@ JSTreeSelection.prototype = {
this._ranges.splice.apply(this._ranges, args); this._ranges.splice.apply(this._ranges, args);
this._updateCount(); this._updateCount();
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
// note! nsTreeSelection doesn't fire a selection changed event, so neither // note! nsTreeSelection doesn't fire a selection changed event, so neither
// do we, but it seems like we should // do we, but it seems like we should
}, },
@ -362,8 +362,8 @@ JSTreeSelection.prototype = {
this._shiftSelectPivot = null; this._shiftSelectPivot = null;
this._count = 0; this._count = 0;
this._ranges = []; this._ranges = [];
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this._fireSelectionChanged(); this._fireSelectionChanged();
}, },
@ -391,8 +391,8 @@ JSTreeSelection.prototype = {
this._count = rowCount; this._count = rowCount;
this._ranges = [[0, rowCount - 1]]; this._ranges = [[0, rowCount - 1]];
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this._fireSelectionChanged(); this._fireSelectionChanged();
}, },
@ -407,8 +407,8 @@ JSTreeSelection.prototype = {
}, },
invalidateSelection: function JSTreeSelection_invalidateSelection() { invalidateSelection: function JSTreeSelection_invalidateSelection() {
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
}, },
/** /**
@ -523,8 +523,8 @@ JSTreeSelection.prototype = {
this._ranges[iTrans] = [low + aCount, high + aCount]; this._ranges[iTrans] = [low + aCount, high + aCount];
} }
// invalidate and fire selection change notice // invalidate and fire selection change notice
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this._fireSelectionChanged(); this._fireSelectionChanged();
return; return;
} }
@ -553,8 +553,8 @@ JSTreeSelection.prototype = {
this._ranges.splice(iTrans, 1); this._ranges.splice(iTrans, 1);
} }
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidate(); this._tree.invalidate();
this.selectEventsSuppressed = saveSuppress; this.selectEventsSuppressed = saveSuppress;
}, },
@ -582,8 +582,8 @@ JSTreeSelection.prototype = {
if (this.selectEventsSuppressed) if (this.selectEventsSuppressed)
return; return;
let view; let view;
if (this._treeBoxObject && this._treeBoxObject.view) if (this._tree && this._tree.view)
view = this._treeBoxObject.view; view = this._tree.view;
else else
view = this._view; view = this._view;
@ -609,8 +609,8 @@ JSTreeSelection.prototype = {
return; return;
this._currentIndex = (aIndex != -1) ? aIndex : null; this._currentIndex = (aIndex != -1) ? aIndex : null;
if (this._treeBoxObject) if (this._tree)
this._treeBoxObject.invalidateRow(aIndex); this._tree.invalidateRow(aIndex);
}, },
currentColumn: null, currentColumn: null,

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

@ -868,7 +868,7 @@ var FeedUtils = {
win = Services.wm.getMostRecentWindow("Mail:News-BlogSubscriptions"); win = Services.wm.getMostRecentWindow("Mail:News-BlogSubscriptions");
if (win) { if (win) {
win.FeedSubscriptions.mView.treeBox.invalidate(); win.FeedSubscriptions.mView.tree.invalidate();
} }
}, },

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

@ -109,7 +109,7 @@ var FeedSubscriptions = {
} }
} }
this.mView.treeBox.ensureRowIsVisible(this.mView.selection.currentIndex); this.mView.tree.ensureRowIsVisible(this.mView.selection.currentIndex);
this.clearStatusInfo(); this.clearStatusInfo();
}, },
@ -130,7 +130,7 @@ var FeedSubscriptions = {
/* nsITreeView */ /* nsITreeView */
/* eslint-disable no-multi-spaces */ /* eslint-disable no-multi-spaces */
treeBox: null, tree: null,
mRowCount: 0, mRowCount: 0,
get rowCount() { return this.mRowCount; }, get rowCount() { return this.mRowCount; },
@ -139,7 +139,7 @@ var FeedSubscriptions = {
get selection() { return this._selection; }, get selection() { return this._selection; },
set selection(val) { return this._selection = val; }, set selection(val) { return this._selection = val; },
setTree(aTreebox) { this.treeBox = aTreebox; }, setTree(aTree) { this.tree = aTree; },
isSeparator(aRow) { return false; }, isSeparator(aRow) { return false; },
isSorted() { return false; }, isSorted() { return false; },
isEditable(aRow, aColumn) { return false; }, isEditable(aRow, aColumn) { return false; },
@ -274,7 +274,7 @@ var FeedSubscriptions = {
// Now invalidate the correct tree rows. // Now invalidate the correct tree rows.
this.mRowCount--; this.mRowCount--;
this.treeBox.rowCountChanged(aRow, -1); this.tree.rowCountChanged(aRow, -1);
// Now update the selection position, unless noSelect (selection is // Now update the selection position, unless noSelect (selection is
// done later or not at all). If the item is the last child, select the // done later or not at all). If the item is the last child, select the
@ -575,7 +575,7 @@ var FeedSubscriptions = {
// Suppress the select event caused by rowCountChanged. // Suppress the select event caused by rowCountChanged.
this.selection.selectEventsSuppressed = true; this.selection.selectEventsSuppressed = true;
// Add or remove the children from our view. // Add or remove the children from our view.
this.treeBox.rowCountChanged(aRow, delta); this.tree.rowCountChanged(aRow, delta);
return delta; return delta;
}, },
}, },
@ -724,8 +724,8 @@ var FeedSubscriptions = {
let found = false; let found = false;
let firstVisRow, curFirstVisRow, curLastVisRow; let firstVisRow, curFirstVisRow, curLastVisRow;
if (this.mView.treeBox) { if (this.mView.tree) {
firstVisRow = this.mView.treeBox.getFirstVisibleRow(); firstVisRow = this.mView.tree.getFirstVisibleRow();
} }
if (parentIndex != null) { if (parentIndex != null) {
@ -859,13 +859,13 @@ var FeedSubscriptions = {
} }
// Ensure tree position does not jump unnecessarily. // Ensure tree position does not jump unnecessarily.
curFirstVisRow = this.mView.treeBox.getFirstVisibleRow(); curFirstVisRow = this.mView.tree.getFirstVisibleRow();
curLastVisRow = this.mView.treeBox.getLastVisibleRow(); curLastVisRow = this.mView.tree.getLastVisibleRow();
if (firstVisRow >= 0 && if (firstVisRow >= 0 &&
this.mView.rowCount - curLastVisRow > firstVisRow - curFirstVisRow) { this.mView.rowCount - curLastVisRow > firstVisRow - curFirstVisRow) {
this.mView.treeBox.scrollToRow(firstVisRow); this.mView.tree.scrollToRow(firstVisRow);
} else { } else {
this.mView.treeBox.ensureRowIsVisible(this.mView.rowCount - 1); this.mView.tree.ensureRowIsVisible(this.mView.rowCount - 1);
} }
FeedUtils.log.debug("selectFolder: curIndex:firstVisRow:" + FeedUtils.log.debug("selectFolder: curIndex:firstVisRow:" +
@ -905,7 +905,7 @@ var FeedSubscriptions = {
for (let i = seln.currentIndex + 1; i < this.mView.rowCount; i++) { for (let i = seln.currentIndex + 1; i < this.mView.rowCount; i++) {
if (this.mView.getItemAtIndex(i).url == aFeed.url) { if (this.mView.getItemAtIndex(i).url == aFeed.url) {
this.mView.selection.select(i); this.mView.selection.select(i);
this.mView.treeBox.ensureRowIsVisible(i); this.mView.tree.ensureRowIsVisible(i);
found = true; found = true;
break; break;
} }
@ -1988,7 +1988,7 @@ var FeedSubscriptions = {
let feedWindow = this.feedWindow; let feedWindow = this.feedWindow;
let curSelItem = this.currentSelectedItem; let curSelItem = this.currentSelectedItem;
let firstVisRow = feedWindow.mView.treeBox.getFirstVisibleRow(); let firstVisRow = feedWindow.mView.tree.getFirstVisibleRow();
let indexInView = feedWindow.mView.getItemInViewIndex(parentFolder); let indexInView = feedWindow.mView.getItemInViewIndex(parentFolder);
let open = indexInView != null; let open = indexInView != null;
@ -2001,7 +2001,7 @@ var FeedSubscriptions = {
feedWindow.mFeedContainers.push(feedWindow.makeFolderObject(parentFolder, 0)); feedWindow.mFeedContainers.push(feedWindow.makeFolderObject(parentFolder, 0));
feedWindow.mView.mRowCount++; feedWindow.mView.mRowCount++;
feedWindow.mTree.view = feedWindow.mView; feedWindow.mTree.view = feedWindow.mView;
feedWindow.mView.treeBox.scrollToRow(firstVisRow); feedWindow.mView.tree.scrollToRow(firstVisRow);
return; return;
} }
} }
@ -2028,7 +2028,7 @@ var FeedSubscriptions = {
feedWindow.mView.toggleOpenState(parentIndex); feedWindow.mView.toggleOpenState(parentIndex);
} }
feedWindow.mView.treeBox.scrollToRow(firstVisRow); feedWindow.mView.tree.scrollToRow(firstVisRow);
if (curSelItem.container) { if (curSelItem.container) {
feedWindow.selectFolder(curSelItem.folder, { open: curSelItem.open }); feedWindow.selectFolder(curSelItem.folder, { open: curSelItem.open });
@ -2083,7 +2083,7 @@ var FeedSubscriptions = {
let feedWindow = this.feedWindow; let feedWindow = this.feedWindow;
let curSelIndex = this.currentSelectedIndex; let curSelIndex = this.currentSelectedIndex;
let curSelItem = this.currentSelectedItem; let curSelItem = this.currentSelectedItem;
let firstVisRow = feedWindow.mView.treeBox.getFirstVisibleRow(); let firstVisRow = feedWindow.mView.tree.getFirstVisibleRow();
let indexInView = feedWindow.mView.getItemInViewIndex(aOrigFolder); let indexInView = feedWindow.mView.getItemInViewIndex(aOrigFolder);
let open = indexInView != null; let open = indexInView != null;
@ -2109,7 +2109,7 @@ var FeedSubscriptions = {
feedWindow.mView.toggle(parentIndex); feedWindow.mView.toggle(parentIndex);
feedWindow.mView.toggleOpenState(parentIndex); feedWindow.mView.toggleOpenState(parentIndex);
feedWindow.mView.treeBox.scrollToRow(firstVisRow); feedWindow.mView.tree.scrollToRow(firstVisRow);
if (curSelItem.container) { if (curSelItem.container) {
if (curSelItem.folder == aOrigFolder) { if (curSelItem.folder == aOrigFolder) {
@ -2139,7 +2139,7 @@ var FeedSubscriptions = {
let feedWindow = this.feedWindow; let feedWindow = this.feedWindow;
let curSelIndex = this.currentSelectedIndex; let curSelIndex = this.currentSelectedIndex;
let curSelItem = this.currentSelectedItem; let curSelItem = this.currentSelectedItem;
let firstVisRow = feedWindow.mView.treeBox.getFirstVisibleRow(); let firstVisRow = feedWindow.mView.tree.getFirstVisibleRow();
let indexInView = feedWindow.mView.getItemInViewIndex(aSrcFolder); let indexInView = feedWindow.mView.getItemInViewIndex(aSrcFolder);
let destIndexInView = feedWindow.mView.getItemInViewIndex(aDestFolder); let destIndexInView = feedWindow.mView.getItemInViewIndex(aDestFolder);
let open = indexInView != null || destIndexInView != null; let open = indexInView != null || destIndexInView != null;
@ -2169,7 +2169,7 @@ var FeedSubscriptions = {
feedWindow.mView.toggle(parentIndex); feedWindow.mView.toggle(parentIndex);
feedWindow.mView.toggleOpenState(parentIndex); feedWindow.mView.toggleOpenState(parentIndex);
feedWindow.mView.treeBox.scrollToRow(firstVisRow); feedWindow.mView.tree.scrollToRow(firstVisRow);
if (curSelItem.container) { if (curSelItem.container) {
if (curSelItem.folder == aSrcFolder || select) { if (curSelItem.folder == aSrcFolder || select) {

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

@ -277,7 +277,7 @@ function openSubscriptionsDialog(aFolder) {
if (subscriptionsWindow) { if (subscriptionsWindow) {
if (aFolder) { if (aFolder) {
subscriptionsWindow.FeedSubscriptions.selectFolder(aFolder); subscriptionsWindow.FeedSubscriptions.selectFolder(aFolder);
subscriptionsWindow.FeedSubscriptions.mView.treeBox.ensureRowIsVisible( subscriptionsWindow.FeedSubscriptions.mView.tree.ensureRowIsVisible(
subscriptionsWindow.FeedSubscriptions.mView.selection.currentIndex); subscriptionsWindow.FeedSubscriptions.mView.selection.currentIndex);
} }