Bug 743568 - Fire name change event when a XUL row's name changes, r=surkov.

This commit is contained in:
Jonathan Wei 2014-03-14 14:22:08 -04:00
parent ffc1a58e54
commit 976a7cf7e1
2 changed files with 12 additions and 11 deletions

View File

@ -397,6 +397,7 @@ XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
if (!treeColumns)
return;
bool nameChanged = false;
for (int32_t colIdx = aStartColIdx; colIdx <= aEndColIdx; ++colIdx) {
nsCOMPtr<nsITreeColumn> column;
treeColumns->GetColumnAt(colIdx, getter_AddRefs(column));
@ -405,18 +406,14 @@ XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
if (cellAccessible) {
nsRefPtr<XULTreeGridCellAccessible> cellAcc = do_QueryObject(cellAccessible);
cellAcc->CellInvalidated();
nameChanged |= cellAcc->CellInvalidated();
}
}
}
nsAutoString name;
Name(name);
if (name != mCachedName) {
if (nameChanged)
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
mCachedName = name;
}
}
////////////////////////////////////////////////////////////////////////////////
@ -763,7 +760,7 @@ XULTreeGridCellAccessible::RelationByType(RelationType aType)
////////////////////////////////////////////////////////////////////////////////
// XULTreeGridCellAccessible: public implementation
void
bool
XULTreeGridCellAccessible::CellInvalidated()
{
@ -780,16 +777,20 @@ XULTreeGridCellAccessible::CellInvalidated()
nsEventShell::FireEvent(accEvent);
mCachedTextEquiv = textEquiv;
return true;
}
return;
return false;
}
mTreeView->GetCellText(mRow, mColumn, textEquiv);
if (mCachedTextEquiv != textEquiv) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
mCachedTextEquiv = textEquiv;
return true;
}
return false;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -106,7 +106,6 @@ protected:
// XULTreeItemAccessibleBase
mutable AccessibleHashtable mAccessibleCache;
nsString mCachedName;
};
@ -180,8 +179,9 @@ public:
/**
* Fire name or state change event if the accessible text or value has been
* changed.
* @return true if name has changed
*/
void CellInvalidated();
bool CellInvalidated();
protected:
// Accessible