Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2013-03-04 18:20:41 -05:00
commit 56bc50cdde
33 changed files with 239 additions and 358 deletions

View File

@ -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"
]
};

View File

@ -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) {

View File

@ -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;

View File

@ -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; },

View File

@ -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.

View File

@ -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");

View File

@ -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);

View File

@ -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 ()

View File

@ -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; },

View File

@ -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 ""; }
};

View File

@ -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) { },

View File

@ -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',

View File

@ -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;
}

View File

@ -192,8 +192,6 @@ nsLayoutStatics::Initialize()
return rv;
}
inDOMView::InitAtoms();
#endif
nsMathMLOperators::AddRefTable();

View File

@ -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<nsIContent> 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;
}

View File

@ -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<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeSelection> mSelection;
nsCOMPtr<inIDOMUtils> mDOMUtils;

View File

@ -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")

View File

@ -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,

View File

@ -1123,7 +1123,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);
@ -1466,7 +1469,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);
@ -2874,7 +2879,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.
@ -2910,7 +2917,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.
@ -3110,7 +3120,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.

View File

@ -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<nsIDOMElement> 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;
}

View File

@ -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('')

View File

@ -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;
}

View File

@ -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)

View File

@ -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<nsIAtom> 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;
}

View File

@ -7,6 +7,7 @@
#include "nsIAutoCompleteController.h"
#include "nsCOMPtr.h"
#include "nsIAutoCompleteInput.h"
#include "nsIAutoCompletePopup.h"
#include "nsIAutoCompleteResult.h"

View File

@ -225,8 +225,6 @@ protected:
nsCOMPtr<nsIFile> mDirectoryPath;
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeSelection> mSelection;
nsCOMPtr<nsIAtom> mDirectoryAtom;
nsCOMPtr<nsIAtom> mFileAtom;
nsCOMPtr<nsIDateTimeFormat> 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;
}

View File

@ -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() {

View File

@ -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() {

View File

@ -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;

View File

@ -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; },

View File

@ -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 "";
}
}

View File

@ -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 {

View File

@ -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) { },