From f757ba542c5386f9c7552b1531d82f570207ebd9 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Mon, 4 Mar 2013 10:18:48 -0800 Subject: [PATCH 1/2] Bug 846409 - Add |mach mach-debug-commands|; r=jhammel DONTBUILD (NPOTB) --- build/mach_bootstrap.py | 1 + python/mach/mach/commands/commandinfo.py | 35 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 python/mach/mach/commands/commandinfo.py diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py index 5cd52e24ea41..d22f2609e363 100644 --- a/build/mach_bootstrap.py +++ b/build/mach_bootstrap.py @@ -31,6 +31,7 @@ SEARCH_PATHS = [ MACH_MODULES = [ 'addon-sdk/mach_commands.py', 'layout/tools/reftest/mach_commands.py', + 'python/mach/mach/commands/commandinfo.py', 'python/mozboot/mozboot/mach_commands.py', 'python/mozbuild/mozbuild/config.py', 'python/mozbuild/mozbuild/mach_commands.py', diff --git a/python/mach/mach/commands/commandinfo.py b/python/mach/mach/commands/commandinfo.py new file mode 100644 index 000000000000..25d9672e8152 --- /dev/null +++ b/python/mach/mach/commands/commandinfo.py @@ -0,0 +1,35 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, # You can obtain one at http://mozilla.org/MPL/2.0/. + +from __future__ import print_function, unicode_literals + +from mach.decorators import ( + CommandProvider, + Command, +) + + +@CommandProvider +class BuiltinCommands(object): + def __init__(self, context): + self.context = context + + @Command('mach-debug-commands', help='Show info about available mach commands.') + def commands(self): + import inspect + + handlers = self.context.commands.command_handlers + for command in sorted(handlers.keys()): + handler = handlers[command] + cls = handler.cls + method = getattr(cls, getattr(handler, 'method')) + + print(command) + print('=' * len(command)) + print('') + print('File: %s' % inspect.getsourcefile(method)) + print('Class: %s' % cls.__name__) + print('Method: %s' % handler.method) + print('') + From 254bffb7393eb479d92c5aa5ed52914df7b6fd29 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sun, 6 Jan 2013 19:54:42 -0500 Subject: [PATCH 2/2] bug 407956 - make nsITreeView not take a nsISupportsArray* r=neil, bz sr=neil --- accessible/tests/mochitest/treeview.js | 17 +++-- browser/base/content/pageinfo/pageInfo.js | 20 +++--- browser/base/content/sanitizeDialog.js | 28 ++++---- browser/base/content/sync/quota.js | 6 +- browser/components/places/content/treeView.js | 67 +++++++------------ .../places/tests/chrome/test_0_bug510634.xul | 18 +---- browser/components/preferences/cookies.js | 6 +- browser/components/preferences/permissions.js | 14 ++-- .../search/content/engineManager.js | 6 +- .../content/aboutSessionRestore.js | 26 +++---- browser/devtools/webconsole/PropertyPanel.jsm | 6 +- .../xul/templates/src/nsXULTreeBuilder.cpp | 21 ++---- layout/build/nsLayoutStatics.cpp | 2 - layout/inspector/src/inDOMView.cpp | 54 +++++---------- layout/inspector/src/inDOMView.h | 11 +-- layout/inspector/src/inDOMViewAtomList.h | 18 ----- layout/xul/tree/nsITreeView.idl | 25 ++++--- layout/xul/tree/nsTreeBodyFrame.cpp | 22 ++++-- layout/xul/tree/nsTreeContentView.cpp | 27 ++------ security/manager/pki/src/nsASN1Tree.cpp | 12 +--- security/manager/ssl/src/nsCertTree.cpp | 15 +---- .../autocomplete/nsAutoCompleteController.cpp | 14 ++-- .../autocomplete/nsAutoCompleteController.h | 1 + toolkit/components/filepicker/nsFileView.cpp | 22 ++---- .../passwordmgr/content/passwordManager.js | 12 ++-- .../content/passwordManagerCommon.js | 6 -- .../content/passwordManagerExceptions.js | 12 ++-- .../components/viewconfig/content/config.js | 12 ++-- .../content/tests/chrome/test_tree_view.xul | 13 ++-- toolkit/content/tests/widgets/tree_shared.js | 23 +------ .../resources/content/autocomplete.xml | 25 +++---- 31 files changed, 203 insertions(+), 358 deletions(-) delete mode 100644 layout/inspector/src/inDOMViewAtomList.h diff --git a/accessible/tests/mochitest/treeview.js b/accessible/tests/mochitest/treeview.js index 1d55fa750f05..6ff0059d7042 100644 --- a/accessible/tests/mochitest/treeview.js +++ b/accessible/tests/mochitest/treeview.js @@ -101,17 +101,16 @@ nsTreeView.prototype = var data = this.getDataForIndex(aRow); return data.value; }, - getRowProperties: function getRowProperties(aIndex, aProperties) {}, - getCellProperties: function getCellProperties(aIndex, aCol, aProperties) + getRowProperties: function getRowProperties(aIndex) { return ""; }, + getCellProperties: function getCellProperties(aIndex, aCol) { if (!aCol.cycler) - return; + return ""; var data = this.getDataForIndex(aIndex); - var atom = this.mCyclerStates[data.cyclerState]; - aProperties.AppendElement(atom); + return this.mCyclerStates[data.cyclerState]; }, - getColumnProperties: function getColumnProperties(aCol, aProperties) {}, + getColumnProperties: function getColumnProperties(aCol) { return ""; }, getParentIndex: function getParentIndex(aRowIndex) { var info = this.getInfoByIndex(aRowIndex); @@ -261,9 +260,9 @@ nsTreeView.prototype = }, mCyclerStates: [ - createAtom("cyclerState1"), - createAtom("cyclerState2"), - createAtom("cyclerState3") + "cyclerState1", + "cyclerState2", + "cyclerState3" ] }; diff --git a/browser/base/content/pageinfo/pageInfo.js b/browser/base/content/pageinfo/pageInfo.js index 8c23d8101d4b..b9258615f334 100644 --- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -103,9 +103,9 @@ pageInfoTreeView.prototype = { this.sortcol = treecol.index; }, - getRowProperties: function(row, prop) { }, - getCellProperties: function(row, column, prop) { }, - getColumnProperties: function(column, prop) { }, + getRowProperties: function(row) { return ""; }, + getCellProperties: function(row, column) { return ""; }, + getColumnProperties: function(column) { return ""; }, isContainer: function(index) { return false; }, isContainerOpen: function(index) { return false; }, isSeparator: function(index) { return false; }, @@ -151,21 +151,19 @@ const COPYCOL_IMAGE = COL_IMAGE_ADDRESS; var gMetaView = new pageInfoTreeView('metatree', COPYCOL_META_CONTENT); var gImageView = new pageInfoTreeView('imagetree', COPYCOL_IMAGE); -var atomSvc = Components.classes["@mozilla.org/atom-service;1"] - .getService(Components.interfaces.nsIAtomService); -gImageView._ltrAtom = atomSvc.getAtom("ltr"); -gImageView._brokenAtom = atomSvc.getAtom("broken"); - -gImageView.getCellProperties = function(row, col, props) { +gImageView.getCellProperties = function(row, col) { var data = gImageView.data[row]; var item = gImageView.data[row][COL_IMAGE_NODE]; + var props = ""; if (!checkProtocol(data) || item instanceof HTMLEmbedElement || (item instanceof HTMLObjectElement && !item.type.startsWith("image/"))) - props.AppendElement(this._brokenAtom); + props += "broken"; if (col.element.id == "image-address") - props.AppendElement(this._ltrAtom); + props += " ltr"; + + return props; }; gImageView.getCellText = function(row, column) { diff --git a/browser/base/content/sanitizeDialog.js b/browser/base/content/sanitizeDialog.js index 68e33cca2b66..24fb04e040ac 100644 --- a/browser/base/content/sanitizeDialog.js +++ b/browser/base/content/sanitizeDialog.js @@ -804,9 +804,6 @@ var gContiguousSelectionTreeHelper = { */ _makeTreeView: function CSTH__makeTreeView(aProtoTreeView) { - var atomServ = Cc["@mozilla.org/atom-service;1"]. - getService(Ci.nsIAtomService); - var view = aProtoTreeView; var that = this; @@ -837,28 +834,29 @@ var gContiguousSelectionTreeHelper = { view._getCellProperties = view.getCellProperties; view.getCellProperties = - function CSTH_View_getCellProperties(aRow, aCol, aProps) + function CSTH_View_getCellProperties(aRow, aCol) { var grippyRow = that.getGrippyRow(); if (aRow === grippyRow) - aProps.AppendElement(atomServ.getAtom("grippyRow")); - else if (aRow < grippyRow) - this._getCellProperties(aRow, aCol, aProps); - else - this._getCellProperties(aRow - 1, aCol, aProps); + return "grippyRow"; + if (aRow < grippyRow) + return this._getCellProperties(aRow, aCol); + + return this._getCellProperties(aRow - 1, aCol); }; view._getRowProperties = view.getRowProperties; view.getRowProperties = - function CSTH_View_getRowProperties(aRow, aProps) + function CSTH_View_getRowProperties(aRow) { var grippyRow = that.getGrippyRow(); if (aRow === grippyRow) - aProps.AppendElement(atomServ.getAtom("grippyRow")); - else if (aRow < grippyRow) - this._getRowProperties(aRow, aProps); - else - this._getRowProperties(aRow - 1, aProps); + return "grippyRow"; + + if (aRow < grippyRow) + return this._getRowProperties(aRow); + + return this._getRowProperties(aRow - 1); }; view._getCellText = view.getCellText; diff --git a/browser/base/content/sync/quota.js b/browser/base/content/sync/quota.js index 0945e7c178e0..04858fa3bffb 100644 --- a/browser/base/content/sync/quota.js +++ b/browser/base/content/sync/quota.js @@ -218,9 +218,9 @@ let gUsageTreeView = { return this._collections.length; }, - getRowProperties: function(index, properties) {}, - getCellProperties: function(row, col, properties) {}, - getColumnProperties: function(col, properties) {}, + getRowProperties: function(index) { return ""; }, + getCellProperties: function(row, col) { return ""; }, + getColumnProperties: function(col) { return ""; }, isContainer: function(index) { return false; }, isContainerOpen: function(index) { return false; }, isContainerEmpty: function(index) { return false; }, diff --git a/browser/components/places/content/treeView.js b/browser/components/places/content/treeView.js index fd317915e176..c7975a8d9731 100644 --- a/browser/components/places/content/treeView.js +++ b/browser/components/places/content/treeView.js @@ -23,20 +23,6 @@ function PlacesTreeView(aFlatList, aOnOpenFlatContainer, aController) { PlacesTreeView.prototype = { get wrappedJSObject() this, - _makeAtom: function PTV__makeAtom(aString) { - return Cc["@mozilla.org/atom-service;1"]. - getService(Ci.nsIAtomService). - getAtom(aString); - }, - - _atoms: [], - _getAtomFor: function PTV__getAtomFor(aName) { - if (!this._atoms[aName]) - this._atoms[aName] = this._makeAtom(aName); - - return this._atoms[aName]; - }, - __dateService: null, get _dateService() { if (!this.__dateService) { @@ -857,9 +843,8 @@ PlacesTreeView.prototype = { function (aStatus, aLivemark) { if (Components.isSuccessCode(aStatus)) { this._controller.cacheLivemarkInfo(aNode, aLivemark); - let properties = this._cellProperties.get(aNode, null); - if (properties) - properties.push(this._getAtomFor("livemark")); + let properties = this._cellProperties.get(aNode); + this._cellProperties.set(aNode, properties += " livemark "); // The livemark attribute is set as a cell property on the title cell. this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE); @@ -1134,49 +1119,50 @@ PlacesTreeView.prototype = { get selection() this._selection, set selection(val) this._selection = val, - getRowProperties: function() { }, + getRowProperties: function() { return ""; }, getCellProperties: - function PTV_getCellProperties(aRow, aColumn, aProperties) { + function PTV_getCellProperties(aRow, aColumn) { // for anonid-trees, we need to add the column-type manually + var props = ""; let columnType = aColumn.element.getAttribute("anonid"); if (columnType) - aProperties.AppendElement(this._getAtomFor(columnType)); + props += columnType; else columnType = aColumn.id; // Set the "ltr" property on url cells if (columnType == "url") - aProperties.AppendElement(this._getAtomFor("ltr")); + props += " ltr"; if (columnType != "title") - return; + return props; let node = this._getNodeForRow(aRow); if (this._cuttingNodes.has(node)) { - aProperties.AppendElement(this._getAtomFor("cutting")); + props += " cutting"; } - let properties = this._cellProperties.get(node, null); - if (!properties) { - properties = []; + let properties = this._cellProperties.get(node); + if (properties === undefined) { + properties = ""; let itemId = node.itemId; let nodeType = node.type; if (PlacesUtils.containerTypes.indexOf(nodeType) != -1) { if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY) { - properties.push(this._getAtomFor("query")); + properties += " query"; if (PlacesUtils.nodeIsTagQuery(node)) - properties.push(this._getAtomFor("tagContainer")); + properties += " tagContainer"; else if (PlacesUtils.nodeIsDay(node)) - properties.push(this._getAtomFor("dayContainer")); + properties += " dayContainer"; else if (PlacesUtils.nodeIsHost(node)) - properties.push(this._getAtomFor("hostContainer")); + properties += " hostContainer"; } else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER || nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) { if (this._controller.hasCachedLivemarkInfo(node)) { - properties.push(this._getAtomFor("livemark")); + properties += " livemark"; } else { PlacesUtils.livemarks.getLivemark( @@ -1184,7 +1170,7 @@ PlacesTreeView.prototype = { function (aStatus, aLivemark) { if (Components.isSuccessCode(aStatus)) { this._controller.cacheLivemarkInfo(node, aLivemark); - properties.push(this._getAtomFor("livemark")); + properties += " livemark"; // The livemark attribute is set as a cell property on the title cell. this._invalidateCellValue(node, this.COLUMN_TYPE_TITLE); } @@ -1196,30 +1182,29 @@ PlacesTreeView.prototype = { if (itemId != -1) { let queryName = PlacesUIUtils.getLeftPaneQueryNameFromId(itemId); if (queryName) - properties.push(this._getAtomFor("OrganizerQuery_" + queryName)); + properties += " OrganizerQuery_" + queryName; } } else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) - properties.push(this._getAtomFor("separator")); + properties += " separator"; else if (PlacesUtils.nodeIsURI(node)) { - properties.push(this._getAtomFor(PlacesUIUtils.guessUrlSchemeForUI(node.uri))); + properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri); if (this._controller.hasCachedLivemarkInfo(node.parent)) { - properties.push(this._getAtomFor("livemarkItem")); + properties += " livemarkItem"; if (node.accessCount) { - properties.push(this._getAtomFor("visited")); + properties += " visited"; } } } this._cellProperties.set(node, properties); } - for (let property of properties) { - aProperties.AppendElement(property); - } + + return props + " " + properties; }, - getColumnProperties: function(aColumn, aProperties) { }, + getColumnProperties: function(aColumn) { return ""; }, isContainer: function PTV_isContainer(aRow) { // Only leaf nodes aren't listed in the rows array. diff --git a/browser/components/places/tests/chrome/test_0_bug510634.xul b/browser/components/places/tests/chrome/test_0_bug510634.xul index 0a86a65651fd..1ff1c960ba26 100644 --- a/browser/components/places/tests/chrome/test_0_bug510634.xul +++ b/browser/components/places/tests/chrome/test_0_bug510634.xul @@ -43,21 +43,7 @@ SimpleTest.waitForExplicitFinish(); - function createSupportsArray() { - return Cc["@mozilla.org/supports-array;1"]. - createInstance(Ci.nsISupportsArray); - } - // converts nsISupportsArray of atoms to a simple JS-strings array - function convertPropertiesToJSArray(aSupportsArray) { - var results = []; - var count = aSupportsArray.Count(); - for (var i = 0; i < count; i++) - results.push(aSupportsArray.QueryElementAt(i, Ci.nsIAtom).toString()); - - return results; - } - function runTest() { // We need to cache and restore this getter in order to simulate // Bug 510634 @@ -91,9 +77,7 @@ function(aQueryName, aRow) { let found = false; for (let i = 0; i < tree.view.rowCount && !found; i++) { - let rowProperties = createSupportsArray(); - tree.view.getCellProperties(i, titleColumn, rowProperties); - rowProperties = convertPropertiesToJSArray(rowProperties); + rowProperties = tree.view.getCellProperties(i, titleColumn).split(" "); found = rowProperties.indexOf("OrganizerQuery_" + aQueryName) != -1; } ok(found, "OrganizerQuery_" + aQueryName + " is set"); diff --git a/browser/components/preferences/cookies.js b/browser/components/preferences/cookies.js index f52135892e61..2cdcafca2d62 100644 --- a/browser/components/preferences/cookies.js +++ b/browser/components/preferences/cookies.js @@ -307,9 +307,9 @@ var gCookiesWindow = { _selection: null, get selection () { return this._selection; }, set selection (val) { this._selection = val; return val; }, - getRowProperties: function (aIndex, aProperties) {}, - getCellProperties: function (aIndex, aColumn, aProperties) {}, - getColumnProperties: function (aColumn, aProperties) {}, + getRowProperties: function (aIndex) { return ""; }, + getCellProperties: function (aIndex, aColumn) { return ""; }, + getColumnProperties: function (aColumn) { return ""; }, isContainer: function (aIndex) { if (!this._filtered) { var item = this._getItemAtIndex(aIndex); diff --git a/browser/components/preferences/permissions.js b/browser/components/preferences/permissions.js index fe6f7002bfd8..3a33e78588cd 100644 --- a/browser/components/preferences/permissions.js +++ b/browser/components/preferences/permissions.js @@ -46,11 +46,13 @@ var gPermissionManager = { getProgressMode: function(aRow, aColumn) {}, getCellValue: function(aRow, aColumn) {}, cycleHeader: function(column) {}, - getRowProperties: function(row,prop){}, - getColumnProperties: function(column,prop){}, - getCellProperties: function(row,column,prop){ + getRowProperties: function(row){ return ""; }, + getColumnProperties: function(column){ return ""; }, + getCellProperties: function(row,column){ if (column.element.getAttribute("id") == "siteCol") - prop.AppendElement(this._ltrAtom); + return "ltr"; + + return ""; } }, @@ -183,10 +185,6 @@ var gPermissionManager = { this._loadPermissions(); urlField.focus(); - - this._ltrAtom = Components.classes["@mozilla.org/atom-service;1"] - .getService(Components.interfaces.nsIAtomService) - .getAtom("ltr"); }, uninit: function () diff --git a/browser/components/search/content/engineManager.js b/browser/components/search/content/engineManager.js index c36307bc687e..ff8aa42737f5 100644 --- a/browser/components/search/content/engineManager.js +++ b/browser/components/search/content/engineManager.js @@ -463,9 +463,9 @@ EngineView.prototype = { }, selection: null, - getRowProperties: function(index, properties) { }, - getCellProperties: function(index, column, properties) { }, - getColumnProperties: function(column, properties) { }, + getRowProperties: function(index) { return ""; }, + getCellProperties: function(index, column) { return ""; }, + getColumnProperties: function(column) { return ""; }, isContainer: function(index) { return false; }, isContainerOpen: function(index) { return false; }, isContainerEmpty: function(index) { return false; }, diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js index d4987f4aac10..d1c9b70779c2 100644 --- a/browser/components/sessionstore/content/aboutSessionRestore.js +++ b/browser/components/sessionstore/content/aboutSessionRestore.js @@ -230,16 +230,6 @@ function restoreSingleTab(aIx, aShifted) { // Tree controller var treeView = { - _atoms: {}, - _getAtom: function(aName) - { - if (!this._atoms[aName]) { - var as = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomService); - this._atoms[aName] = as.getAtom(aName); - } - return this._atoms[aName]; - }, - treeBox: null, selection: null, @@ -295,17 +285,21 @@ var treeView = { this.treeBox.invalidateRow(idx); }, - getCellProperties: function(idx, column, prop) { + getCellProperties: function(idx, column) { if (column.id == "restore" && this.isContainer(idx) && gTreeData[idx].checked === 0) - prop.AppendElement(this._getAtom("partial")); + return "partial"; if (column.id == "title") - prop.AppendElement(this._getAtom(this.getImageSrc(idx, column) ? "icon" : "noicon")); + return this.getImageSrc(idx, column) ? "icon" : "noicon"; + + return ""; }, - getRowProperties: function(idx, prop) { + getRowProperties: function(idx) { var winState = gTreeData[idx].parent || gTreeData[idx]; if (winState.ix % 2 != 0) - prop.AppendElement(this._getAtom("alternate")); + return "alternate"; + + return ""; }, getImageSrc: function(idx, column) { @@ -320,5 +314,5 @@ var treeView = { selectionChanged: function() { }, performAction: function(action) { }, performActionOnCell: function(action, index, column) { }, - getColumnProperties: function(column, prop) { } + getColumnProperties: function(column) { return ""; } }; diff --git a/browser/devtools/webconsole/PropertyPanel.jsm b/browser/devtools/webconsole/PropertyPanel.jsm index ce52af250830..3182d3449d1a 100644 --- a/browser/devtools/webconsole/PropertyPanel.jsm +++ b/browser/devtools/webconsole/PropertyPanel.jsm @@ -318,9 +318,9 @@ PropertyTreeView.prototype = { performAction: function(action) { }, performActionOnCell: function(action, index, column) { }, performActionOnRow: function(action, row) { }, - getRowProperties: function(idx, column, prop) { }, - getCellProperties: function(idx, column, prop) { }, - getColumnProperties: function(column, element, prop) { }, + getRowProperties: function(idx) { return ""; }, + getCellProperties: function(idx, column) { return ""; }, + getColumnProperties: function(column, element) { return ""; }, setCellValue: function(row, col, value) { }, setCellText: function(row, col, value) { }, diff --git a/content/xul/templates/src/nsXULTreeBuilder.cpp b/content/xul/templates/src/nsXULTreeBuilder.cpp index 95263bd210dc..b9b91aa10273 100644 --- a/content/xul/templates/src/nsXULTreeBuilder.cpp +++ b/content/xul/templates/src/nsXULTreeBuilder.cpp @@ -450,9 +450,8 @@ nsXULTreeBuilder::SetSelection(nsITreeSelection* aSelection) } NS_IMETHODIMP -nsXULTreeBuilder::GetRowProperties(int32_t aIndex, nsISupportsArray* aProperties) +nsXULTreeBuilder::GetRowProperties(int32_t aIndex, nsAString& aProps) { - NS_ENSURE_ARG_POINTER(aProperties); NS_PRECONDITION(aIndex >= 0 && aIndex < mRows.Count(), "bad row"); if (aIndex < 0 || aIndex >= mRows.Count()) return NS_ERROR_INVALID_ARG; @@ -464,10 +463,7 @@ nsXULTreeBuilder::GetRowProperties(int32_t aIndex, nsISupportsArray* aProperties row->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, raw); if (!raw.IsEmpty()) { - nsAutoString cooked; - SubstituteText(mRows[aIndex]->mMatch->mResult, raw, cooked); - - nsTreeUtils::TokenizeProperties(cooked, aProperties); + SubstituteText(mRows[aIndex]->mMatch->mResult, raw, aProps); } } @@ -475,10 +471,10 @@ nsXULTreeBuilder::GetRowProperties(int32_t aIndex, nsISupportsArray* aProperties } NS_IMETHODIMP -nsXULTreeBuilder::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, nsISupportsArray* aProperties) +nsXULTreeBuilder::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, + nsAString& aProps) { NS_ENSURE_ARG_POINTER(aCol); - NS_ENSURE_ARG_POINTER(aProperties); NS_PRECONDITION(aRow >= 0 && aRow < mRows.Count(), "bad row"); if (aRow < 0 || aRow >= mRows.Count()) return NS_ERROR_INVALID_ARG; @@ -490,10 +486,7 @@ nsXULTreeBuilder::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, nsISuppor cell->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, raw); if (!raw.IsEmpty()) { - nsAutoString cooked; - SubstituteText(mRows[aRow]->mMatch->mResult, raw, cooked); - - nsTreeUtils::TokenizeProperties(cooked, aProperties); + SubstituteText(mRows[aRow]->mMatch->mResult, raw, aProps); } } @@ -501,11 +494,9 @@ nsXULTreeBuilder::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, nsISuppor } NS_IMETHODIMP -nsXULTreeBuilder::GetColumnProperties(nsITreeColumn* aCol, - nsISupportsArray* aProperties) +nsXULTreeBuilder::GetColumnProperties(nsITreeColumn* aCol, nsAString& aProps) { NS_ENSURE_ARG_POINTER(aCol); - NS_ENSURE_ARG_POINTER(aProperties); // XXX sortactive fu return NS_OK; } diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index f37898d0cfd2..25459052a07e 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -192,8 +192,6 @@ nsLayoutStatics::Initialize() return rv; } - inDOMView::InitAtoms(); - #endif nsMathMLOperators::AddRefTable(); diff --git a/layout/inspector/src/inDOMView.cpp b/layout/inspector/src/inDOMView.cpp index d5d4052c0143..c1ff7a67e319 100644 --- a/layout/inspector/src/inDOMView.cpp +++ b/layout/inspector/src/inDOMView.cpp @@ -91,25 +91,6 @@ inDOMView::~inDOMView() SetRootNode(nullptr); } -#define DOMVIEW_ATOM(name_, value_) nsIAtom* inDOMView::name_ = nullptr; -#include "inDOMViewAtomList.h" -#undef DOMVIEW_ATOM - -#define DOMVIEW_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_##_buffer, value_) -#include "inDOMViewAtomList.h" -#undef DOMVIEW_ATOM - -/* static */ const nsStaticAtom inDOMView::Atoms_info[] = { -#define DOMVIEW_ATOM(name_, value_) NS_STATIC_ATOM(name_##_buffer, &inDOMView::name_), -#include "inDOMViewAtomList.h" -#undef DOMVIEW_ATOM -}; - -/* static */ void -inDOMView::InitAtoms() -{ - NS_RegisterStaticAtoms(Atoms_info); -} //////////////////////////////////////////////////////////////////////// // nsISupports @@ -289,13 +270,14 @@ inDOMView::GetRowCount(int32_t *aRowCount) } NS_IMETHODIMP -inDOMView::GetRowProperties(int32_t index, nsISupportsArray *properties) +inDOMView::GetRowProperties(int32_t index, nsAString& aProps) { return NS_OK; } NS_IMETHODIMP -inDOMView::GetCellProperties(int32_t row, nsITreeColumn* col, nsISupportsArray *properties) +inDOMView::GetCellProperties(int32_t row, nsITreeColumn* col, + nsAString& aProps) { inDOMViewNode* node = nullptr; RowToNode(row, &node); @@ -303,47 +285,47 @@ inDOMView::GetCellProperties(int32_t row, nsITreeColumn* col, nsISupportsArray * nsCOMPtr content = do_QueryInterface(node->node); if (content && content->IsInAnonymousSubtree()) { - properties->AppendElement(kAnonymousAtom); + aProps.AppendLiteral("anonymous "); } uint16_t nodeType; node->node->GetNodeType(&nodeType); switch (nodeType) { case nsIDOMNode::ELEMENT_NODE: - properties->AppendElement(kElementNodeAtom); + aProps.AppendLiteral("ELEMENT_NODE"); break; case nsIDOMNode::ATTRIBUTE_NODE: - properties->AppendElement(kAttributeNodeAtom); + aProps.AppendLiteral("ATTRIBUTE_NODE"); break; case nsIDOMNode::TEXT_NODE: - properties->AppendElement(kTextNodeAtom); + aProps.AppendLiteral("TEXT_NODE"); break; case nsIDOMNode::CDATA_SECTION_NODE: - properties->AppendElement(kCDataSectionNodeAtom); + aProps.AppendLiteral("CDATA_SECTION_NODE"); break; case nsIDOMNode::ENTITY_REFERENCE_NODE: - properties->AppendElement(kEntityReferenceNodeAtom); + aProps.AppendLiteral("ENTITY_REFERENCE_NODE"); break; case nsIDOMNode::ENTITY_NODE: - properties->AppendElement(kEntityNodeAtom); + aProps.AppendLiteral("ENTITY_NODE"); break; case nsIDOMNode::PROCESSING_INSTRUCTION_NODE: - properties->AppendElement(kProcessingInstructionNodeAtom); + aProps.AppendLiteral("PROCESSING_INSTRUCTION_NODE"); break; case nsIDOMNode::COMMENT_NODE: - properties->AppendElement(kCommentNodeAtom); + aProps.AppendLiteral("COMMENT_NODE"); break; case nsIDOMNode::DOCUMENT_NODE: - properties->AppendElement(kDocumentNodeAtom); + aProps.AppendLiteral("DOCUMENT_NODE"); break; case nsIDOMNode::DOCUMENT_TYPE_NODE: - properties->AppendElement(kDocumentTypeNodeAtom); + aProps.AppendLiteral("DOCUMENT_TYPE_NODE"); break; case nsIDOMNode::DOCUMENT_FRAGMENT_NODE: - properties->AppendElement(kDocumentFragmentNodeAtom); + aProps.AppendLiteral("DOCUMENT_FRAGMENT_NODE"); break; case nsIDOMNode::NOTATION_NODE: - properties->AppendElement(kNotationNodeAtom); + aProps.AppendLiteral("NOTATION_NODE"); break; } @@ -357,7 +339,7 @@ inDOMView::GetCellProperties(int32_t row, nsITreeColumn* col, nsISupportsArray * nsresult rv = accService->GetAccessibleFor(node->node, getter_AddRefs(accessible)); if (NS_SUCCEEDED(rv) && accessible) - properties->AppendElement(kAccessibleNodeAtom); + aProps.AppendLiteral(" ACCESSIBLE_NODE"); } #endif @@ -365,7 +347,7 @@ inDOMView::GetCellProperties(int32_t row, nsITreeColumn* col, nsISupportsArray * } NS_IMETHODIMP -inDOMView::GetColumnProperties(nsITreeColumn* col, nsISupportsArray *properties) +inDOMView::GetColumnProperties(nsITreeColumn* col, nsAString& aProps) { return NS_OK; } diff --git a/layout/inspector/src/inDOMView.h b/layout/inspector/src/inDOMView.h index fdb7e2ae783f..b028e8085b76 100644 --- a/layout/inspector/src/inDOMView.h +++ b/layout/inspector/src/inDOMView.h @@ -15,7 +15,7 @@ #include "nsIDOMDocument.h" #include "nsTArray.h" #include "nsCOMArray.h" -#include "nsStaticAtom.h" +#include "nsCOMPtr.h" class inDOMViewNode; @@ -38,16 +38,7 @@ public: NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED - static void InitAtoms(); - protected: - -#define DOMVIEW_ATOM(name_, value_) static nsIAtom* name_; -#include "inDOMViewAtomList.h" -#undef DOMVIEW_ATOM - - static const nsStaticAtom Atoms_info[]; - nsCOMPtr mTree; nsCOMPtr mSelection; nsCOMPtr mDOMUtils; diff --git a/layout/inspector/src/inDOMViewAtomList.h b/layout/inspector/src/inDOMViewAtomList.h deleted file mode 100644 index 8faa1330f2dc..000000000000 --- a/layout/inspector/src/inDOMViewAtomList.h +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -DOMVIEW_ATOM(kAnonymousAtom, "anonymous") -DOMVIEW_ATOM(kElementNodeAtom, "ELEMENT_NODE") -DOMVIEW_ATOM(kAttributeNodeAtom, "ATTRIBUTE_NODE") -DOMVIEW_ATOM(kTextNodeAtom, "TEXT_NODE") -DOMVIEW_ATOM(kCDataSectionNodeAtom, "CDATA_SECTION_NODE") -DOMVIEW_ATOM(kEntityReferenceNodeAtom, "ENTITY_REFERENCE_NODE") -DOMVIEW_ATOM(kEntityNodeAtom, "ENTITY_NODE") -DOMVIEW_ATOM(kProcessingInstructionNodeAtom, "PROCESSING_INSTRUCTION_NODE") -DOMVIEW_ATOM(kCommentNodeAtom, "COMMENT_NODE") -DOMVIEW_ATOM(kDocumentNodeAtom, "DOCUMENT_NODE") -DOMVIEW_ATOM(kDocumentTypeNodeAtom, "DOCUMENT_TYPE_NODE") -DOMVIEW_ATOM(kDocumentFragmentNodeAtom, "DOCUMENT_FRAGMENT_NODE") -DOMVIEW_ATOM(kNotationNodeAtom, "NOTATION_NODE") -DOMVIEW_ATOM(kAccessibleNodeAtom, "ACCESSIBLE_NODE") diff --git a/layout/xul/tree/nsITreeView.idl b/layout/xul/tree/nsITreeView.idl index 2199c5db889c..22d045fd6803 100644 --- a/layout/xul/tree/nsITreeView.idl +++ b/layout/xul/tree/nsITreeView.idl @@ -4,14 +4,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsITreeBoxObject.idl" -#include "nsISupportsArray.idl" #include "domstubs.idl" interface nsITreeSelection; interface nsITreeColumn; interface nsIDOMDataTransfer; -[scriptable, uuid(C06DC4D3-63A2-4422-A0A3-5F2EDDECA8C1)] +[scriptable, uuid(091116f0-0bdc-4b32-b9c8-c8d5a37cb088)] interface nsITreeView : nsISupports { /** @@ -25,24 +24,28 @@ interface nsITreeView : nsISupports attribute nsITreeSelection selection; /** - * An atomized list of properties for a given row. Each property, x, that - * the view gives back will cause the pseudoclass :moz-tree-row-x - * to be matched on the pseudoelement ::moz-tree-row. + * A whitespace delimited list of properties. For each property X the view + * gives back will cause the pseudoclasses ::-moz-tree-cell(x), + * ::-moz-tree-row(x), ::-moz-tree-twisty(x), ::-moz-tree-image(x), + * ::-moz-tree-cell-text(x). to be matched on the pseudoelement + * ::moz-tree-row. */ - void getRowProperties(in long index, in nsISupportsArray properties); + AString getRowProperties(in long index); /** - * An atomized list of properties for a given cell. Each property, x, that - * the view gives back will cause the pseudoclass :moz-tree-cell-x - * to be matched on the ::moz-tree-cell pseudoelement. + * A whitespace delimited list of properties for a given cell. Each + * property, x, that the view gives back will cause the pseudoclasses + * ::-moz-tree-cell(x), ::-moz-tree-row(x), ::-moz-tree-twisty(x), + * ::-moz-tree-image(x), ::-moz-tree-cell-text(x). to be matched on the + * cell. */ - void getCellProperties(in long row, in nsITreeColumn col, in nsISupportsArray properties); + AString getCellProperties(in long row, in nsITreeColumn col); /** * Called to get properties to paint a column background. For shading the sort * column, etc. */ - void getColumnProperties(in nsITreeColumn col, in nsISupportsArray properties); + AString getColumnProperties(in nsITreeColumn col); /** * Methods that can be used to test whether or not a twisty should be drawn, diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 3923f30b8efd..eb726e5a2a81 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -1125,7 +1125,10 @@ nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const n } // Now obtain the properties for our cell. PrefillPropertyArray(aRow, currCol); - mView->GetCellProperties(aRow, currCol, mScratchArray); + + nsAutoString properties; + mView->GetCellProperties(aRow, currCol, properties); + nsTreeUtils::TokenizeProperties(properties, mScratchArray); nsStyleContext* rowContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreerow); @@ -1468,7 +1471,9 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect, // Obtain the properties for our cell. PrefillPropertyArray(aRowIndex, aColumn); - mView->GetCellProperties(aRowIndex, aColumn, mScratchArray); + nsAutoString properties; + mView->GetCellProperties(aRowIndex, aColumn, properties); + nsTreeUtils::TokenizeProperties(properties, mScratchArray); // Resolve style for the cell. nsStyleContext* cellContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecell); @@ -2876,7 +2881,9 @@ nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn, // Now obtain the properties for our cell. PrefillPropertyArray(-1, aColumn); - mView->GetColumnProperties(aColumn, mScratchArray); + nsAutoString properties; + mView->GetColumnProperties(aColumn, properties); + nsTreeUtils::TokenizeProperties(properties, mScratchArray); // Resolve style for the column. It contains all the info we need to lay ourselves // out and to paint. @@ -2912,7 +2919,10 @@ nsTreeBodyFrame::PaintRow(int32_t aRowIndex, // Now obtain the properties for our row. // XXX Automatically fill in the following props: open, closed, container, leaf, selected, focused PrefillPropertyArray(aRowIndex, nullptr); - mView->GetRowProperties(aRowIndex, mScratchArray); + + nsAutoString properties; + mView->GetRowProperties(aRowIndex, properties); + nsTreeUtils::TokenizeProperties(properties, mScratchArray); // Resolve style for the row. It contains all the info we need to lay ourselves // out and to paint. @@ -3112,7 +3122,9 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex, // Now obtain the properties for our cell. // XXX Automatically fill in the following props: open, closed, container, leaf, selected, focused, and the col ID. PrefillPropertyArray(aRowIndex, aColumn); - mView->GetCellProperties(aRowIndex, aColumn, mScratchArray); + nsAutoString properties; + mView->GetCellProperties(aRowIndex, aColumn, properties); + nsTreeUtils::TokenizeProperties(properties, mScratchArray); // Resolve style for the cell. It contains all the info we need to lay ourselves // out and to paint. diff --git a/layout/xul/tree/nsTreeContentView.cpp b/layout/xul/tree/nsTreeContentView.cpp index cba6dac80a56..1187dab87c4b 100644 --- a/layout/xul/tree/nsTreeContentView.cpp +++ b/layout/xul/tree/nsTreeContentView.cpp @@ -193,9 +193,8 @@ nsTreeContentView::SetSelection(nsITreeSelection* aSelection) } NS_IMETHODIMP -nsTreeContentView::GetRowProperties(int32_t aIndex, nsISupportsArray* aProperties) +nsTreeContentView::GetRowProperties(int32_t aIndex, nsAString& aProps) { - NS_ENSURE_ARG_POINTER(aProperties); NS_PRECONDITION(aIndex >= 0 && aIndex < int32_t(mRows.Length()), "bad index"); if (aIndex < 0 || aIndex >= int32_t(mRows.Length())) return NS_ERROR_INVALID_ARG; @@ -208,20 +207,17 @@ nsTreeContentView::GetRowProperties(int32_t aIndex, nsISupportsArray* aPropertie realRow = nsTreeUtils::GetImmediateChild(row->mContent, nsGkAtoms::treerow); if (realRow) { - nsAutoString properties; - realRow->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, properties); - if (!properties.IsEmpty()) - nsTreeUtils::TokenizeProperties(properties, aProperties); + realRow->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, aProps); } return NS_OK; } NS_IMETHODIMP -nsTreeContentView::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, nsISupportsArray* aProperties) +nsTreeContentView::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, + nsAString& aProps) { NS_ENSURE_NATIVE_COLUMN(aCol); - NS_ENSURE_ARG_POINTER(aProperties); NS_PRECONDITION(aRow >= 0 && aRow < int32_t(mRows.Length()), "bad row"); if (aRow < 0 || aRow >= int32_t(mRows.Length())) return NS_ERROR_INVALID_ARG; @@ -232,10 +228,7 @@ nsTreeContentView::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, nsISuppo if (realRow) { nsIContent* cell = GetCell(realRow, aCol); if (cell) { - nsAutoString properties; - cell->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, properties); - if (!properties.IsEmpty()) - nsTreeUtils::TokenizeProperties(properties, aProperties); + cell->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, aProps); } } @@ -243,19 +236,13 @@ nsTreeContentView::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, nsISuppo } NS_IMETHODIMP -nsTreeContentView::GetColumnProperties(nsITreeColumn* aCol, nsISupportsArray* aProperties) +nsTreeContentView::GetColumnProperties(nsITreeColumn* aCol, nsAString& aProps) { NS_ENSURE_NATIVE_COLUMN(aCol); - NS_ENSURE_ARG_POINTER(aProperties); nsCOMPtr element; aCol->GetElement(getter_AddRefs(element)); - nsAutoString properties; - element->GetAttribute(NS_LITERAL_STRING("properties"), properties); - - if (!properties.IsEmpty()) - nsTreeUtils::TokenizeProperties(properties, aProperties); - + element->GetAttribute(NS_LITERAL_STRING("properties"), aProps); return NS_OK; } diff --git a/security/manager/pki/src/nsASN1Tree.cpp b/security/manager/pki/src/nsASN1Tree.cpp index 19bc30d2c6a0..0ac3622f81c6 100644 --- a/security/manager/pki/src/nsASN1Tree.cpp +++ b/security/manager/pki/src/nsASN1Tree.cpp @@ -176,27 +176,21 @@ nsNSSASN1Tree::SetSelection(nsITreeSelection * aSelection) return NS_OK; } -/* void getRowProperties (in long index, in nsISupportsArray properties); */ NS_IMETHODIMP -nsNSSASN1Tree::GetRowProperties(int32_t index, nsISupportsArray *properties) +nsNSSASN1Tree::GetRowProperties(int32_t index, nsAString& aProps) { return NS_OK; } -/* void getCellProperties (in long row, in nsITreeColumn col, - in nsISupportsArray properties); */ NS_IMETHODIMP nsNSSASN1Tree::GetCellProperties(int32_t row, nsITreeColumn* col, - nsISupportsArray *properties) + nsAString& aProps) { return NS_OK; } -/* void getColumnProperties (in nsITreeColumn col, - in nsISupportsArray properties); */ NS_IMETHODIMP -nsNSSASN1Tree::GetColumnProperties(nsITreeColumn* col, - nsISupportsArray *properties) +nsNSSASN1Tree::GetColumnProperties(nsITreeColumn* col, nsAString& aProps) { return NS_OK; } diff --git a/security/manager/ssl/src/nsCertTree.cpp b/security/manager/ssl/src/nsCertTree.cpp index 3786899eeafb..c4bca1cc3c4a 100644 --- a/security/manager/ssl/src/nsCertTree.cpp +++ b/security/manager/ssl/src/nsCertTree.cpp @@ -928,33 +928,24 @@ nsCertTree::SetSelection(nsITreeSelection * aSelection) return NS_OK; } -/* void getRowProperties (in long index, in nsISupportsArray properties); */ NS_IMETHODIMP -nsCertTree::GetRowProperties(int32_t index, nsISupportsArray *properties) +nsCertTree::GetRowProperties(int32_t index, nsAString& aProps) { return NS_OK; } -/* void getCellProperties (in long row, in nsITreeColumn col, - * in nsISupportsArray properties); - */ NS_IMETHODIMP nsCertTree::GetCellProperties(int32_t row, nsITreeColumn* col, - nsISupportsArray* properties) + nsAString& aProps) { return NS_OK; } -/* void getColumnProperties (in nsITreeColumn col, - * in nsISupportsArray properties); - */ NS_IMETHODIMP -nsCertTree::GetColumnProperties(nsITreeColumn* col, - nsISupportsArray* properties) +nsCertTree::GetColumnProperties(nsITreeColumn* col, nsAString& aProps) { return NS_OK; } - /* boolean isContainer (in long index); */ NS_IMETHODIMP nsCertTree::IsContainer(int32_t index, bool *_retval) diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/nsAutoCompleteController.cpp index 215e16befcfd..db59d808d79c 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp +++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp @@ -728,28 +728,24 @@ nsAutoCompleteController::GetRowCount(int32_t *aRowCount) } NS_IMETHODIMP -nsAutoCompleteController::GetRowProperties(int32_t index, nsISupportsArray *properties) +nsAutoCompleteController::GetRowProperties(int32_t index, nsAString& aProps) { return NS_OK; } NS_IMETHODIMP -nsAutoCompleteController::GetCellProperties(int32_t row, nsITreeColumn* col, nsISupportsArray* properties) +nsAutoCompleteController::GetCellProperties(int32_t row, nsITreeColumn* col, + nsAString& aProps) { if (row >= 0) { - nsAutoString className; - GetStyleAt(row, className); - if (!className.IsEmpty()) { - nsCOMPtr atom(do_GetAtom(className)); - properties->AppendElement(atom); - } + GetStyleAt(row, aProps); } return NS_OK; } NS_IMETHODIMP -nsAutoCompleteController::GetColumnProperties(nsITreeColumn* col, nsISupportsArray* properties) +nsAutoCompleteController::GetColumnProperties(nsITreeColumn* col, nsAString& aProps) { return NS_OK; } diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.h b/toolkit/components/autocomplete/nsAutoCompleteController.h index 840ed6872f23..375fe2daaa76 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteController.h +++ b/toolkit/components/autocomplete/nsAutoCompleteController.h @@ -7,6 +7,7 @@ #include "nsIAutoCompleteController.h" +#include "nsCOMPtr.h" #include "nsIAutoCompleteInput.h" #include "nsIAutoCompletePopup.h" #include "nsIAutoCompleteResult.h" diff --git a/toolkit/components/filepicker/nsFileView.cpp b/toolkit/components/filepicker/nsFileView.cpp index 5ae302cbd984..ad95292dd788 100644 --- a/toolkit/components/filepicker/nsFileView.cpp +++ b/toolkit/components/filepicker/nsFileView.cpp @@ -225,8 +225,6 @@ protected: nsCOMPtr mDirectoryPath; nsCOMPtr mTree; nsCOMPtr mSelection; - nsCOMPtr mDirectoryAtom; - nsCOMPtr mFileAtom; nsCOMPtr mDateFormatter; int16_t mSortType; @@ -284,14 +282,6 @@ nsFileView::~nsFileView() nsresult nsFileView::Init() { - mDirectoryAtom = do_GetAtom("directory"); - if (!mDirectoryAtom) - return NS_ERROR_OUT_OF_MEMORY; - - mFileAtom = do_GetAtom("file"); - if (!mFileAtom) - return NS_ERROR_OUT_OF_MEMORY; - mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID); if (!mDateFormatter) return NS_ERROR_OUT_OF_MEMORY; @@ -585,29 +575,27 @@ nsFileView::SetSelection(nsITreeSelection* aSelection) } NS_IMETHODIMP -nsFileView::GetRowProperties(int32_t aIndex, - nsISupportsArray* aProperties) +nsFileView::GetRowProperties(int32_t aIndex, nsAString& aProps) { return NS_OK; } NS_IMETHODIMP nsFileView::GetCellProperties(int32_t aRow, nsITreeColumn* aCol, - nsISupportsArray* aProperties) + nsAString& aProps) { uint32_t dirCount = mDirList.Length(); if (aRow < (int32_t) dirCount) - aProperties->AppendElement(mDirectoryAtom); + aProps.AppendLiteral("directory"); else if (aRow < mTotalRows) - aProperties->AppendElement(mFileAtom); + aProps.AppendLiteral("file"); return NS_OK; } NS_IMETHODIMP -nsFileView::GetColumnProperties(nsITreeColumn* aCol, - nsISupportsArray* aProperties) +nsFileView::GetColumnProperties(nsITreeColumn* aCol, nsAString& aProps) { return NS_OK; } diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js index ae10d7b6ff3c..e9a2768a9bba 100644 --- a/toolkit/components/passwordmgr/content/passwordManager.js +++ b/toolkit/components/passwordmgr/content/passwordManager.js @@ -59,13 +59,15 @@ var signonsTreeView = { isSorted : function() { return false; }, isContainer : function(index) { return false; }, cycleHeader : function(column) {}, - getRowProperties : function(row,prop) {}, - getColumnProperties : function(column,prop) {}, - getCellProperties : function(row,column,prop) { + getRowProperties : function(row) { return ""; }, + getColumnProperties : function(column) { return ""; }, + getCellProperties : function(row,column) { if (column.element.getAttribute("id") == "siteCol") - prop.AppendElement(kLTRAtom); + return "ltr"; + + return ""; } - }; +}; function LoadSignons() { diff --git a/toolkit/components/passwordmgr/content/passwordManagerCommon.js b/toolkit/components/passwordmgr/content/passwordManagerCommon.js index d348b8bf38ca..a33fa0814126 100644 --- a/toolkit/components/passwordmgr/content/passwordManagerCommon.js +++ b/toolkit/components/passwordmgr/content/passwordManagerCommon.js @@ -22,8 +22,6 @@ var rejectsTree; var showingPasswords = false; -var kLTRAtom; - function Startup() { // xpconnect to password manager interfaces passwordmanager = Components.classes["@mozilla.org/login-manager;1"] @@ -35,10 +33,6 @@ function Startup() { signonsTree = document.getElementById("signonsTree"); rejectsTree = document.getElementById("rejectsTree"); - - kLTRAtom = Components.classes["@mozilla.org/atom-service;1"] - .getService(Components.interfaces.nsIAtomService) - .getAtom("ltr"); } function Shutdown() { diff --git a/toolkit/components/passwordmgr/content/passwordManagerExceptions.js b/toolkit/components/passwordmgr/content/passwordManagerExceptions.js index 69e14c22958f..b4195de70e8b 100644 --- a/toolkit/components/passwordmgr/content/passwordManagerExceptions.js +++ b/toolkit/components/passwordmgr/content/passwordManagerExceptions.js @@ -27,13 +27,15 @@ var rejectsTreeView = { isSorted: function() { return false; }, isContainer : function(index) {return false;}, cycleHeader : function(column) {}, - getRowProperties : function(row,prop){}, - getColumnProperties : function(column,prop){}, - getCellProperties : function(row,column,prop){ + getRowProperties : function(row){ return ""; }, + getColumnProperties : function(column){ return ""; }, + getCellProperties : function(row,column){ if (column.element.getAttribute("id") == "rejectCol") - prop.AppendElement(kLTRAtom); + return "ltr"; + + return ""; } - }; +}; function Reject(number, host) { this.number = number; diff --git a/toolkit/components/viewconfig/content/config.js b/toolkit/components/viewconfig/content/config.js index ba3ecbc6e8a3..b9416cfbfe75 100644 --- a/toolkit/components/viewconfig/content/config.js +++ b/toolkit/components/viewconfig/content/config.js @@ -22,7 +22,7 @@ const gPrefBranch = Services.prefs; const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper); const gAtomService = Components.classes[nsAtomService_CONTRACTID].getService(nsIAtomService); -var gLockAtoms = [gAtomService.getAtom("default"), gAtomService.getAtom("user"), gAtomService.getAtom("locked")]; +var gLockProps = ["default", "user", "locked"]; // we get these from a string bundle var gLockStrs = []; var gTypeStrs = []; @@ -57,12 +57,14 @@ var view = { return value; } }, - getRowProperties : function(index, prop) {}, - getCellProperties : function(index, col, prop) { + getRowProperties : function(index) { return ""; }, + getCellProperties : function(index, col) { if (index in gPrefView) - prop.AppendElement(gLockAtoms[gPrefView[index].lockCol]); + return gLockProps[gPrefView[index].lockCol]; + + return ""; }, - getColumnProperties : function(col, prop) {}, + getColumnProperties : function(col) { return ""; }, treebox : null, selection : null, isContainer : function(index) { return false; }, diff --git a/toolkit/content/tests/chrome/test_tree_view.xul b/toolkit/content/tests/chrome/test_tree_view.xul index 78c9cdf9d606..235e3a594878 100644 --- a/toolkit/content/tests/chrome/test_tree_view.xul +++ b/toolkit/content/tests/chrome/test_tree_view.xul @@ -41,16 +41,15 @@ var view = hasNextSibling: function(row, column) { return row != this.rowCount - 1; }, getImageSrc: function(row, column) { return ""; }, cycleHeader: function(column) { }, - getRowProperties: function(row, props) { }, - getCellProperties: function(row, column, props) { }, - getColumnProperties: function(column, props) + getRowProperties: function(row) { return ""; }, + getCellProperties: function(row, column) { return ""; }, + getColumnProperties: function(column) { if (!column.index) { - var atomService = Components.classes["@mozilla.org/atom-service;1"]. - getService(Components.interfaces.nsIAtomService); - props.AppendElement(atomService.getAtom("one")); - props.AppendElement(atomService.getAtom("two")); + return "one two"; } + + return ""; } } diff --git a/toolkit/content/tests/widgets/tree_shared.js b/toolkit/content/tests/widgets/tree_shared.js index ce19575dcde4..2ffc6c598c76 100644 --- a/toolkit/content/tests/widgets/tree_shared.js +++ b/toolkit/content/tests/widgets/tree_shared.js @@ -183,10 +183,7 @@ function testtag_tree_columns(tree, expectedColumns, testid) is(column.getNext(), c < columns.length - 1 ? columns[c + 1] : null, adjtestid + "getNext"); // check the view's getColumnProperties method - var properties = Components.classes["@mozilla.org/supports-array;1"]. - createInstance(Components.interfaces.nsISupportsArray); - tree.view.getColumnProperties(column, properties); - properties = convertProperties(properties); + var properties = tree.view.getColumnProperties(column); var expectedProperties = expectedColumn.properties; is(properties, expectedProperties ? expectedProperties : "", adjtestid + "getColumnProperties"); } @@ -926,15 +923,7 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) for (checkMethod in checkCellMethods) { expected = checkCellMethods[checkMethod](row, cell); - if (checkMethod == "getCellProperties") { - var properties = Components.classes["@mozilla.org/supports-array;1"]. - createInstance(Components.interfaces.nsISupportsArray); - view.getCellProperties(r, columns[c], properties); - actual = convertProperties(properties); - } - else { - actual = view[checkMethod](r, columns[c]); - } + actual = view[checkMethod](r, columns[c]); if (actual !== expected) { failedMethods[checkMethod] = true; is(actual, expected, testid + "row " + r + " column " + c + " " + checkMethod + " is incorrect"); @@ -945,13 +934,7 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) // compare row properties for (checkMethod in checkRowMethods) { expected = checkRowMethods[checkMethod](row, r); - if (checkMethod == "getRowProperties") { - var properties = Components.classes["@mozilla.org/supports-array;1"]. - createInstance(Components.interfaces.nsISupportsArray); - view.getRowProperties(r, properties); - actual = convertProperties(properties); - } - else if (checkMethod == "hasNextSibling") { + if (checkMethod == "hasNextSibling") { actual = view[checkMethod](r, r); } else { diff --git a/xpfe/components/autocomplete/resources/content/autocomplete.xml b/xpfe/components/autocomplete/resources/content/autocomplete.xml index 133b741eb7c8..644b7c701aa6 100644 --- a/xpfe/components/autocomplete/resources/content/autocomplete.xml +++ b/xpfe/components/autocomplete/resources/content/autocomplete.xml @@ -1430,16 +1430,6 @@ this.mTree.rowCountChanged(row, count); }, - createAtom: function(aVal) - { - try { - var i = Components.interfaces.nsIAtomService; - var svc = Components.classes["@mozilla.org/atom-service;1"].getService(i); - return svc.getAtom(aVal); - } catch(ex) { } - return null; // XXX equivalent to falling off the end? - }, - ////////////////////////////////////////////////////////// // nsIAutoCompleteController interface @@ -1475,30 +1465,31 @@ return aCol.id == "treecolAutoCompleteValue" ? result.value : (aCol.id == "treecolAutoCompleteComment" ? result.comment : ""); }, - getRowProperties: function(aIndex, aProperties) + getRowProperties: function(aIndex) { + return ""; }, - getCellProperties: function(aIndex, aCol, aProperties) + getCellProperties: function(aIndex, aCol) { // for the value column, append nsIAutoCompleteItem::className // to the property list so that we can style this column // using that property try { if (aCol.id == "treecolAutoCompleteValue") { - var className = this.mTextbox.getResultAt(aIndex).className; - if ( className ) { - aProperties.AppendElement(this.createAtom(className)); - } + return this.mTextbox.getResultAt(aIndex).className; } } catch (ex) { // the ability to style here is a frill, so don't abort // if there's a problem } + + return ""; }, - getColumnProperties: function(aCol, aProperties) + getColumnProperties: function(aCol) { + return ""; }, getParentIndex: function(aRowIndex) { },