merge mozilla-central to tracemonkey.

This commit is contained in:
Robert Sayre 2010-09-08 10:33:07 -04:00
Родитель edd12b5a03 fb431a2f1c
Коммит 7d6b688fcd
449 изменённых файлов: 12839 добавлений и 5748 удалений

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

@ -752,11 +752,8 @@ getRoleCB(AtkObject *aAtkObj)
#endif
if (aAtkObj->role == ATK_ROLE_INVALID) {
PRUint32 accRole, atkRole;
nsresult rv = accWrap->GetRole(&accRole);
NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
atkRole = atkRoleMap[accRole]; // map to the actual value
// map to the actual value
PRUint32 atkRole = atkRoleMap[accWrap->Role()];
NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
aAtkObj->role = static_cast<AtkRole>(atkRole);

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

@ -124,11 +124,9 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
nsresult rv = accWrap->GetKeyboardShortcut(accessKey);
if (NS_SUCCEEDED(rv) && !accessKey.IsEmpty()) {
nsCOMPtr<nsIAccessible> parentAccessible;
accWrap->GetParent(getter_AddRefs(parentAccessible));
if (parentAccessible) {
PRUint32 geckoRole = nsAccUtils::RoleInternal(parentAccessible);
PRUint32 atkRole = atkRoleMap[geckoRole];
nsAccessible* parent = accWrap->GetParent();
if (parent) {
PRUint32 atkRole = atkRoleMap[parent->NativeRole()];
if (atkRole == ATK_ROLE_MENU_BAR) {
//it is topmenu, change from "Alt+f" to "f;<Alt>f"
@ -140,11 +138,11 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
else if ((atkRole == ATK_ROLE_MENU) || (atkRole == ATK_ROLE_MENU_ITEM)) {
//it is submenu, change from "s" to "s;<Alt>f:s"
nsAutoString allKey = accessKey;
nsCOMPtr<nsIAccessible> grandParentAcc = parentAccessible;
nsAccessible* grandParent = parent;
while ((grandParentAcc) && (atkRole != ATK_ROLE_MENU_BAR)) {
do {
nsAutoString grandParentKey;
grandParentAcc->GetKeyboardShortcut(grandParentKey);
grandParent->GetKeyboardShortcut(grandParentKey);
if (!grandParentKey.IsEmpty()) {
nsAutoString rightChar;
@ -152,11 +150,9 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
allKey = rightChar + NS_LITERAL_STRING(":") + allKey;
}
nsCOMPtr<nsIAccessible> tempAcc = grandParentAcc;
tempAcc->GetParent(getter_AddRefs(grandParentAcc));
geckoRole = nsAccUtils::RoleInternal(grandParentAcc);
atkRole = atkRoleMap[geckoRole];
}
} while ((grandParent = grandParent->GetParent()) &&
atkRoleMap[grandParent->NativeRole()] != ATK_ROLE_MENU_BAR);
allKeyBinding = accessKey + NS_LITERAL_STRING(";<Alt>") +
allKey;
}

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

@ -80,9 +80,7 @@ textInterfaceInitCB(AtkTextIface *aIface)
void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
PRUint32 accRole = 0;
accWrap->GetRoleInternal(&accRole);
PRUint32 atkRole = atkRoleMap[accRole];
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
for (PRUint32 i = 0; i < aString.Length(); i++)
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
@ -189,9 +187,7 @@ getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
accText->GetCharacterAtOffset(aOffset, &uniChar);
// convert char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRoleInternal(&accRole);
PRUint32 atkRole = atkRoleMap[accRole];
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
if (atkRole == ATK_ROLE_PASSWORD_TEXT)
uniChar = '*';

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

@ -52,7 +52,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
mPosInSet = 1;
for (PRInt32 idx = indexInParent - 1; idx >=0 ; idx--) {
nsAccessible* sibling = parent->GetChildAt(idx);
PRUint32 siblingRole = nsAccUtils::Role(sibling);
PRUint32 siblingRole = sibling->Role();
// If the sibling is separator then the group is ended.
if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
@ -96,7 +96,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
for (PRInt32 idx = indexInParent + 1; idx < siblingCount; idx++) {
nsAccessible* sibling = parent->GetChildAt(idx);
PRUint32 siblingRole = nsAccUtils::Role(sibling);
PRUint32 siblingRole = sibling->Role();
// If the sibling is separator then the group is ended.
if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
@ -131,7 +131,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
return;
// Compute parent.
PRUint32 parentRole = nsAccUtils::Role(parent);
PRUint32 parentRole = parent->Role();
// In the case of ARIA row in treegrid, return treegrid since ARIA
// groups aren't used to organize levels in ARIA treegrids.
@ -153,14 +153,18 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
}
nsAccessible* parentPrevSibling = parent->GetSiblingAtOffset(-1);
PRUint32 parentPrevSiblingRole = nsAccUtils::Role(parentPrevSibling);
if (!parentPrevSibling)
return;
PRUint32 parentPrevSiblingRole = parentPrevSibling->Role();
if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_TEXT_LEAF) {
// XXX Sometimes an empty text accessible is in the hierarchy here,
// although the text does not appear to be rendered, GetRenderedText()
// says that it is so we need to skip past it to find the true
// previous sibling.
parentPrevSibling = parentPrevSibling->GetSiblingAtOffset(-1);
parentPrevSiblingRole = nsAccUtils::Role(parentPrevSibling);
if (parentPrevSibling)
parentPrevSiblingRole = parentPrevSibling->Role();
}
// Previous sibling of parent group is a tree item, this is the

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

@ -59,7 +59,7 @@ public:
*/
static AccGroupInfo* CreateGroupInfo(nsAccessible* aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
if (role != nsIAccessibleRole::ROLE_ROW &&
role != nsIAccessibleRole::ROLE_GRID_CELL &&
role != nsIAccessibleRole::ROLE_OUTLINEITEM &&

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

@ -55,13 +55,13 @@ filters::GetSelectable(nsAccessible* aAccessible)
bool
filters::GetRow(nsAccessible* aAccessible)
{
return nsAccUtils::Role(aAccessible) == nsIAccessibleRole::ROLE_ROW;
return aAccessible->Role() == nsIAccessibleRole::ROLE_ROW;
}
bool
filters::GetCell(nsAccessible* aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
return role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER;

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

@ -808,7 +808,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
if (aIsSelected)
return NS_OK;
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
// If the given accessible is row that was unselected then remove
// aria-selected from cell accessible.
@ -831,7 +831,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
nsAccessible *row = aAccessible->GetParent();
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW &&
if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
nsAccUtils::IsARIASelected(row)) {
rv = SetARIASelected(row, PR_FALSE, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
@ -948,15 +948,17 @@ nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
nsCOMPtr<nsIAccessible> thisRow;
GetParent(getter_AddRefs(thisRow));
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* thisRow = GetParent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsCOMPtr<nsIAccessible> table;
thisRow->GetParent(getter_AddRefs(table));
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* table = thisRow->GetParent();
if (!table)
return NS_OK;
PRUint32 tableRole = table->Role();
if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
return NS_OK;
CallQueryInterface(table, aTable);
@ -972,20 +974,20 @@ nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
*aColumnIndex = 0;
nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
GetPreviousSibling(getter_AddRefs(prevCell));
while (prevCell) {
PRUint32 role = nsAccUtils::Role(prevCell);
PRInt32 indexInRow = GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
nsAccessible* cell = row->GetChildAt(idx);
PRUint32 role = cell->Role();
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
(*aColumnIndex)++;
prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
tmpAcc.swap(prevCell);
}
return NS_OK;
@ -1000,15 +1002,21 @@ nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row, prevRow;
GetParent(getter_AddRefs(row));
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
while (row) {
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
nsAccessible* table = row->GetParent();
if (!table)
return NS_OK;
*aRowIndex = 0;
PRInt32 indexInTable = row->GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
row = table->GetChildAt(idx);
if (row->Role() == nsIAccessibleRole::ROLE_ROW)
(*aRowIndex)++;
row->GetPreviousSibling(getter_AddRefs(prevRow));
row.swap(prevRow);
}
return NS_OK;
@ -1088,7 +1096,7 @@ nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
return NS_ERROR_FAILURE;
nsAccessible *row = GetParent();
if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
@ -1112,8 +1120,8 @@ nsARIAGridCellAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
// Check aria-selected="true" on the row.
nsAccessible *row = GetParent();
if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* row = GetParent();
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsIContent *rowContent = row->GetContent();
@ -1141,8 +1149,8 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
// Expose "table-cell-index" attribute.
nsAccessible *thisRow = GetParent();
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* thisRow = GetParent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
PRInt32 colIdx = 0, colCount = 0;
@ -1152,16 +1160,20 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
if (child == this)
colIdx = colCount;
PRUint32 role = nsAccUtils::Role(child);
PRUint32 role = child->Role();
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
colCount++;
}
nsAccessible *table = thisRow->GetParent();
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* table = thisRow->GetParent();
if (!table)
return NS_OK;
PRUint32 tableRole = table->Role();
if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
return NS_OK;
PRInt32 rowIdx = 0;
@ -1171,7 +1183,7 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
if (child == thisRow)
break;
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_ROW)
if (child->Role() == nsIAccessibleRole::ROLE_ROW)
rowIdx++;
}

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

@ -103,14 +103,14 @@ nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32
nsAccUtils::GetDefaultLevel(nsAccessible *aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM)
return 1;
if (role == nsIAccessibleRole::ROLE_ROW) {
nsAccessible *parent = aAccessible->GetParent();
if (Role(parent) == nsIAccessibleRole::ROLE_TREE_TABLE) {
if (parent && parent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE) {
// It is a row inside flatten treegrid. Group level is always 1 until it
// is overriden by aria-level attribute.
return 1;
@ -357,7 +357,7 @@ nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
nsAccessible *document = aDescendant->GetDocAccessible();
nsAccessible *parent = aDescendant;
while ((parent = parent->GetParent())) {
PRUint32 testRole = nsAccUtils::Role(parent);
PRUint32 testRole = parent->Role();
if (testRole == aRole)
return parent;
@ -578,23 +578,6 @@ nsAccUtils::GetRoleMapEntry(nsINode *aNode)
return &nsARIAMap::gLandmarkRoleMap;
}
PRUint32
nsAccUtils::RoleInternal(nsIAccessible *aAcc)
{
PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
if (aAcc) {
nsAccessible* accessible = nsnull;
CallQueryInterface(aAcc, &accessible);
if (accessible) {
accessible->GetRoleInternal(&role);
NS_RELEASE(accessible);
}
}
return role;
}
PRUint8
nsAccUtils::GetAttributeCharacteristics(nsIAtom* aAtom)
{

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

@ -297,11 +297,6 @@ public:
return role;
}
/**
* Return the role from native markup of the given accessible.
*/
static PRUint32 RoleInternal(nsIAccessible *aAcc);
/**
* Return the state for the given accessible.
*/

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

@ -943,7 +943,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
if (tableAccessible) {
if (!roleMapEntry) {
PRUint32 role = nsAccUtils::Role(tableAccessible);
PRUint32 role = tableAccessible->Role();
if (role != nsIAccessibleRole::ROLE_TABLE &&
role != nsIAccessibleRole::ROLE_TREE_TABLE) {
// No ARIA role and not in table: override role. For example,

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

@ -1263,52 +1263,8 @@ nsAccessible::GetRole(PRUint32 *aRole)
if (IsDefunct())
return NS_ERROR_FAILURE;
if (mRoleMapEntry) {
*aRole = mRoleMapEntry->role;
// These unfortunate exceptions don't fit into the ARIA table
// This is where the nsIAccessible role depends on both the role and ARIA state
if (*aRole == nsIAccessibleRole::ROLE_PUSHBUTTON) {
if (nsAccUtils::HasDefinedARIAToken(mContent,
nsAccessibilityAtoms::aria_pressed)) {
// For simplicity, any existing pressed attribute except "", or "undefined"
// indicates a toggle.
*aRole = nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
} else if (mContent->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::aria_haspopup,
nsAccessibilityAtoms::_true,
eCaseMatters)) {
// For button with aria-haspopup="true".
*aRole = nsIAccessibleRole::ROLE_BUTTONMENU;
}
}
else if (*aRole == nsIAccessibleRole::ROLE_LISTBOX) {
// A listbox inside of a combo box needs a special role because of ATK mapping to menu
nsCOMPtr<nsIAccessible> possibleCombo;
GetParent(getter_AddRefs(possibleCombo));
if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
else { // Check to see if combo owns the listbox instead
possibleCombo = nsRelUtils::
GetRelatedAccessible(this, nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
}
else if (*aRole == nsIAccessibleRole::ROLE_OPTION) {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
}
// We are done if the mapped role trumps native semantics
if (mRoleMapEntry->roleRule == kUseMapRole)
return NS_OK;
}
return GetRoleInternal(aRole);
*aRole = Role();
return NS_OK;
}
NS_IMETHODIMP
@ -1627,10 +1583,6 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
}
}
PRUint32 role;
rv = GetRole(&role);
NS_ENSURE_SUCCESS(rv, rv);
// For some reasons DOM node may have not a frame. We tract such accessibles
// as invisible.
nsIFrame *frame = GetFrame();
@ -1852,19 +1804,57 @@ nsAccessible::GetKeyBindings(PRUint8 aActionIndex,
return NS_OK;
}
/* unsigned long getRole (); */
nsresult
nsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsAccessible::Role()
{
*aRole = nsIAccessibleRole::ROLE_NOTHING;
// No ARIA role or it doesn't suppress role from native markup.
if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
return NativeRole();
if (IsDefunct())
return NS_ERROR_FAILURE;
// XXX: these unfortunate exceptions don't fit into the ARIA table. This is
// where the accessible role depends on both the role and ARIA state.
if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
if (nsAccUtils::HasDefinedARIAToken(mContent,
nsAccessibilityAtoms::aria_pressed)) {
// For simplicity, any existing pressed attribute except "" or "undefined"
// indicates a toggle.
return nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
}
if (nsCoreUtils::IsXLink(mContent))
*aRole = nsIAccessibleRole::ROLE_LINK;
if (mContent->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::aria_haspopup,
nsAccessibilityAtoms::_true,
eCaseMatters)) {
// For button with aria-haspopup="true".
return nsIAccessibleRole::ROLE_BUTTONMENU;
}
return NS_OK;
} else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_LISTBOX) {
// A listbox inside of a combobox needs a special role because of ATK
// mapping to menu.
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX) {
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
nsCOMPtr<nsIAccessible> possibleCombo =
nsRelUtils::GetRelatedAccessible(this,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
} else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_OPTION) {
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
}
return mRoleMapEntry->role;
}
PRUint32
nsAccessible::NativeRole()
{
return nsCoreUtils::IsXLink(mContent) ?
nsIAccessibleRole::ROLE_LINK : nsIAccessibleRole::ROLE_NOTHING;
}
// readonly attribute PRUint8 numActions
@ -2785,9 +2775,7 @@ nsAccessible::GetParent()
// XXX: mParent can be null randomly because supposedly we get layout
// notification and invalidate parent-child relations, this accessible stays
// unattached. This should gone after bug 572951. Other reason is bug 574588
// since CacheChildren() implementation calls nsAccessible::GetRole() what
// can need to get a parent and we are here as result.
// unattached. This should gone after bug 572951.
NS_WARNING("Bad accessible tree!");
#ifdef DEBUG
@ -3364,7 +3352,7 @@ nsAccessible::GetLevelInternal()
{
PRInt32 level = nsAccUtils::GetDefaultLevel(this);
PRUint32 role = nsAccUtils::Role(this);
PRUint32 role = Role();
nsAccessible* parent = GetParent();
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
@ -3374,7 +3362,7 @@ nsAccessible::GetLevelInternal()
level = 1;
while (parent) {
PRUint32 parentRole = nsAccUtils::Role(parent);
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
break;
@ -3394,7 +3382,7 @@ nsAccessible::GetLevelInternal()
level = 0;
while (parent) {
PRUint32 parentRole = nsAccUtils::Role(parent);
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
++ level;

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

@ -143,13 +143,16 @@ public:
*/
virtual nsresult GetNameInternal(nsAString& aName);
/**
* Return enumerated accessible role (see constants in nsIAccessibleRole).
*/
virtual PRUint32 Role();
/**
* Returns enumerated accessible role from native markup (see constants in
* nsIAccessibleRole). Doesn't take into account ARIA roles.
*
* @param aRole [out] accessible role.
*/
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
/**
* Return the state of accessible that doesn't take into account ARIA states.

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

@ -139,13 +139,6 @@ nsApplicationAccessible::GetKeyboardShortcut(nsAString &aKeyboardShortcut)
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetRole(PRUint32 *aRole)
{
NS_ENSURE_ARG_POINTER(aRole);
return GetRoleInternal(aRole);
}
NS_IMETHODIMP
nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
@ -379,11 +372,16 @@ nsApplicationAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
}
nsresult
nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsApplicationAccessible::Role()
{
*aRole = nsIAccessibleRole::ROLE_APP_ROOT;
return NS_OK;
return NativeRole();
}
PRUint32
nsApplicationAccessible::NativeRole()
{
return nsIAccessibleRole::ROLE_APP_ROOT;
}
nsresult

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

@ -81,7 +81,6 @@ public:
NS_IMETHOD GetValue(nsAString &aValue);
NS_IMETHOD GetDescription(nsAString &aDescription);
NS_IMETHOD GetKeyboardShortcut(nsAString &aKeyboardShortcut);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState , PRUint32 *aExtraState );
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
@ -113,7 +112,8 @@ public:
// nsAccessible
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 Role();
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual void InvalidateChildren();

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

@ -257,17 +257,17 @@ nsLinkableAccessible::CacheActionContent()
}
while ((walkUpContent = walkUpContent->GetParent())) {
isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
nsAccessible *walkUpAcc =
nsAccessible* walkUpAcc =
GetAccService()->GetAccessibleInWeakShell(walkUpContent, mWeakShell);
if (nsAccUtils::Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK &&
if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
nsAccUtils::State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED) {
mIsLink = PR_TRUE;
mActionContent = walkUpContent;
return;
}
isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
if (isOnclick) {
mActionContent = walkUpContent;
mIsOnclick = PR_TRUE;
@ -302,9 +302,8 @@ nsEnumRoleAccessible::
NS_IMPL_ISUPPORTS_INHERITED0(nsEnumRoleAccessible, nsAccessible)
nsresult
nsEnumRoleAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsEnumRoleAccessible::NativeRole()
{
*aRole = mRole;
return NS_OK;
return mRole;
}

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

@ -135,7 +135,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
PRUint32 mRole;

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

@ -203,11 +203,9 @@ nsDocAccessible::GetName(nsAString& aName)
}
// nsAccessible public method
nsresult
nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsDocAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(mDocument);
if (docShellTreeItem) {
@ -217,28 +215,24 @@ nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
docShellTreeItem->GetItemType(&itemType);
if (sameTypeRoot == docShellTreeItem) {
// Root of content or chrome tree
if (itemType == nsIDocShellTreeItem::typeChrome) {
*aRole = nsIAccessibleRole::ROLE_CHROME_WINDOW;
}
else if (itemType == nsIDocShellTreeItem::typeContent) {
if (itemType == nsIDocShellTreeItem::typeChrome)
return nsIAccessibleRole::ROLE_CHROME_WINDOW;
if (itemType == nsIDocShellTreeItem::typeContent) {
#ifdef MOZ_XUL
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (xulDoc) {
*aRole = nsIAccessibleRole::ROLE_APPLICATION;
} else {
*aRole = nsIAccessibleRole::ROLE_DOCUMENT;
}
#else
*aRole = nsIAccessibleRole::ROLE_DOCUMENT;
if (xulDoc)
return nsIAccessibleRole::ROLE_APPLICATION;
#endif
return nsIAccessibleRole::ROLE_DOCUMENT;
}
}
else if (itemType == nsIDocShellTreeItem::typeContent) {
*aRole = nsIAccessibleRole::ROLE_DOCUMENT;
return nsIAccessibleRole::ROLE_DOCUMENT;
}
}
return NS_OK;
return nsIAccessibleRole::ROLE_PANE; // Fall back;
}
// nsAccessible public method
@ -1291,7 +1285,7 @@ nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
void
nsDocAccessible::FireValueChangeForTextFields(nsAccessible *aAccessible)
{
if (nsAccUtils::Role(aAccessible) != nsIAccessibleRole::ROLE_ENTRY)
if (aAccessible->Role() != nsIAccessibleRole::ROLE_ENTRY)
return;
// Dependent value change event for text changes in textfields
@ -1378,7 +1372,7 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
PRInt32 offset = 0;
if (aChangeChild) {
// Don't fire event for the first html:br in an editor.
if (nsAccUtils::Role(aChangeChild) == nsIAccessibleRole::ROLE_WHITESPACE) {
if (aChangeChild->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
nsCOMPtr<nsIEditor> editor;
textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
if (editor) {
@ -1630,8 +1624,7 @@ nsDocAccessible::RefreshNodes(nsINode *aStartNode)
nsAccessible *accessible = GetCachedAccessible(aStartNode);
if (accessible) {
// Fire menupopup end if a menu goes away
PRUint32 role = nsAccUtils::Role(accessible);
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(aStartNode));
if (!popup) {
// Popup elements already fire these via DOMMenuInactive

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

@ -110,7 +110,7 @@ public:
virtual nsINode* GetNode() const { return mDocument; }
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);

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

@ -532,8 +532,7 @@ nsAccEventQueue::CreateTextChangeEventFor(AccHideEvent* aEvent)
return;
// Don't fire event for the first html:br in an editor.
if (nsAccUtils::Role(aEvent->mAccessible) ==
nsIAccessibleRole::ROLE_WHITESPACE) {
if (aEvent->mAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
nsCOMPtr<nsIEditor> editor;
textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
if (editor) {

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

@ -82,10 +82,9 @@ nsRadioButtonAccessible::DoAction(PRUint8 aIndex)
return NS_OK;
}
nsresult
nsRadioButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsRadioButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_RADIOBUTTON;
}

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

@ -58,7 +58,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
enum { eAction_Click = 0 };
};

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

@ -60,11 +60,10 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible,
////////////////////////////////////////////////////////////////////////////////
// nsAccessible public (DON'T add methods here)
nsresult
nsOuterDocAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsOuterDocAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
return NS_OK;
return nsIAccessibleRole::ROLE_INTERNAL_FRAME;
}
nsresult

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

@ -67,7 +67,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,

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

@ -142,14 +142,9 @@ nsRootAccessible::GetName(nsAString& aName)
return document->GetTitle(aName);
}
/* readonly attribute unsigned long accRole; */
nsresult
nsRootAccessible::GetRoleInternal(PRUint32 *aRole)
{
if (!mDocument) {
return NS_ERROR_FAILURE;
}
PRUint32
nsRootAccessible::NativeRole()
{
// If it's a <dialog> or <wizard>, use nsIAccessibleRole::ROLE_DIALOG instead
dom::Element *root = mDocument->GetRootElement();
if (root) {
@ -158,13 +153,12 @@ nsRootAccessible::GetRoleInternal(PRUint32 *aRole)
nsAutoString name;
rootElement->GetLocalName(name);
if (name.EqualsLiteral("dialog") || name.EqualsLiteral("wizard")) {
*aRole = nsIAccessibleRole::ROLE_DIALOG; // Always at the root
return NS_OK;
return nsIAccessibleRole::ROLE_DIALOG; // Always at the root
}
}
}
return nsDocAccessibleWrap::GetRoleInternal(aRole);
return nsDocAccessibleWrap::NativeRole();
}
// nsRootAccessible protected member
@ -391,12 +385,11 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
}
gLastFocusedAccessiblesState = nsAccUtils::State(finalFocusAccessible);
PRUint32 role = nsAccUtils::Role(finalFocusAccessible);
PRUint32 role = finalFocusAccessible->Role();
if (role == nsIAccessibleRole::ROLE_MENUITEM) {
if (!mCurrentARIAMenubar) { // Entering menus
// The natural role is the role that this type of element normally has
PRUint32 naturalRole = nsAccUtils::RoleInternal(finalFocusAccessible);
if (role != naturalRole) { // Must be a DHTML menuitem
if (role != finalFocusAccessible->NativeRole()) { // Must be a DHTML menuitem
nsAccessible *menuBarAccessible =
nsAccUtils::GetAncestorWithRole(finalFocusAccessible,
nsIAccessibleRole::ROLE_MENUBAR);
@ -680,7 +673,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
HandlePopupShownEvent(accessible);
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (nsAccUtils::Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
@ -714,7 +707,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
if (nsAccUtils::State(containerAccessible) & nsIAccessibleStates::STATE_COLLAPSED) {
nsAccessible *containerParent = containerAccessible->GetParent();
NS_ENSURE_TRUE(containerParent, NS_ERROR_FAILURE);
if (nsAccUtils::Role(containerParent) != nsIAccessibleRole::ROLE_COMBOBOX) {
if (containerParent->Role() != nsIAccessibleRole::ROLE_COMBOBOX) {
return NS_OK;
}
}
@ -863,7 +856,7 @@ nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
nsresult
nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
// Don't fire menupopup events for combobox and autocomplete lists.
@ -883,12 +876,14 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
// Fire expanded state change event for comboboxes and autocompeletes.
nsAccessible *comboboxAcc = aAccessible->GetParent();
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
nsAccessible* combobox = aAccessible->GetParent();
NS_ENSURE_STATE(combobox);
PRUint32 comboboxRole = combobox->Role();
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(comboboxAcc,
new AccStateChangeEvent(combobox,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_TRUE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
@ -921,16 +916,17 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode *aNode,
if (!aAccessible)
return NS_OK;
PRUint32 role = nsAccUtils::Role(aAccessible);
if (role != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
if (aAccessible->Role() != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return NS_OK;
nsAccessible *comboboxAcc = aAccessible->GetParent();
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
nsAccessible* combobox = aAccessible->GetParent();
NS_ENSURE_STATE(combobox);
PRUint32 comboboxRole = combobox->Role();
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(comboboxAcc,
new AccStateChangeEvent(combobox,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_FALSE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);

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

@ -84,7 +84,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// nsRootAccessible

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

@ -50,11 +50,10 @@ nsTextAccessible::
{
}
nsresult
nsTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsTextAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_TEXT_LEAF;
return NS_OK;
return nsIAccessibleRole::ROLE_TEXT_LEAF;
}
nsresult

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

@ -50,7 +50,7 @@ public:
nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
PRUint32 aLength);

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

@ -64,9 +64,7 @@ nsTextEquivUtils::GetNameFromSubtree(nsAccessible *aAccessible,
gInitiatorAcc = aAccessible;
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule == eFromSubtree) {
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsContent()) {
@ -269,9 +267,7 @@ nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
// into subtree if accessible allows "text equivalent from subtree rule" or
// it's not root and not control.
if (isEmptyTextEquiv) {
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule & eFromSubtreeIfRec) {
rv = AppendFromAccessibleChildren(aAccessible, aString);
NS_ENSURE_SUCCESS(rv, rv);
@ -294,9 +290,7 @@ nsresult
nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
nsAString *aString)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule != eFromValue)
return NS_OK_NO_NAME_CLAUSE_HANDLED;

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

@ -69,11 +69,10 @@ nsHTMLCheckboxAccessible::
{
}
nsresult
nsHTMLCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLCheckboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetNumActions(PRUint8 *_retval)
@ -282,11 +281,10 @@ nsHTMLButtonAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsHTMLButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -359,11 +357,10 @@ nsHTML4ButtonAccessible::DoAction(PRUint8 aIndex)
return NS_OK;
}
nsresult
nsHTML4ButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTML4ButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -396,16 +393,14 @@ nsHTMLTextFieldAccessible::
NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsresult
nsHTMLTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLTextFieldAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ENTRY;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::password, eIgnoreCase)) {
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
}
return NS_OK;
return nsIAccessibleRole::ROLE_ENTRY;
}
nsresult
@ -465,7 +460,8 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
*aState |= nsIAccessibleStates::STATE_PROTECTED;
}
else {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
nsAccessible* parent = GetParent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
}
@ -588,11 +584,10 @@ nsHTMLGroupboxAccessible::
{
}
nsresult
nsHTMLGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLGroupboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
nsIContent* nsHTMLGroupboxAccessible::GetLegend()
@ -668,7 +663,7 @@ nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
// Look for groupbox parent
nsAccessible* groupbox = GetParent();
if (nsAccUtils::Role(groupbox) == nsIAccessibleRole::ROLE_GROUPING) {
if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING) {
// XXX: if group box exposes more than one relation of the given type
// then we fail.
nsCOMPtr<nsIAccessible> testLabelAccessible =
@ -687,9 +682,8 @@ nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
return NS_OK;
}
nsresult
nsHTMLLegendAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLegendAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}

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

@ -59,7 +59,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -99,7 +99,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -121,7 +121,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -150,7 +150,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -169,7 +169,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
nsIContent* GetLegend();
@ -189,7 +189,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

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

@ -120,11 +120,10 @@ nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsHTMLImageAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLImageAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GRAPHIC;
return NS_OK;
return nsIAccessibleRole::ROLE_GRAPHIC;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -66,7 +66,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);

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

@ -68,11 +68,10 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, nsHTMLImageAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsHTMLImageMapAccessible: nsAccessible public
nsresult
nsHTMLImageMapAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLImageMapAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_IMAGE_MAP;
return NS_OK;
return nsIAccessibleRole::ROLE_IMAGE_MAP;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
// HyperLinkAccessible
virtual PRUint32 AnchorCount();

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

@ -60,11 +60,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
nsresult
nsHTMLLinkAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLinkAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LINK;
return NS_OK;
return nsIAccessibleRole::ROLE_LINK;
}
nsresult

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

@ -57,7 +57,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// HyperLinkAccessible

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

@ -101,15 +101,13 @@ nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsHTMLSelectListAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLSelectListAccessible::NativeRole()
{
if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
else
*aRole = nsIAccessibleRole::ROLE_LISTBOX;
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LISTBOX;
}
////////////////////////////////////////////////////////////////////////////////
@ -198,15 +196,13 @@ nsHTMLSelectOptionAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsHTMLSelectOptionAccessible: nsAccessible public
nsresult
nsHTMLSelectOptionAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLSelectOptionAccessible::NativeRole()
{
if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
else
*aRole = nsIAccessibleRole::ROLE_OPTION;
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return NS_OK;
return nsIAccessibleRole::ROLE_OPTION;
}
nsresult
@ -352,10 +348,8 @@ nsHTMLSelectOptionAccessible::GetLevelInternal()
PRInt32 level =
parentContent->NodeInfo()->Equals(nsAccessibilityAtoms::optgroup) ? 2 : 1;
if (level == 1 &&
nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_HEADING) {
if (level == 1 && Role() != nsIAccessibleRole::ROLE_HEADING)
level = 0; // In a single level list, the level is irrelevant
}
return level;
}
@ -621,11 +615,10 @@ nsHTMLSelectOptGroupAccessible::
{
}
nsresult
nsHTMLSelectOptGroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLSelectOptGroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_HEADING;
return NS_OK;
return nsIAccessibleRole::ROLE_HEADING;
}
nsresult
@ -681,11 +674,10 @@ nsHTMLComboboxAccessible::
{
}
nsresult
nsHTMLComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLComboboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
return NS_OK;
return nsIAccessibleRole::ROLE_COMBOBOX;
}
void

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

@ -73,7 +73,7 @@ public:
virtual ~nsHTMLSelectListAccessible() {}
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// SelectAccessible
@ -113,7 +113,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRInt32 GetLevelInternal();
@ -158,7 +158,7 @@ public:
NS_IMETHOD GetNumActions(PRUint8 *_retval);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
@ -194,7 +194,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

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

@ -86,11 +86,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible,
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableCellAccessible: nsAccessible implementation
nsresult
nsHTMLTableCellAccessible::GetRoleInternal(PRUint32 *aResult)
PRUint32
nsHTMLTableCellAccessible::NativeRole()
{
*aResult = nsIAccessibleRole::ROLE_CELL;
return NS_OK;
return nsIAccessibleRole::ROLE_CELL;
}
nsresult
@ -268,20 +267,15 @@ nsHTMLTableCellAccessible::IsSelected(PRBool *aIsSelected)
already_AddRefed<nsIAccessibleTable>
nsHTMLTableCellAccessible::GetTableAccessible()
{
nsCOMPtr<nsIAccessible> childAcc(this), parentAcc;
childAcc->GetParent(getter_AddRefs(parentAcc));
while (parentAcc) {
PRUint32 role = nsAccUtils::Role(parentAcc);
nsAccessible* parent = this;
while ((parent = parent->GetParent())) {
PRUint32 role = parent->Role();
if (role == nsIAccessibleRole::ROLE_TABLE ||
role == nsIAccessibleRole::ROLE_TREE_TABLE) {
nsIAccessibleTable* tableAcc = nsnull;
CallQueryInterface(parentAcc, &tableAcc);
CallQueryInterface(parent, &tableAcc);
return tableAcc;
}
parentAcc.swap(childAcc);
childAcc->GetParent(getter_AddRefs(parentAcc));
}
return nsnull;
@ -335,9 +329,9 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
if (headerCell &&
(aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells &&
nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_ROWHEADER ||
headerCell->Role() == nsIAccessibleRole::ROLE_ROWHEADER ||
aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells &&
nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_COLUMNHEADER))
headerCell->Role() == nsIAccessibleRole::ROLE_COLUMNHEADER))
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
PR_FALSE);
}
@ -372,8 +366,8 @@ nsHTMLTableHeaderCellAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableHeaderAccessible: nsAccessible implementation
nsresult
nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLTableHeaderCellAccessible::NativeRole()
{
// Check value of @scope attribute.
static nsIContent::AttrValuesArray scopeValues[] =
@ -384,17 +378,18 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
switch (valueIdx) {
case 0:
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
case 1:
*aRole = nsIAccessibleRole::ROLE_ROWHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_ROWHEADER;
}
// Assume it's columnheader if there are headers in siblings, oterwise
// rowheader.
nsIContent *parent = mContent->GetParent();
NS_ENSURE_STATE(parent);
if (!parent) {
NS_ERROR("Deattached content on alive accessible?");
return nsIAccessibleRole::ROLE_NOTHING;
}
PRInt32 indexInParent = parent->IndexOf(mContent);
@ -402,11 +397,8 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
nsIContent* sibling = parent->GetChildAt(idx);
if (sibling && sibling->IsElement()) {
if (nsCoreUtils::IsHTMLTableHeader(sibling))
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
else
*aRole = nsIAccessibleRole::ROLE_ROWHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
return nsIAccessibleRole::ROLE_ROWHEADER;
}
}
@ -415,19 +407,14 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
nsIContent* sibling = parent->GetChildAt(idx);
if (sibling && sibling->IsElement()) {
if (nsCoreUtils::IsHTMLTableHeader(sibling))
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
else
*aRole = nsIAccessibleRole::ROLE_ROWHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
return nsIAccessibleRole::ROLE_ROWHEADER;
}
}
// No elements in siblings what means the table has one column only. Therefore
// it should be column header.
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
}
////////////////////////////////////////////////////////////////////////////////
@ -461,7 +448,7 @@ nsHTMLTableAccessible::CacheChildren()
nsRefPtr<nsAccessible> child;
while ((child = walker.GetNextChild())) {
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_CAPTION) {
if (child->Role() == nsIAccessibleRole::ROLE_CAPTION) {
InsertChildAt(0, child);
while ((child = walker.GetNextChild()) && AppendChild(child));
break;
@ -470,11 +457,10 @@ nsHTMLTableAccessible::CacheChildren()
}
}
nsresult
nsHTMLTableAccessible::GetRoleInternal(PRUint32 *aResult)
PRUint32
nsHTMLTableAccessible::NativeRole()
{
*aResult = nsIAccessibleRole::ROLE_TABLE;
return NS_OK;
return nsIAccessibleRole::ROLE_TABLE;
}
nsresult
@ -541,9 +527,8 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
NS_IMETHODIMP
nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
{
nsCOMPtr<nsIAccessible> firstChild;
GetFirstChild(getter_AddRefs(firstChild));
if (nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_CAPTION)
nsAccessible* firstChild = GetChildAt(0);
if (firstChild && firstChild->Role() == nsIAccessibleRole::ROLE_CAPTION)
NS_ADDREF(*aCaption = firstChild);
return NS_OK;
@ -1398,8 +1383,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
// Check to see if an ARIA role overrides the role from native markup,
// but for which we still expose table semantics (treegrid, for example).
PRBool hasNonTableRole =
(nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_TABLE);
PRBool hasNonTableRole = (Role() != nsIAccessibleRole::ROLE_TABLE);
if (hasNonTableRole) {
RETURN_LAYOUT_ANSWER(PR_FALSE, "Has role attribute");
}
@ -1560,9 +1544,8 @@ nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
return NS_OK;
}
nsresult
nsHTMLCaptionAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLCaptionAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CAPTION;
return NS_OK;
return nsIAccessibleRole::ROLE_CAPTION;
}

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

@ -61,7 +61,7 @@ public:
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
@ -99,7 +99,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -137,7 +137,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
@ -215,7 +215,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

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

@ -68,18 +68,17 @@ nsHTMLTextAccessible::GetName(nsAString& aName)
return AppendTextTo(aName, 0, PR_UINT32_MAX);
}
nsresult
nsHTMLTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLTextAccessible::NativeRole()
{
nsIFrame *frame = GetFrame();
// Don't return on null frame -- we still return a role
// after accessible is shutdown/DEFUNCT
if (frame && frame->IsGeneratedContentFrame()) {
*aRole = nsIAccessibleRole::ROLE_STATICTEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_STATICTEXT;
}
return nsTextAccessible::GetRoleInternal(aRole);
return nsTextAccessible::NativeRole();
}
nsresult
@ -103,9 +102,7 @@ nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
nsresult
nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
PRUint32 role;
GetRoleInternal(&role);
if (role == nsIAccessibleRole::ROLE_STATICTEXT) {
if (NativeRole() == nsIAccessibleRole::ROLE_STATICTEXT) {
nsAutoString oldValueUnused;
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
NS_LITERAL_STRING("true"), oldValueUnused);
@ -125,11 +122,10 @@ nsHTMLHRAccessible::
{
}
nsresult
nsHTMLHRAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLHRAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SEPARATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_SEPARATOR;
}
@ -143,11 +139,10 @@ nsHTMLBRAccessible::
{
}
nsresult
nsHTMLBRAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLBRAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_WHITESPACE;
return NS_OK;
return nsIAccessibleRole::ROLE_WHITESPACE;
}
nsresult
@ -194,11 +189,10 @@ nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
return nsTextEquivUtils::GetNameFromSubtree(this, aName);
}
nsresult
nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLabelAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}
////////////////////////////////////////////////////////////////////////////////
@ -232,11 +226,10 @@ nsHTMLLIAccessible::Shutdown()
mBulletAccessible = nsnull;
}
nsresult
nsHTMLLIAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLIAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LISTITEM;
return NS_OK;
return nsIAccessibleRole::ROLE_LISTITEM;
}
nsresult
@ -315,11 +308,10 @@ nsHTMLListBulletAccessible::GetName(nsAString &aName)
return NS_OK;
}
nsresult
nsHTMLListBulletAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLListBulletAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_STATICTEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_STATICTEXT;
}
nsresult
@ -357,11 +349,10 @@ nsHTMLListAccessible::
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListAccessible, nsHyperTextAccessible)
nsresult
nsHTMLListAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLListAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LIST;
}
nsresult

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

@ -60,7 +60,7 @@ public:
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -73,7 +73,7 @@ public:
nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -86,7 +86,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -102,7 +102,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -124,7 +124,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
PRUint32 aLength);
@ -151,7 +151,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -174,7 +174,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

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

@ -126,42 +126,35 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
return nsAccessible::QueryInterface(aIID, aInstancePtr);
}
nsresult
nsHyperTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHyperTextAccessible::NativeRole()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsIAtom *tag = mContent->Tag();
if (tag == nsAccessibilityAtoms::form) {
*aRole = nsIAccessibleRole::ROLE_FORM;
if (tag == nsAccessibilityAtoms::form)
return nsIAccessibleRole::ROLE_FORM;
if (tag == nsAccessibilityAtoms::div ||
tag == nsAccessibilityAtoms::blockquote)
return nsIAccessibleRole::ROLE_SECTION;
if (tag == nsAccessibilityAtoms::h1 ||
tag == nsAccessibilityAtoms::h2 ||
tag == nsAccessibilityAtoms::h3 ||
tag == nsAccessibilityAtoms::h4 ||
tag == nsAccessibilityAtoms::h5 ||
tag == nsAccessibilityAtoms::h6)
return nsIAccessibleRole::ROLE_HEADING;
nsIFrame *frame = GetFrame();
if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame &&
frame->GetContent()->Tag() != nsAccessibilityAtoms::input) {
// An html:input @type="file" is the only input that is exposed as a
// blockframe. It must be exposed as ROLE_TEXT_CONTAINER for JAWS.
return nsIAccessibleRole::ROLE_PARAGRAPH;
}
else if (tag == nsAccessibilityAtoms::div ||
tag == nsAccessibilityAtoms::blockquote) {
*aRole = nsIAccessibleRole::ROLE_SECTION;
}
else if (tag == nsAccessibilityAtoms::h1 ||
tag == nsAccessibilityAtoms::h2 ||
tag == nsAccessibilityAtoms::h3 ||
tag == nsAccessibilityAtoms::h4 ||
tag == nsAccessibilityAtoms::h5 ||
tag == nsAccessibilityAtoms::h6) {
*aRole = nsIAccessibleRole::ROLE_HEADING;
}
else {
nsIFrame *frame = GetFrame();
if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame &&
frame->GetContent()->Tag() != nsAccessibilityAtoms::input) {
// An html:input @type="file" is the only input that is exposed as a
// blockframe. It must be exposed as ROLE_TEXT_CONTAINER for JAWS.
*aRole = nsIAccessibleRole::ROLE_PARAGRAPH;
}
else {
*aRole = nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
}
}
return NS_OK;
return nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
}
nsresult
@ -286,8 +279,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
PRInt32 startOffset = aStartOffset;
PRInt32 endOffset = aEndOffset;
// XXX this prevents text interface usage on <input type="password">
PRBool isPassword =
(nsAccUtils::Role(this) == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
PRBool isPassword = (Role() == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
// Clear out parameters and set up loop
if (aText) {
@ -811,7 +803,7 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
nsAccessible *firstChild = mChildren.SafeElementAt(0, nsnull);
// For line selection with needsStart, set start of line exactly to line break
if (pos.mContentOffset == 0 && firstChild &&
nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_STATICTEXT &&
firstChild->Role() == nsIAccessibleRole::ROLE_STATICTEXT &&
static_cast<PRInt32>(nsAccUtils::TextLength(firstChild)) == hyperTextOffset) {
// XXX Bullet hack -- we should remove this once list bullets use anonymous content
hyperTextOffset = 0;
@ -823,7 +815,7 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
else if (aAmount == eSelectEndLine && finalAccessible) {
// If not at very end of hypertext, we may need change the end of line offset by 1,
// to make sure we are in the right place relative to the line ending
if (nsAccUtils::Role(finalAccessible) == nsIAccessibleRole::ROLE_WHITESPACE) { // Landed on <br> hard line break
if (finalAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) { // Landed on <br> hard line break
// if aNeedsStart, set end of line exactly 1 character past line break
// XXX It would be cleaner if we did not have to have the hard line break check,
// and just got the correct results from PeekOffset() for the <br> case -- the returned offset should
@ -990,7 +982,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
nsRefPtr<nsAccessible> endAcc;
nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
nsnull, getter_AddRefs(endAcc));
if (nsAccUtils::Role(endAcc) == nsIAccessibleRole::ROLE_STATICTEXT) {
if (endAcc && endAcc->Role() == nsIAccessibleRole::ROLE_STATICTEXT) {
// Static text like list bullets will ruin our forward calculation,
// since the caret cannot be in the static text. Start just after the static text.
startOffset = endOffset = finalStartOffset +

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

@ -86,7 +86,7 @@ public:
// nsAccessible
virtual PRInt32 GetLevelInternal();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual void InvalidateChildren();

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

@ -135,7 +135,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
if ((self = [super init])) {
mGeckoAccessible = geckoAccessible;
mIsExpired = NO;
geckoAccessible->GetRole(&mRole);
mRole = geckoAccessible->Role();
// Check for OS X "role skew"; the role constants in nsIAccessible.idl need to match the ones
// in nsRoleMap.h.

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

@ -104,7 +104,7 @@ nsAccessibleWrap::GetNativeType ()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
PRUint32 role = nsAccUtils::Role(this);
PRUint32 role = Role();
switch (role) {
case nsIAccessibleRole::ROLE_PUSHBUTTON:
case nsIAccessibleRole::ROLE_SPLITBUTTON:

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

@ -399,11 +399,8 @@ __try {
"Does not support nsIAccessibleText when it should");
#endif
PRUint32 xpRole = 0, msaaRole = 0;
if (NS_FAILED(xpAccessible->GetRole(&xpRole)))
return E_FAIL;
msaaRole = gWindowsRoleMap[xpRole].msaaRole;
PRUint32 xpRole = xpAccessible->Role();
PRUint32 msaaRole = gWindowsRoleMap[xpRole].msaaRole;
NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].msaaRole == ROLE_WINDOWS_LAST_ENTRY,
"MSAA role map skewed");
@ -411,7 +408,8 @@ __try {
// a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* xpParent = GetParent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -1192,20 +1190,17 @@ nsAccessibleWrap::role(long *aRole)
__try {
*aRole = 0;
PRUint32 xpRole = 0;
nsresult rv = GetRole(&xpRole);
if (NS_FAILED(rv))
return GetHRESULT(rv);
NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
"MSAA role map skewed");
PRUint32 xpRole = Role();
*aRole = gWindowsRoleMap[xpRole].ia2Role;
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* xpParent = GetParent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}

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

@ -262,7 +262,7 @@ STDMETHODIMP nsDocAccessibleWrap::get_accValue(
if (FAILED(hr) || *pszValue || varChild.lVal != CHILDID_SELF)
return hr;
// If document is being used to create a widget, don't use the URL hack
PRUint32 role = nsAccUtils::Role(this);
PRUint32 role = Role();
if (role != nsIAccessibleRole::ROLE_DOCUMENT &&
role != nsIAccessibleRole::ROLE_APPLICATION &&
role != nsIAccessibleRole::ROLE_DIALOG &&

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

@ -64,13 +64,10 @@ nsHTMLWin32ObjectOwnerAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsHTMLWin32ObjectOwnerAccessible: nsAccessible implementation
nsresult
nsHTMLWin32ObjectOwnerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLWin32ObjectOwnerAccessible::NativeRole()
{
NS_ENSURE_ARG_POINTER(aRole);
*aRole = nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
return NS_OK;
return nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
}
nsresult

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

@ -61,7 +61,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

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

@ -244,11 +244,10 @@ nsXFormsContainerAccessible::
{
}
nsresult
nsXFormsContainerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsContainerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
PRBool

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

@ -128,7 +128,7 @@ public:
nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
// Allows accessible nodes in anonymous content of xforms element by
// always returning PR_TRUE value.

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

@ -50,11 +50,10 @@ nsXFormsLabelAccessible::
{
}
nsresult
nsXFormsLabelAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsLabelAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}
nsresult
@ -86,11 +85,10 @@ nsXFormsOutputAccessible::
{
}
nsresult
nsXFormsOutputAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsOutputAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_STATICTEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_STATICTEXT;
}
@ -104,11 +102,10 @@ nsXFormsTriggerAccessible::
{
}
nsresult
nsXFormsTriggerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsTriggerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
NS_IMETHODIMP
@ -160,11 +157,10 @@ nsXFormsInputAccessible::
NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsresult
nsXFormsInputAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsInputAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ENTRY;
return NS_OK;
return nsIAccessibleRole::ROLE_ENTRY;
}
NS_IMETHODIMP
@ -207,11 +203,10 @@ nsXFormsInputBooleanAccessible::
{
}
nsresult
nsXFormsInputBooleanAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsInputBooleanAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
nsresult
@ -281,11 +276,10 @@ nsXFormsInputDateAccessible::
{
}
nsresult
nsXFormsInputDateAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsInputDateAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_DROPLIST;
return NS_OK;
return nsIAccessibleRole::ROLE_DROPLIST;
}
@ -299,11 +293,10 @@ nsXFormsSecretAccessible::
{
}
nsresult
nsXFormsSecretAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsSecretAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
}
nsresult
@ -334,11 +327,10 @@ nsXFormsRangeAccessible::
{
}
nsresult
nsXFormsRangeAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsRangeAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SLIDER;
return NS_OK;
return nsIAccessibleRole::ROLE_SLIDER;
}
nsresult
@ -460,11 +452,10 @@ nsXFormsChoicesAccessible::
{
}
nsresult
nsXFormsChoicesAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsChoicesAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
NS_IMETHODIMP
@ -491,11 +482,10 @@ nsXFormsSelectFullAccessible::
{
}
nsresult
nsXFormsSelectFullAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsSelectFullAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
void
@ -515,11 +505,10 @@ nsXFormsItemCheckgroupAccessible::
{
}
nsresult
nsXFormsItemCheckgroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsItemCheckgroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
nsresult
@ -561,11 +550,10 @@ nsXFormsItemRadiogroupAccessible::
{
}
nsresult
nsXFormsItemRadiogroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsItemRadiogroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_RADIOBUTTON;
}
nsresult
@ -603,11 +591,10 @@ nsXFormsSelectComboboxAccessible::
{
}
nsresult
nsXFormsSelectComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsSelectComboboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
return NS_OK;
return nsIAccessibleRole::ROLE_COMBOBOX;
}
nsresult
@ -650,11 +637,10 @@ nsXFormsItemComboboxAccessible::
{
}
nsresult
nsXFormsItemComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsItemComboboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LISTITEM;
return NS_OK;
return nsIAccessibleRole::ROLE_LISTITEM;
}
nsresult

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

@ -55,7 +55,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -68,7 +68,7 @@ public:
nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -88,7 +88,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -108,7 +108,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -126,7 +126,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -140,7 +140,7 @@ public:
nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -156,7 +156,7 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -177,7 +177,7 @@ public:
NS_IMETHOD GetCurrentValue(double *aCurrentValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -210,7 +210,7 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
// nsAccessible
@ -229,7 +229,7 @@ public:
nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
// nsAccessible
@ -253,7 +253,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -274,7 +274,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -291,7 +291,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
};
@ -313,7 +313,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};

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

@ -49,11 +49,10 @@ nsXFormsDropmarkerWidgetAccessible::
{
}
nsresult
nsXFormsDropmarkerWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsDropmarkerWidgetAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -134,11 +133,10 @@ nsXFormsCalendarWidgetAccessible(nsIContent *aContent, nsIWeakReference *aShell)
{
}
nsresult
nsXFormsCalendarWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsCalendarWidgetAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CALENDAR;
return NS_OK;
return nsIAccessibleRole::ROLE_CALENDAR;
}
@ -153,11 +151,10 @@ nsXFormsComboboxPopupWidgetAccessible::
{
}
nsresult
nsXFormsComboboxPopupWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsComboboxPopupWidgetAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LIST;
}
nsresult

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

@ -60,7 +60,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -75,7 +75,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -95,7 +95,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

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

@ -50,11 +50,10 @@ nsXULAlertAccessible::
NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, nsAccessible)
nsresult
nsXULAlertAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULAlertAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ALERT;
return NS_OK;
return nsIAccessibleRole::ROLE_ALERT;
}
nsresult

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

@ -55,7 +55,7 @@ public:
NS_IMETHOD GetName(nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};

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

@ -73,11 +73,10 @@ nsXULColorPickerTileAccessible::GetValue(nsAString& aValue)
////////////////////////////////////////////////////////////////////////////////
// nsXULColorPickerTileAccessible: nsAccessible
nsresult
nsXULColorPickerTileAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColorPickerTileAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -149,11 +148,10 @@ nsXULColorPickerAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsXULColorPickerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColorPickerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
return NS_OK;
return nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
}
////////////////////////////////////////////////////////////////////////////////
@ -166,9 +164,7 @@ nsXULColorPickerAccessible::CacheChildren()
nsRefPtr<nsAccessible> child;
while ((child = walker.GetNextChild())) {
// XXX: do not call nsAccessible::GetRole() while accessible not in tree
// (bug 574588).
PRUint32 role = nsAccUtils::Role(child);
PRUint32 role = child->Role();
// Get an accessbile for menupopup or panel elements.
if (role == nsIAccessibleRole::ROLE_ALERT) {

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

@ -55,7 +55,7 @@ public:
NS_IMETHOD GetValue(nsAString& _retval);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -72,7 +72,7 @@ public:
virtual PRBool Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

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

@ -66,20 +66,13 @@ nsXULComboboxAccessible::Init()
return PR_TRUE;
}
nsresult
nsXULComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULComboboxAccessible::NativeRole()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::autocomplete, eIgnoreCase)) {
*aRole = nsIAccessibleRole::ROLE_AUTOCOMPLETE;
} else {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
}
return NS_OK;
nsAccessibilityAtoms::autocomplete, eIgnoreCase))
return nsIAccessibleRole::ROLE_AUTOCOMPLETE;
return nsIAccessibleRole::ROLE_COMBOBOX;
}
nsresult

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

@ -64,7 +64,7 @@ public:
virtual PRBool Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
};

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

@ -125,11 +125,10 @@ nsXULButtonAccessible::Init()
////////////////////////////////////////////////////////////////////////////////
// nsXULButtonAccessible: nsAccessible
nsresult
nsXULButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -212,9 +211,7 @@ nsXULButtonAccessible::CacheChildren()
nsRefPtr<nsAccessible> child;
while ((child = walker.GetNextChild())) {
// XXX: do not call nsAccessible::GetRole() while accessible not in tree
// (bug 574588).
PRUint32 role = nsAccUtils::Role(child);
PRUint32 role = child->Role();
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
// Get an accessbile for menupopup or panel elements.
@ -319,14 +316,10 @@ NS_IMETHODIMP nsXULDropmarkerAccessible::DoAction(PRUint8 index)
return NS_ERROR_INVALID_ARG;
}
/**
* We are a pushbutton
*/
nsresult
nsXULDropmarkerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULDropmarkerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -362,11 +355,10 @@ nsXULCheckboxAccessible::
{
}
nsresult
nsXULCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULCheckboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
NS_IMETHODIMP nsXULCheckboxAccessible::GetNumActions(PRUint8 *_retval)
@ -450,11 +442,10 @@ nsXULGroupboxAccessible::
{
}
nsresult
nsXULGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULGroupboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
nsresult
@ -485,7 +476,7 @@ nsXULGroupboxAccessible::GetRelationByType(PRUint32 aRelationType,
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = GetChildAt(childIdx);
if (nsAccUtils::Role(childAcc) == nsIAccessibleRole::ROLE_LABEL) {
if (childAcc->Role() == nsIAccessibleRole::ROLE_LABEL) {
// Ensure that it's our label
// XXX: we'll fail if group accessible expose more than one relation
// targets.
@ -521,11 +512,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULProgressMeterAccessible,
// nsAccessible
nsresult
nsXULProgressMeterAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULProgressMeterAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PROGRESSBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_PROGRESSBAR;
}
// nsIAccessibleValue
@ -701,11 +691,10 @@ nsXULRadioGroupAccessible::
{
}
nsresult
nsXULRadioGroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULRadioGroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
nsresult
@ -735,11 +724,10 @@ nsXULStatusBarAccessible::
{
}
nsresult
nsXULStatusBarAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULStatusBarAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_STATUSBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_STATUSBAR;
}
@ -810,11 +798,10 @@ nsXULToolbarAccessible::
{
}
nsresult
nsXULToolbarAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULToolbarAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_TOOLBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_TOOLBAR;
}
nsresult
@ -842,11 +829,10 @@ nsXULToolbarSeparatorAccessible::
{
}
nsresult
nsXULToolbarSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULToolbarSeparatorAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SEPARATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_SEPARATOR;
}
nsresult
@ -976,16 +962,13 @@ nsXULTextFieldAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsXULTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTextFieldAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ENTRY;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::password, eIgnoreCase))
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return nsIAccessibleRole::ROLE_ENTRY;
}

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

@ -70,7 +70,7 @@ public:
virtual PRBool Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
@ -98,7 +98,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -117,7 +117,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
private:
@ -137,7 +137,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetNameInternal(nsAString& aName);
};
@ -154,7 +154,7 @@ public:
NS_IMETHOD GetValue(nsAString &aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -181,7 +181,7 @@ public:
nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -194,7 +194,7 @@ public:
nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -222,7 +222,7 @@ public:
nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetNameInternal(nsAString& aName);
};
@ -236,7 +236,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -263,7 +263,7 @@ public:
// nsAccessible
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();

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

@ -57,11 +57,10 @@ nsXULColumnsAccessible::
{
}
nsresult
nsXULColumnsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColumnsAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LIST;
}
nsresult
@ -97,11 +96,10 @@ nsXULColumnItemAccessible::
{
}
nsresult
nsXULColumnItemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColumnItemAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
}
nsresult
@ -236,24 +234,19 @@ NS_IMETHODIMP nsXULListboxAccessible::GetValue(nsAString& _retval)
return NS_ERROR_FAILURE;
}
nsresult
nsXULListboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULListboxAccessible::NativeRole()
{
// A richlistbox is used with the new autocomplete URL bar, and has a parent
// popup <panel>.
nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
do_QueryInterface(mContent->GetParent());
if (xulPopup) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
}
if (xulPopup)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
if (IsMulticolumn())
*aRole = nsIAccessibleRole::ROLE_TABLE;
else
*aRole = nsIAccessibleRole::ROLE_LISTBOX;
return NS_OK;
return nsIAccessibleRole::ROLE_TABLE;
return nsIAccessibleRole::ROLE_LISTBOX;
}
////////////////////////////////////////////////////////////////////////////////
@ -649,7 +642,7 @@ nsXULListboxAccessible::GetSelectedCells(nsIArray **aCells)
PRInt32 cellCount = item->GetChildCount();
for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
nsAccessible *cell = mChildren[cellIdx];
if (nsAccUtils::Role(cell) == nsIAccessibleRole::ROLE_CELL)
if (cell->Role() == nsIAccessibleRole::ROLE_CELL)
selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
}
}
@ -923,24 +916,25 @@ nsXULListitemAccessible::GetNameInternal(nsAString& aName)
return GetXULName(aName);
}
nsresult
nsXULListitemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULListitemAccessible::NativeRole()
{
nsAccessible *list = GetListAccessible();
NS_ENSURE_STATE(list);
if (nsAccUtils::Role(list) == nsIAccessibleRole::ROLE_TABLE) {
*aRole = nsIAccessibleRole::ROLE_ROW;
return NS_OK;
if (!list) {
NS_ERROR("No list accessible for listitem accessible!");
return nsIAccessibleRole::ROLE_NOTHING;
}
if (list->Role() == nsIAccessibleRole::ROLE_TABLE)
return nsIAccessibleRole::ROLE_ROW;
if (mIsCheckbox)
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
else if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
else
*aRole = nsIAccessibleRole::ROLE_RICH_OPTION;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return nsIAccessibleRole::ROLE_RICH_OPTION;
}
nsresult
@ -1046,14 +1040,12 @@ nsXULListCellAccessible::GetTable(nsIAccessibleTable **aTable)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> thisRow;
GetParent(getter_AddRefs(thisRow));
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* thisRow = GetParent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsCOMPtr<nsIAccessible> table;
thisRow->GetParent(getter_AddRefs(table));
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE)
nsAccessible* table = thisRow->GetParent();
if (!table || table->Role() != nsIAccessibleRole::ROLE_TABLE)
return NS_OK;
CallQueryInterface(table, aTable);
@ -1069,21 +1061,21 @@ nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
*aColumnIndex = 0;
nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
GetPreviousSibling(getter_AddRefs(prevCell));
while (prevCell) {
PRUint32 role = nsAccUtils::Role(prevCell);
PRInt32 indexInRow = GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
nsAccessible* cell = row->GetChildAt(idx);
PRUint32 role = cell->Role();
if (role == nsIAccessibleRole::ROLE_CELL ||
role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
(*aColumnIndex)++;
prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
tmpAcc.swap(prevCell);
}
return NS_OK;
@ -1098,15 +1090,21 @@ nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row, prevRow;
GetParent(getter_AddRefs(row));
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
while (row) {
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
nsAccessible* table = row->GetParent();
if (!table)
return NS_OK;
*aRowIndex = 0;
PRInt32 indexInTable = row->GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
row = table->GetChildAt(idx);
if (row->Role() == nsIAccessibleRole::ROLE_ROW)
(*aRowIndex)++;
row->GetPreviousSibling(getter_AddRefs(prevRow));
row.swap(prevRow);
}
return NS_OK;
@ -1158,7 +1156,7 @@ nsXULListCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
PRInt32 tableChildCount = tableAcc->GetChildCount();
for (PRInt32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
nsAccessible *child = tableAcc->GetChildAt(childIdx);
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_LIST) {
if (child->Role() == nsIAccessibleRole::ROLE_LIST) {
list = child;
break;
}
@ -1228,11 +1226,10 @@ nsXULListCellAccessible::IsSelected(PRBool *aIsSelected)
////////////////////////////////////////////////////////////////////////////////
// nsXULListCellAccessible. nsAccessible implementation
nsresult
nsXULListCellAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULListCellAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CELL;
return NS_OK;
return nsIAccessibleRole::ROLE_CELL;
}
nsresult

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

@ -58,7 +58,7 @@ public:
nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -77,7 +77,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
enum { eAction_Click = 0 };
@ -100,7 +100,7 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
@ -127,7 +127,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize);
@ -160,7 +160,7 @@ public:
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

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

@ -329,8 +329,7 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
}
// Combo box listitem
PRBool isComboboxOption =
(nsAccUtils::Role(this) == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
PRBool isComboboxOption = (Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
if (isComboboxOption) {
// Is selected?
PRBool isSelected = PR_FALSE;
@ -353,7 +352,7 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
// Set selected option offscreen/invisible according to combobox state
nsAccessible* grandParentAcc = parentAcc->GetParent();
NS_ENSURE_TRUE(grandParentAcc, NS_ERROR_FAILURE);
NS_ASSERTION(nsAccUtils::Role(grandParentAcc) == nsIAccessibleRole::ROLE_COMBOBOX,
NS_ASSERTION(grandParentAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
"grandparent of combobox listitem is not combobox");
PRUint32 grandParentState, grandParentExtState;
grandParentAcc->GetState(&grandParentState, &grandParentExtState);
@ -428,7 +427,7 @@ nsXULMenuitemAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
nsAccessible* parentAcc = GetParent();
if (parentAcc) {
if (nsAccUtils::RoleInternal(parentAcc) == nsIAccessibleRole::ROLE_MENUBAR) {
if (parentAcc->NativeRole() == nsIAccessibleRole::ROLE_MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
// No need to cache pref service, this happens rarely
if (gMenuAccesskeyModifier == -1) {
@ -479,34 +478,28 @@ nsXULMenuitemAccessible::GetDefaultKeyBinding(nsAString& aKeyBinding)
return NS_OK;
}
nsresult
nsXULMenuitemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenuitemAccessible::NativeRole()
{
nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mContent));
if (xulContainer) {
*aRole = nsIAccessibleRole::ROLE_PARENT_MENUITEM;
return NS_OK;
}
if (xulContainer)
return nsIAccessibleRole::ROLE_PARENT_MENUITEM;
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return NS_OK;
}
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::radio, eCaseMatters)) {
*aRole = nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
} else if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::checkbox,
eCaseMatters)) {
*aRole = nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
} else {
*aRole = nsIAccessibleRole::ROLE_MENUITEM;
return nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
}
return NS_OK;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::checkbox,
eCaseMatters)) {
return nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
}
return nsIAccessibleRole::ROLE_MENUITEM;
}
PRInt32
@ -587,11 +580,10 @@ nsXULMenuSeparatorAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULMenuSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenuSeparatorAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SEPARATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_SEPARATOR;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::DoAction(PRUint8 index)
@ -667,29 +659,28 @@ nsXULMenupopupAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULMenupopupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenupopupAccessible::NativeRole()
{
nsAccessible *parent = GetParent();
if (parent) {
PRUint32 role = nsAccUtils::Role(parent);
// If accessible is not bound to the tree (this happens while children are
// cached) return general role.
if (mParent) {
PRUint32 role = mParent->Role();
if (role == nsIAccessibleRole::ROLE_COMBOBOX ||
role == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
} else if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
// Some widgets like the search bar have several popups, owned by buttons.
nsAccessible *grandParent = parent->GetParent();
if (nsAccUtils::Role(grandParent) == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
}
nsAccessible* grandParent = mParent->GetParent();
if (grandParent &&
grandParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
}
*aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
return NS_OK;
return nsIAccessibleRole::ROLE_MENUPOPUP;
}
@ -723,10 +714,9 @@ nsXULMenubarAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULMenubarAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenubarAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_MENUBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_MENUBAR;
}

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

@ -94,7 +94,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRInt32 GetLevelInternal();
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
@ -118,7 +118,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -133,7 +133,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -147,7 +147,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};

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

@ -62,11 +62,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULSliderAccessible,
// nsAccessible
nsresult
nsXULSliderAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULSliderAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SLIDER;
return NS_OK;
return nsIAccessibleRole::ROLE_SLIDER;
}
nsresult
@ -300,12 +299,12 @@ nsXULThumbAccessible::
{
}
// nsIAccessible
////////////////////////////////////////////////////////////////////////////////
// nsXULThumbAccessible: nsAccessible
nsresult
nsXULThumbAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULThumbAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_INDICATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_INDICATOR;
}

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

@ -64,7 +64,7 @@ public:
NS_DECL_NSIACCESSIBLEVALUE
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
@ -91,7 +91,7 @@ public:
nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

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

@ -96,11 +96,10 @@ NS_IMETHODIMP nsXULTabAccessible::DoAction(PRUint8 index)
////////////////////////////////////////////////////////////////////////////////
// nsXULTabAccessible: nsAccessible
nsresult
nsXULTabAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PAGETAB;
return NS_OK;
return nsIAccessibleRole::ROLE_PAGETAB;
}
nsresult
@ -184,11 +183,10 @@ nsXULTabsAccessible::
{
}
nsresult
nsXULTabsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabsAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PAGETABLIST;
return NS_OK;
return nsIAccessibleRole::ROLE_PAGETABLIST;
}
NS_IMETHODIMP
@ -224,11 +222,10 @@ nsXULTabpanelsAccessible::
{
}
nsresult
nsXULTabpanelsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabpanelsAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PANE;
return NS_OK;
return nsIAccessibleRole::ROLE_PANE;
}
@ -242,11 +239,10 @@ nsXULTabpanelAccessible::
{
}
nsresult
nsXULTabpanelAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabpanelAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PROPERTYPAGE;
return NS_OK;
return nsIAccessibleRole::ROLE_PROPERTYPAGE;
}
NS_IMETHODIMP

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

@ -63,7 +63,7 @@ public:
// nsAccessible
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -82,7 +82,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -95,7 +95,7 @@ public:
nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -119,7 +119,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

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

@ -71,11 +71,10 @@ nsXULTextAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTextAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}
nsresult
@ -103,11 +102,9 @@ nsXULTextAccessible::GetRelationByType(PRUint32 aRelationType,
// Caption is the label for groupbox
nsIContent *parent = mContent->GetParent();
if (parent && parent->Tag() == nsAccessibilityAtoms::caption) {
nsCOMPtr<nsIAccessible> parentAccessible;
GetParent(getter_AddRefs(parentAccessible));
if (nsAccUtils::Role(parentAccessible) == nsIAccessibleRole::ROLE_GROUPING)
return nsRelUtils::
AddTarget(aRelationType, aRelation, parentAccessible);
nsAccessible* parent = GetParent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
return nsRelUtils::AddTarget(aRelationType, aRelation, parent);
}
}
@ -137,11 +134,10 @@ nsXULTooltipAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsXULTooltipAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTooltipAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_TOOLTIP;
return NS_OK;
return nsIAccessibleRole::ROLE_TOOLTIP;
}
@ -184,11 +180,10 @@ nsXULLinkAccessible::GetNameInternal(nsAString& aName)
return nsTextEquivUtils::GetNameFromSubtree(this, aName);
}
nsresult
nsXULLinkAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULLinkAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LINK;
return NS_OK;
return nsIAccessibleRole::ROLE_LINK;
}

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

@ -58,7 +58,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -72,7 +72,7 @@ public:
nsXULTooltipAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -93,7 +93,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// HyperLinkAccessible

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

@ -181,12 +181,9 @@ nsXULTreeAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeAccessible: nsAccessible implementation (put methods here)
nsresult
nsXULTreeAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeAccessible::NativeRole()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
// No primary column means we're in a list. In fact, history and mail turn off
// the primary flag when switching to a flat view.
@ -196,11 +193,9 @@ nsXULTreeAccessible::GetRoleInternal(PRUint32 *aRole)
if (cols)
cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
*aRole = primaryCol ?
return primaryCol ?
static_cast<PRUint32>(nsIAccessibleRole::ROLE_OUTLINE) :
static_cast<PRUint32>(nsIAccessibleRole::ROLE_LIST);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
@ -1159,21 +1154,22 @@ nsXULTreeItemAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible: nsAccessible implementation
nsresult
nsXULTreeItemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeItemAccessible::NativeRole()
{
nsCOMPtr<nsITreeColumns> columns;
mTree->GetColumns(getter_AddRefs(columns));
NS_ENSURE_STATE(columns);
if (!columns) {
NS_ERROR("No tree columns object in the tree!");
return nsIAccessibleRole::ROLE_NOTHING;
}
nsCOMPtr<nsITreeColumn> primaryColumn;
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
*aRole = primaryColumn ?
return primaryColumn ?
static_cast<PRUint32>(nsIAccessibleRole::ROLE_OUTLINEITEM) :
static_cast<PRUint32>(nsIAccessibleRole::ROLE_LISTITEM);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -84,7 +84,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
@ -275,7 +275,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
// nsXULTreeItemAccessibleBase
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);

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

@ -575,21 +575,22 @@ nsXULTreeGridAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible: nsAccessible implementation
nsresult
nsXULTreeGridAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeGridAccessible::NativeRole()
{
nsCOMPtr<nsITreeColumns> treeColumns;
mTree->GetColumns(getter_AddRefs(treeColumns));
NS_ENSURE_STATE(treeColumns);
if (!treeColumns) {
NS_ERROR("No treecolumns object for tree!");
return nsIAccessibleRole::ROLE_NOTHING;
}
nsCOMPtr<nsITreeColumn> primaryColumn;
treeColumns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
*aRole = primaryColumn ?
return primaryColumn ?
static_cast<PRUint32>(nsIAccessibleRole::ROLE_TREE_TABLE) :
static_cast<PRUint32>(nsIAccessibleRole::ROLE_TABLE);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
@ -656,11 +657,10 @@ nsXULTreeGridRowAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridRowAccessible: nsAccessible implementation
nsresult
nsXULTreeGridRowAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeGridRowAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ROW;
return NS_OK;
return nsIAccessibleRole::ROLE_ROW;
}
nsresult
@ -1164,11 +1164,10 @@ nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
return NS_OK;
}
nsresult
nsXULTreeGridCellAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeGridCellAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GRID_CELL;
return NS_OK;
return nsIAccessibleRole::ROLE_GRID_CELL;
}
nsresult

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

@ -59,7 +59,7 @@ public:
NS_DECL_NSIACCESSIBLETABLE
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
@ -92,7 +92,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
nsIAccessible **aChild);
@ -164,7 +164,7 @@ public:
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRInt32 GetIndexInParent() { return GetColumnIndex(); }

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

@ -56,13 +56,12 @@ pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul
// Enables some extra Extension System Logging (can reduce performance)
pref("extensions.logging.enabled", false);
// Preferences for the Addon Repository
// Preferences for AMO integration
pref("extensions.getAddons.cache.enabled", true);
pref("extensions.getAddons.maxResults", 15);
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/guid:%IDS%");
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/%APP%/search?q=%TERMS%");
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%");
// Preferences for AMO integration
pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/%APP%/discovery/%VERSION%/%OS%");
// Blocklist preferences

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

@ -56,6 +56,7 @@ endif
EXTRA_JS_MODULES = \
content/openLocationLastURL.jsm \
content/NetworkPrioritizer.jsm \
content/domplate.jsm \
content/stylePanel.jsm \
$(NULL)

Двоичные данные
browser/base/content/aboutRobots-icon-rtl.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.7 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

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

@ -83,22 +83,14 @@
]]></script>
<style type="text/css"><![CDATA[
#errorPageContainer {
background: url('chrome://browser/content/aboutRobots-icon.png') left 0 no-repeat -moz-Field;
background-origin: content-box;
#errorPageContainer:before {
content: url('chrome://browser/content/aboutRobots-icon.png');
position: absolute;
}
#errorTrailerDescText {
float: right;
}
body[dir=rtl] #errorPageContainer {
background-image: url('chrome://browser/content/aboutRobots-icon-rtl.png');
background-position: right 0;
}
body[dir=rtl] #errorTrailerDescText {
float: left;
body[dir=rtl] #icon,
body[dir=rtl] #errorPageContainer:before {
-moz-transform: scaleX(-1);
}
]]></style>
</head>
@ -145,8 +137,8 @@
<img src="chrome://browser/content/aboutRobots-widget-left.png"
style="position: absolute; bottom: -12px; left: -10px;"/>
<img src="chrome://browser/content/aboutRobots-widget-right.png"
style="position: absolute; bottom: -12px; right: -10px;"/>
<img src="chrome://browser/content/aboutRobots-widget-left.png"
style="position: absolute; bottom: -12px; right: -10px; -moz-transform: scaleX(-1);"/>
</div>
</body>

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

@ -256,10 +256,10 @@ var FullZoom = {
var self = this;
Services.contentPrefs.getPref(aURI, this.name, function (aResult) {
// Check that we're still where we expect to be in case this took a while.
let isSaneURI = (aBrowser && aBrowser.currentURI) ?
aURI.equals(aBrowser.currentURI) : false;
if (!aBrowser || isSaneURI)
self._applyPrefToSetting(aResult, aBrowser);
let browser = aBrowser || gBrowser.selectedBrowser;
if (aURI.equals(browser.currentURI)) {
self._applyPrefToSetting(aResult, browser);
}
});
},

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

@ -573,7 +573,7 @@
command="Browser:BookmarkAllTabs"
key="bookmarkAllTabsKb"/>
<menuitem id="bookmarksShowAll"
label="&organizeBookmarks.label;"
label="&showAllBookmarks.label;"
command="Browser:ShowAllBookmarks"
key="manBookmarkKb"/>
<menuseparator id="organizeBookmarksSeparator"/>

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

@ -100,6 +100,13 @@ toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
display: none;
}
#wrapper-urlbar-container #urlbar-container > #urlbar > toolbarbutton,
#urlbar-container:not([combined]) > #urlbar > toolbarbutton,
#urlbar-container[combined] + #reload-button + #stop-button,
#urlbar-container[combined] + #reload-button,
toolbar:not([mode="icons"]) > #urlbar-container > #urlbar > toolbarbutton,
toolbar[mode="icons"] > #urlbar-container > #urlbar > #urlbar-reload-button:not([displaystop]) + #urlbar-stop-button,
toolbar[mode="icons"] > #urlbar-container > #urlbar > #urlbar-reload-button[displaystop],
toolbar[mode="icons"] > #reload-button:not([displaystop]) + #stop-button,
toolbar[mode="icons"] > #reload-button[displaystop] {
visibility: collapse;
@ -178,8 +185,12 @@ richlistitem[type~="action"]:-moz-locale-dir(rtl) > .ac-url-box {
direction: rtl;
}
#urlbar-container[combined] > #urlbar > #urlbar-icons > #go-button,
#urlbar[pageproxystate="invalid"] > #urlbar-icons > .urlbar-icon:not(#go-button),
#urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button {
#urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button,
#urlbar[pageproxystate="invalid"][focused="true"] > #urlbar-go-button ~ toolbarbutton,
#urlbar[pageproxystate="valid"] > #urlbar-go-button,
#urlbar:not([focused="true"]) > #urlbar-go-button {
visibility: collapse;
}
@ -348,3 +359,7 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
#notification-popup-box[anchorid="addons-notification-icon"] > #addons-notification-icon {
display: -moz-box;
}
#geolocation-notification {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#geolocation-notification");
}

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

@ -324,11 +324,6 @@ function SetClickAndHoldHandlers() {
}
#endif
function BookmarkThisTab(aTab) {
PlacesCommandHook.bookmarkPage(aTab.linkedBrowser,
PlacesUtils.bookmarksMenuFolderId, true);
}
const gSessionHistoryObserver = {
observe: function(subject, topic, data)
{
@ -2365,10 +2360,13 @@ function UpdateUrlbarSearchSplitterState()
var splitter = document.getElementById("urlbar-search-splitter");
var urlbar = document.getElementById("urlbar-container");
var searchbar = document.getElementById("search-container");
var stop = document.getElementById("stop-button");
var ibefore = null;
if (urlbar && searchbar) {
if (urlbar.nextSibling == searchbar)
if (urlbar.nextSibling == searchbar ||
urlbar.getAttribute("combined") &&
stop && stop.nextSibling == searchbar)
ibefore = searchbar;
else if (searchbar.nextSibling == urlbar)
ibefore = urlbar;
@ -4461,23 +4459,30 @@ var CombinedStopReload = {
if (this._initialized)
return;
var stop = document.getElementById("stop-button");
if (!stop)
return;
var urlbar = document.getElementById("urlbar-container");
var reload = document.getElementById("reload-button");
if (!reload)
return;
var stop = document.getElementById("stop-button");
if (!(reload.nextSibling == stop))
if (urlbar) {
if (urlbar.parentNode.getAttribute("mode") != "icons" ||
!reload || urlbar.nextSibling != reload ||
!stop || reload.nextSibling != stop)
urlbar.removeAttribute("combined");
else {
urlbar.setAttribute("combined", "true");
reload = document.getElementById("urlbar-reload-button");
stop = document.getElementById("urlbar-stop-button");
}
}
if (!stop || !reload || reload.nextSibling != stop)
return;
this._initialized = true;
if (XULBrowserWindow.stopCommand.getAttribute("disabled") != "true")
reload.setAttribute("displaystop", "true");
stop.addEventListener("click", this, false);
this.stop = stop;
this.reload = reload;
this.stop = stop;
},
uninit: function () {

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

@ -136,10 +136,6 @@
</menupopup>
</menu>
<menuseparator/>
<menuitem id="context_bookmarkTab"
label="&bookmarkThisTab.label;"
accesskey="&bookmarkThisTab.accesskey;"
oncommand="BookmarkThisTab(TabContextMenu.contextTab);"/>
<menuitem id="context_bookmarkAllTabs"
label="&bookmarkAllTabs.label;"
accesskey="&bookmarkAllTabs.accesskey;"
@ -234,13 +230,15 @@
onmousemove="InspectorUI.highlighter.handleMouseMove(event);"
onMozMousePixelScroll="InspectorUI.highlighter.handlePixelScroll(event);"/>
<panel id="inspector-panel"
<panel id="inspector-tree-panel"
orient="vertical"
hidden="true"
ignorekeys="true"
noautofocus="true"
noautohide="true"
titlebar="normal"
close="true"
onpopuphiding="InspectorUI.closeInspectorUI(true);"
label="&inspectPanelTitle.label;">
<toolbar id="inspector-toolbar"
nowindowdrag="true">
@ -270,20 +268,11 @@
class="toolbarbutton-text"
oncommand="InspectorUI.toggleDOMPanel();"/>
</toolbar>
<tree id="inspector-tree" class="plain"
seltype="single"
treelines="true"
onselect="InspectorUI.onTreeSelected()"
flex="1">
<treecols>
<treecol id="colNodeName" label="nodeName" primary="true"
persist="width,hidden,ordinal" flex="1"/>
<splitter class="tree-splitter"/>
<treecol id="colNodeValue" label="nodeValue"
persist="width,hidden,ordinal" flex="1"/>
</treecols>
<treechildren id="inspector-tree-body"/>
</tree>
<iframe id="inspector-tree-iframe"
flex="1"
type="content"
src="chrome://browser/content/inspector.html"
onclick="InspectorUI.onTreeClick(event);" />
<hbox align="end">
<spacer flex="1" />
<resizer dir="bottomend" />
@ -488,7 +477,7 @@
startlabel="&privateBrowsingCmd.start.label;"
stoplabel="&privateBrowsingCmd.stop.label;"
command="Tools:PrivateBrowsing"/>
<menuseparator/>
<menuseparator class="appmenu-menuseparator"/>
<hbox class="split-menuitem">
<menuitem id="appmenu-edit-menuitem"
label="&editMenu.label;"
@ -512,7 +501,7 @@
<menuitem id="appmenu_find"
label="&appMenuFind.label;"
command="cmd_find"/>
<menuseparator/>
<menuseparator class="appmenu-menuseparator"/>
<menuitem id="appmenu_savePage"
label="&savePageCmd.label;"
command="Browser:SavePage"/>
@ -541,7 +530,7 @@
</menupopup>
</menu>
</hbox>
<menuseparator/>
<menuseparator class="appmenu-menuseparator"/>
<menu id="appmenu_developer"
label="&developerMenu.label;">
<menupopup id="appmenu_developer_popup">
@ -563,7 +552,7 @@
oncommand="BrowserOffline.toggleOfflineStatus();"/>
</menupopup>
</menu>
<menuseparator/>
<menuseparator class="appmenu-menuseparator"/>
<menuitem id="appmenu_fullScreen"
label="&fullScreenCmd.label;"
type="checkbox"
@ -604,8 +593,8 @@
label="&appMenuUnsorted.label;"
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"
class="menuitem-iconic"/>
<menuitem id="appmenu_organizeBookmarks"
label="&organizeBookmarks.label;"
<menuitem id="appmenu_showAllBookmarks"
label="&showAllBookmarks.label;"
key="manBookmarkKb"
command="Browser:ShowAllBookmarks"
context=""/>
@ -794,10 +783,10 @@
fullscreentoolbar="true" mode="icons" customizable="true"
#ifdef WINCE
iconsize="small" defaulticonsize="small"
defaultset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,bookmarks-menu-button-container,navigator-throbber,fullscreenflex,window-controls"
defaultset="unified-back-forward-button,home-button,urlbar-container,reload-button,stop-button,search-container,bookmarks-menu-button-container,navigator-throbber,fullscreenflex,window-controls"
#else
iconsize="large"
defaultset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,bookmarks-menu-button-container,fullscreenflex,window-controls"
defaultset="unified-back-forward-button,home-button,urlbar-container,reload-button,stop-button,search-container,bookmarks-menu-button-container,fullscreenflex,window-controls"
#endif
context="toolbar-context-menu">
@ -831,17 +820,6 @@
</toolbarbutton>
</toolbaritem>
<toolbarbutton id="reload-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&reloadCmd.label;" removable="true"
command="Browser:ReloadOrDuplicate"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&reloadButton.tooltip;"/>
<toolbarbutton id="stop-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&stopCmd.label;" removable="true"
command="Browser:Stop"
tooltiptext="&stopButton.tooltip;"/>
<toolbarbutton id="home-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
persist="class" removable="true"
label="&homeButton.label;"
@ -851,7 +829,7 @@
ondragleave="homeButtonObserver.onDragLeave(event)"
onclick="BrowserGoHome(event);"/>
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width"
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width" combined="true"
title="&locationItem.title;" class="chromeclass-location" removable="true">
<textbox id="urlbar" flex="1"
placeholder="&urlbar.placeholder;"
@ -923,9 +901,30 @@
tooltiptext="&goEndCap.tooltip;"
onclick="gURLBar.handleCommand(event);"/>
</hbox>
<toolbarbutton id="urlbar-go-button"
onclick="gURLBar.handleCommand(event);"
tooltiptext="&goEndCap.tooltip;"/>
<toolbarbutton id="urlbar-reload-button"
command="Browser:ReloadOrDuplicate"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&reloadButton.tooltip;"/>
<toolbarbutton id="urlbar-stop-button"
command="Browser:Stop"
tooltiptext="&stopButton.tooltip;"/>
</textbox>
</toolbaritem>
<toolbarbutton id="reload-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&reloadCmd.label;" removable="true"
command="Browser:ReloadOrDuplicate"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&reloadButton.tooltip;"/>
<toolbarbutton id="stop-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&stopCmd.label;" removable="true"
command="Browser:Stop"
tooltiptext="&stopButton.tooltip;"/>
<toolbaritem id="search-container" title="&searchItem.title;"
align="center" class="chromeclass-toolbar-additional"
flex="100" persist="width" removable="true">
@ -960,7 +959,7 @@
command="Browser:BookmarkAllTabs"
key="bookmarkAllTabsKb"/>
<menuitem id="BMB_bookmarksShowAll"
label="&organizeBookmarks.label;"
label="&showAllBookmarks.label;"
command="Browser:ShowAllBookmarks"
key="manBookmarkKb"/>
<menuseparator/>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,639 @@
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2007, Parakey Inc.
* All rights reserved.
*
* Redistribution and use of this software in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* * Neither the name of Parakey Inc. nor the names of its
* contributors may be used to endorse or promote products
* derived from this software without specific prior
* written permission of Parakey Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Creator:
* Joe Hewitt
* Contributors
* John J. Barton (IBM Almaden)
* Jan Odvarko (Mozilla Corp.)
* Max Stepanov (Aptana Inc.)
* Rob Campbell (Mozilla Corp.)
* Hans Hillen (Paciello Group, Mozilla)
* Curtis Bartley (Mozilla Corp.)
* Mike Collins (IBM Almaden)
* Kevin Decker
* Mike Ratcliffe (Comartis AG)
* Hernan Rodríguez Colmeiro
* Austin Andrews
* Christoph Dorn
* Steven Roussey (AppCenter Inc, Network54)
*/
///////////////////////////////////////////////////////////////////////////
//// InsideOutBox
/**
* InsideOutBoxView is a simple interface definition for views implementing
* InsideOutBox controls. All implementors must define these methods.
* Implemented in InspectorUI.
*/
/*
InsideOutBoxView = {
//
* Retrieves the parent object for a given child object.
* @param aChild
* The child node to retrieve the parent object for.
* @returns a DOM node | null
//
getParentObject: function(aChild) {},
//
* Retrieves a given child node.
*
* If both index and previousSibling are passed, the implementation
* may assume that previousSibling will be the return for getChildObject
* with index-1.
* @param aParent
* The parent object of the child object to retrieve.
* @param aIndex
* The index of the child object to retrieve from aParent.
* @param aPreviousSibling
* The previous sibling of the child object to retrieve.
* Supercedes aIndex.
* @returns a DOM object | null
//
getChildObject: function(aParent, aIndex, aPreviousSibling) {},
//
* Renders the HTML representation of the object. Should return an HTML
* object which will be displayed to the user.
* @param aObject
* The object to create the box object for.
* @param aIsRoot
* Is the object the root object. May not be used in all
* implementations.
* @returns an object box | null
//
createObjectBox: function(aObject, aIsRoot) {},
//
* Convenience wrappers for classList API.
* @param aObject
* DOM node to query/set.
* @param aClassName
* String containing the class name to query/set.
//
hasClass: function(aObject, aClassName) {},
addClass: function(aObject, aClassName) {},
removeClass: function(aObject, aClassName) {}
};
*/
/**
* Creates a tree based on objects provided by a separate "view" object.
*
* Construction uses an "inside-out" algorithm, meaning that the view's job is
* first to tell us the ancestry of each object, and secondarily its
* descendants.
*
* Constructor
* @param aView
* The view requiring the InsideOutBox.
* @param aBox
* The box object containing the InsideOutBox. Required to add/remove
* children during box manipulation (toggling opened or closed).
*/
function InsideOutBox(aView, aBox)
{
this.view = aView;
this.box = aBox;
this.rootObject = null;
this.rootObjectBox = null;
this.selectedObjectBox = null;
this.highlightedObjectBox = null;
this.scrollIntoView = false;
};
InsideOutBox.prototype =
{
/**
* Highlight the given object node in the tree.
* @param aObject
* the object to highlight.
* @returns objectBox
*/
highlight: function IOBox_highlight(aObject)
{
let objectBox = this.createObjectBox(aObject);
this.highlightObjectBox(objectBox);
return objectBox;
},
/**
* Open the given object node in the tree.
* @param aObject
* The object node to open.
* @returns objectBox
*/
openObject: function IOBox_openObject(aObject)
{
let object = aObject;
let firstChild = this.view.getChildObject(object, 0);
if (firstChild)
object = firstChild;
return this.openToObject(object);
},
/**
* Open the tree up to the given object node.
* @param aObject
* The object in the tree to open to.
* @returns objectBox
*/
openToObject: function IOBox_openToObject(aObject)
{
let objectBox = this.createObjectBox(aObject);
this.openObjectBox(objectBox);
return objectBox;
},
/**
* Select the given object node in the tree.
* @param aObject
* The object node to select.
* @param makeBoxVisible
* Boolean. Open the object box in the tree?
* @param forceOpen
* Force the object box open by expanding all elements in the tree?
* @param scrollIntoView
* Scroll the objectBox into view?
* @returns objectBox
*/
select:
function IOBox_select(aObject, makeBoxVisible, forceOpen, scrollIntoView)
{
let objectBox = this.createObjectBox(aObject);
this.selectObjectBox(objectBox, forceOpen);
if (makeBoxVisible) {
this.openObjectBox(objectBox);
if (scrollIntoView) {
objectBox.scrollIntoView(true);
}
}
return objectBox;
},
/**
* Expands/contracts the given object, depending on its state.
* @param aObject
* The tree node to expand/contract.
*/
toggleObject: function IOBox_toggleObject(aObject)
{
let box = this.createObjectBox(aObject);
if (!(this.view.hasClass(box, "open")))
this.expandObjectBox(box);
else
this.contractObjectBox(box);
},
/**
* Expand the given object in the tree.
* @param aObject
* The tree node to expand.
*/
expandObject: function IOBox_expandObject(aObject)
{
let objectBox = this.createObjectBox(aObject);
if (objectBox)
this.expandObjectBox(objectBox);
},
/**
* Contract the given object in the tree.
* @param aObject
* The tree node to contract.
*/
contractObject: function IOBox_contractObject(aObject)
{
let objectBox = this.createObjectBox(aObject);
if (objectBox)
this.contractObjectBox(objectBox);
},
/**
* General method for iterating over an object's ancestors and performing
* some function.
* @param aObject
* The object whose ancestors we wish to iterate over.
* @param aCallback
* The function to call with the object as argument.
*/
iterateObjectAncestors: function IOBox_iterateObjectAncesors(aObject, aCallback)
{
let object = aObject;
if (!(aCallback && typeof(aCallback) == "function")) {
this.view._log("Illegal argument in IOBox.iterateObjectAncestors");
return;
}
while ((object = this.getParentObjectBox(object)))
aCallback(object);
},
/**
* Highlight the given objectBox in the tree.
* @param aObjectBox
* The objectBox to highlight.
*/
highlightObjectBox: function IOBox_highlightObjectBox(aObjectBox)
{
let self = this;
if (!aObjectBox)
return;
if (this.highlightedObjectBox) {
this.view.removeClass(this.highlightedObjectBox, "highlighted");
this.iterateObjectAncestors(this.highlightedObjectBox, function (box) {
self.view.removeClass(box, "highlightOpen");
});
}
this.highlightedObjectBox = aObjectBox;
this.view.addClass(aObjectBox, "highlighted");
this.iterateObjectAncestors(this.highlightedObjectBox, function (box) {
self.view.addClass(box, "highlightOpen");
});
aObjectBox.scrollIntoView(true);
},
/**
* Select the given objectBox in the tree, forcing it to be open if necessary.
* @param aObjectBox
* The objectBox to select.
* @param forceOpen
* Force the box (subtree) to be open?
*/
selectObjectBox: function IOBox_selectObjectBox(aObjectBox, forceOpen)
{
let isSelected = this.selectedObjectBox &&
aObjectBox == this.selectedObjectBox;
// aObjectBox is already selected, return
if (isSelected)
return;
if (this.selectedObjectBox)
this.view.removeClass(this.selectedObjectBox, "selected");
this.selectedObjectBox = aObjectBox;
if (aObjectBox) {
this.view.addClass(aObjectBox, "selected");
// Force it open the first time it is selected
if (forceOpen)
this.expandObjectBox(aObjectBox, true);
}
},
/**
* Open the ancestors of the given object box.
* @param aObjectBox
* The object box to open.
*/
openObjectBox: function IOBox_openObjectBox(aObjectBox)
{
if (!aObjectBox)
return;
let self = this;
this.iterateObjectAncestors(aObjectBox, function (box) {
self.view.addClass(box, "open");
let labelBox = box.querySelector(".nodeLabelBox");
if (labelBox)
labelBox.setAttribute("aria-expanded", "true");
});
},
/**
* Expand the given object box.
* @param aObjectBox
* The object box to expand.
*/
expandObjectBox: function IOBox_expandObjectBox(aObjectBox)
{
let nodeChildBox = this.getChildObjectBox(aObjectBox);
// no children means nothing to expand, return
if (!nodeChildBox)
return;
if (!aObjectBox.populated) {
let firstChild = this.view.getChildObject(aObjectBox.repObject, 0);
this.populateChildBox(firstChild, nodeChildBox);
}
let labelBox = aObjectBox.querySelector(".nodeLabelBox");
if (labelBox)
labelBox.setAttribute("aria-expanded", "true");
this.view.addClass(aObjectBox, "open");
},
/**
* Contract the given object box.
* @param aObjectBox
* The object box to contract.
*/
contractObjectBox: function IOBox_contractObjectBox(aObjectBox)
{
this.view.removeClass(aObjectBox, "open");
let nodeLabel = aObjectBox.querySelector(".nodeLabel");
let labelBox = nodeLabel.querySelector(".nodeLabelBox");
if (labelBox)
labelBox.setAttribute("aria-expanded", "false");
},
/**
* Toggle the given object box, forcing open if requested.
* @param aObjectBox
* The object box to toggle.
* @param forceOpen
* Force the objectbox open?
*/
toggleObjectBox: function IOBox_toggleObjectBox(aObjectBox, forceOpen)
{
let isOpen = this.view.hasClass(aObjectBox, "open");
if (!forceOpen && isOpen)
this.contractObjectBox(aObjectBox);
else if (!isOpen)
this.expandObjectBox(aObjectBox);
},
/**
* Creates all of the boxes for an object, its ancestors, and siblings.
* @param aObject
* The tree node to create the object boxes for.
* @returns anObjectBox or null
*/
createObjectBox: function IOBox_createObjectBox(aObject)
{
if (!aObject)
return null;
this.rootObject = this.getRootNode(aObject) || aObject;
// Get or create all of the boxes for the target and its ancestors
let objectBox = this.createObjectBoxes(aObject, this.rootObject);
if (!objectBox)
return null;
if (aObject == this.rootObject)
return objectBox;
return this.populateChildBox(aObject, objectBox.parentNode);
},
/**
* Creates all of the boxes for an object, its ancestors, and siblings up to
* a root.
* @param aObject
* The tree's object node to create the object boxes for.
* @param aRootObject
* The root object at which to stop building object boxes.
* @returns an object box or null
*/
createObjectBoxes: function IOBox_createObjectBoxes(aObject, aRootObject)
{
if (!aObject)
return null;
if (aObject == aRootObject) {
if (!this.rootObjectBox || this.rootObjectBox.repObject != aRootObject) {
if (this.rootObjectBox) {
try {
this.box.removeChild(this.rootObjectBox);
} catch (exc) {
InspectorUI._log("this.box.removeChild(this.rootObjectBox) FAILS " +
this.box + " must not contain " + this.rootObjectBox);
}
}
this.highlightedObjectBox = null;
this.selectedObjectBox = null;
this.rootObjectBox = this.view.createObjectBox(aObject, true);
this.box.appendChild(this.rootObjectBox);
}
return this.rootObjectBox;
}
let parentNode = this.view.getParentObject(aObject);
let parentObjectBox = this.createObjectBoxes(parentNode, aRootObject);
if (!parentObjectBox)
return null;
let parentChildBox = this.getChildObjectBox(parentObjectBox);
if (!parentChildBox)
return null;
let childObjectBox = this.findChildObjectBox(parentChildBox, aObject);
return childObjectBox ? childObjectBox
: this.populateChildBox(aObject, parentChildBox);
},
/**
* Locate the object box for a given object node.
* @param aObject
* The given object node in the tree.
* @returns an object box or null.
*/
findObjectBox: function IOBox_findObjectBox(aObject)
{
if (!aObject)
return null;
if (aObject == this.rootObject)
return this.rootObjectBox;
let parentNode = this.view.getParentObject(aObject);
let parentObjectBox = this.findObjectBox(parentNode);
if (!parentObjectBox)
return null;
let parentChildBox = this.getChildObjectBox(parentObjectBox);
if (!parentChildBox)
return null;
return this.findChildObjectBox(parentChildBox, aObject);
},
getAncestorByClass: function IOBox_getAncestorByClass(node, className)
{
for (let parent = node; parent; parent = parent.parentNode) {
if (this.view.hasClass(parent, className))
return parent;
}
return null;
},
/**
* We want all children of the parent of repObject.
*/
populateChildBox: function IOBox_populateChildBox(repObject, nodeChildBox)
{
if (!repObject)
return null;
let parentObjectBox = this.getAncestorByClass(nodeChildBox, "nodeBox");
if (parentObjectBox.populated)
return this.findChildObjectBox(nodeChildBox, repObject);
let lastSiblingBox = this.getChildObjectBox(nodeChildBox);
let siblingBox = nodeChildBox.firstChild;
let targetBox = null;
let view = this.view;
let targetSibling = null;
let parentNode = view.getParentObject(repObject);
for (let i = 0; 1; ++i) {
targetSibling = view.getChildObject(parentNode, i, targetSibling);
if (!targetSibling)
break;
// Check if we need to start appending, or continue to insert before
if (lastSiblingBox && lastSiblingBox.repObject == targetSibling)
lastSiblingBox = null;
if (!siblingBox || siblingBox.repObject != targetSibling) {
let newBox = view.createObjectBox(targetSibling);
if (newBox) {
if (lastSiblingBox)
nodeChildBox.insertBefore(newBox, lastSiblingBox);
else
nodeChildBox.appendChild(newBox);
}
siblingBox = newBox;
}
if (targetSibling == repObject)
targetBox = siblingBox;
if (siblingBox && siblingBox.repObject == targetSibling)
siblingBox = siblingBox.nextSibling;
}
if (targetBox)
parentObjectBox.populated = true;
return targetBox;
},
/**
* Get the parent object box of a given object box.
* @params aObjectBox
* The object box of the parent.
* @returns an object box or null
*/
getParentObjectBox: function IOBox_getParentObjectBox(aObjectBox)
{
let parent = aObjectBox.parentNode ? aObjectBox.parentNode.parentNode : null;
return parent && parent.repObject ? parent : null;
},
/**
* Get the child object box of a given object box.
* @param aObjectBox
* The object box whose child you want.
* @returns an object box or null
*/
getChildObjectBox: function IOBox_getChildObjectBox(aObjectBox)
{
return aObjectBox.querySelector(".nodeChildBox");
},
/**
* Find the child object box for a given repObject within the subtree
* rooted at aParentNodeBox.
* @param aParentNodeBox
* root of the subtree in which to search for repObject.
* @param aRepObject
* The object you wish to locate in the subtree.
* @returns an object box or null
*/
findChildObjectBox: function IOBox_findChildObjectBox(aParentNodeBox, aRepObject)
{
let childBox = aParentNodeBox.firstChild;
while (childBox) {
if (childBox.repObject == aRepObject)
return childBox;
childBox = childBox.nextSibling;
}
return null; // not found
},
/**
* Determines if the given node is an ancestor of the current root.
* @param aNode
* The node to look for within the tree.
* @returns boolean
*/
isInExistingRoot: function IOBox_isInExistingRoot(aNode)
{
let parentNode = aNode;
while (parentNode && parentNode != this.rootObject) {
parentNode = this.view.getParentObject(parentNode);
}
return parentNode == this.rootObject;
},
/**
* Get the root node of a given node.
* @param aNode
* The node whose root you wish to retrieve.
* @returns a root node or null
*/
getRootNode: function IOBox_getRootNode(aNode)
{
let node = aNode;
let tmpNode;
while ((tmpNode = this.view.getParentObject(node)))
node = tmpNode;
return node;
},
};

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

@ -0,0 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="chrome://browser/skin/inspector.css" type="text/css"/>
</head>
<body role="application">
</body>
</html>

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

@ -41,6 +41,8 @@
* ***** END LICENSE BLOCK ***** */
#endif
#include insideOutBox.js
const INSPECTOR_INVISIBLE_ELEMENTS = {
"head": true,
"base": true,
@ -272,7 +274,7 @@ PanelHighlighter.prototype = {
let visibleWidth = this.win.innerWidth;
let visibleHeight = this.win.innerHeight;
return ((0 <= aRect.left) && (aRect.right <= visibleWidth) &&
return ((0 <= aRect.left) && (aRect.right <= visibleWidth) &&
(0 <= aRect.top) && (aRect.bottom <= visibleHeight))
},
@ -322,169 +324,6 @@ PanelHighlighter.prototype = {
}
};
///////////////////////////////////////////////////////////////////////////
//// InspectorTreeView
/**
* TreeView object to manage the view of the DOM tree. Wraps and provides an
* interface to an inIDOMView object
*
* @param aWindow
* a top-level window object
*/
function InspectorTreeView(aWindow)
{
this.tree = document.getElementById("inspector-tree");
this.treeBody = document.getElementById("inspector-tree-body");
this.view = Cc["@mozilla.org/inspector/dom-view;1"]
.createInstance(Ci.inIDOMView);
this.view.showSubDocuments = true;
this.view.whatToShow = NodeFilter.SHOW_ALL;
this.tree.view = this.view;
this.contentWindow = aWindow;
this.view.rootNode = aWindow.document;
this.view.rebuild();
}
InspectorTreeView.prototype = {
get editable() { return false; },
get selection() { return this.view.selection; },
/**
* Destroy the view.
*/
destroy: function ITV_destroy()
{
this.tree.view = null;
this.view = null;
this.tree = null;
},
/**
* Get the cell text at a given row and column.
*
* @param aRow
* The row index of the desired cell.
* @param aCol
* The column index of the desired cell.
* @returns string
*/
getCellText: function ITV_getCellText(aRow, aCol)
{
return this.view.getCellText(aRow, aCol);
},
/**
* Get the index of the selected row.
*
* @returns number -1 if there is no row selected.
*/
get selectionIndex()
{
return this.selection ? this.selection.currentIndex : -1;
},
/**
* Get the corresponding node for the currently-selected row in the tree.
*
* @returns DOMNode|null
*/
get selectedNode()
{
let rowIndex = this.selectionIndex;
return rowIndex > -1 ? this.view.getNodeFromRowIndex(rowIndex) : null;
},
/**
* Set the selected row in the table to the specified index.
*
* @param anIndex
* The index to set the selection to.
*/
set selectedRow(anIndex)
{
this.view.selection.select(anIndex);
this.tree.treeBoxObject.ensureRowIsVisible(anIndex);
},
/**
* Set the selected node to the specified document node.
*
* @param aNode
* The document node to select in the tree.
*/
set selectedNode(aNode)
{
let rowIndex = this.view.getRowIndexFromNode(aNode);
if (rowIndex > -1) {
this.selectedRow = rowIndex;
} else {
this.selectElementInTree(aNode);
}
},
/**
* Select the given node in the tree, searching for and expanding rows
* as-needed.
*
* @param aNode
* The document node to select in the three.
* @returns boolean
* Whether a node was selected or not if not found.
*/
selectElementInTree: function ITV_selectElementInTree(aNode)
{
if (!aNode) {
this.view.selection.select(null);
return false;
}
// Keep searching until a pre-created ancestor is found, then
// open each ancestor until the found element is created.
let domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].
getService(Ci.inIDOMUtils);
let line = [];
let parent = aNode;
let index = null;
while (parent) {
index = this.view.getRowIndexFromNode(parent);
line.push(parent);
if (index < 0) {
// Row for this node hasn't been created yet.
parent = domUtils.getParentForNode(parent,
this.view.showAnonymousContent);
} else {
break;
}
}
// We have all the ancestors, now open them one-by-one from the top
// to bottom.
let lastIndex;
let view = this.tree.treeBoxObject.view;
for (let i = line.length - 1; i >= 0; --i) {
index = this.view.getRowIndexFromNode(line[i]);
if (index < 0) {
// Can't find the row, so stop trying to descend.
break;
}
if (i > 0 && !view.isContainerOpen(index)) {
view.toggleOpenState(index);
}
lastIndex = index;
}
if (lastIndex >= 0) {
this.selectedRow = lastIndex;
return true;
}
return false;
},
};
///////////////////////////////////////////////////////////////////////////
//// InspectorUI
@ -494,6 +333,7 @@ InspectorTreeView.prototype = {
var InspectorUI = {
browser: null,
selectEventsSuppressed: false,
showTextNodesWithWhitespace: false,
inspecting: false,
/**
@ -504,7 +344,7 @@ var InspectorUI = {
*/
toggleInspectorUI: function IUI_toggleInspectorUI(aEvent)
{
if (this.isPanelOpen) {
if (this.isTreePanelOpen) {
this.closeInspectorUI(true);
} else {
this.openInspectorUI();
@ -533,8 +373,8 @@ var InspectorUI = {
this.stylePanel.hidePopup();
} else {
this.openStylePanel();
if (this.treeView.selectedNode) {
this.updateStylePanel(this.treeView.selectedNode);
if (this.selection) {
this.updateStylePanel(this.selection);
}
}
},
@ -549,8 +389,8 @@ var InspectorUI = {
} else {
this.clearDOMPanel();
this.openDOMPanel();
if (this.treeView.selectedNode) {
this.updateDOMPanel(this.treeView.selectedNode);
if (this.selection) {
this.updateDOMPanel(this.selection);
}
}
},
@ -560,7 +400,7 @@ var InspectorUI = {
*
* @returns boolean
*/
get isPanelOpen()
get isTreePanelOpen()
{
return this.treePanel && this.treePanel.state == "open";
},
@ -585,26 +425,145 @@ var InspectorUI = {
return this.domPanel && this.domPanel.state == "open";
},
/**
* Return the default selection element for the inspected document.
*/
get defaultSelection()
{
let doc = this.win.document;
return doc.documentElement.lastElementChild;
},
/**
* Open the inspector's tree panel and initialize it.
*/
openTreePanel: function IUI_openTreePanel()
{
if (!this.treePanel) {
this.treePanel = document.getElementById("inspector-panel");
this.treePanel = document.getElementById("inspector-tree-panel");
this.treePanel.hidden = false;
}
if (!this.isPanelOpen) {
const panelWidthRatio = 7 / 8;
const panelHeightRatio = 1 / 5;
let bar = document.getElementById("status-bar");
this.treePanel.openPopupAtScreen(this.win.screenX + 80,
this.win.outerHeight + this.win.screenY);
this.treePanel.sizeTo(this.win.outerWidth * panelWidthRatio,
this.win.outerHeight * panelHeightRatio);
this.tree = document.getElementById("inspector-tree");
this.createDocumentModel();
const panelWidthRatio = 7 / 8;
const panelHeightRatio = 1 / 5;
this.treePanel.openPopup(this.browser, "overlap", 80, this.win.innerHeight,
false, false);
this.treePanel.sizeTo(this.win.outerWidth * panelWidthRatio,
this.win.outerHeight * panelHeightRatio);
this.treeIFrame = document.getElementById("inspector-tree-iframe");
this.treeBrowserDocument = this.treeIFrame.contentDocument;
this.treePanelDiv = this.treeBrowserDocument.createElement("div");
this.treeBrowserDocument.body.appendChild(this.treePanelDiv);
this.treePanelDiv.ownerPanel = this;
this.ioBox = new InsideOutBox(this, this.treePanelDiv);
this.ioBox.createObjectBox(this.win.document.documentElement);
},
createObjectBox: function IUI_createObjectBox(object, isRoot)
{
let tag = this.domplateUtils.getNodeTag(object);
if (tag)
return tag.replace({object: object}, this.treeBrowserDocument);
},
getParentObject: function IUI_getParentObject(node)
{
let parentNode = node ? node.parentNode : null;
if (!parentNode) {
// Documents have no parentNode; Attr, Document, DocumentFragment, Entity,
// and Notation. top level windows have no parentNode
if (node && node == Node.DOCUMENT_NODE) {
// document type
if (node.defaultView) {
let embeddingFrame = node.defaultView.frameElement;
if (embeddingFrame)
return embeddingFrame.parentNode;
}
}
// a Document object without a parentNode or window
return null; // top level has no parent
}
if (parentNode.nodeType == Node.DOCUMENT_NODE) {
if (parentNode.defaultView) {
return parentNode.defaultView.frameElement;
}
if (this.embeddedBrowserParents) {
let skipParent = this.embeddedBrowserParents[node];
// HTML element? could be iframe?
if (skipParent)
return skipParent;
} else // parent is document element, but no window at defaultView.
return null;
} else if (!parentNode.localName) {
return null;
}
return parentNode;
},
getChildObject: function IUI_getChildObject(node, index, previousSibling)
{
if (!node)
return null;
if (node.contentDocument) {
// then the node is a frame
if (index == 0) {
if (!this.embeddedBrowserParents)
this.embeddedBrowserParents = {};
let skipChild = node.contentDocument.documentElement;
this.embeddedBrowserParents[skipChild] = node;
return skipChild; // the node's HTMLElement
}
return null;
}
if (node instanceof GetSVGDocument) {
// then the node is a frame
if (index == 0) {
if (!this.embeddedBrowserParents)
this.embeddedBrowserParents = {};
let skipChild = node.getSVGDocument().documentElement;
this.embeddedBrowserParents[skipChild] = node;
return skipChild; // the node's SVGElement
}
return null;
}
let child = null;
if (previousSibling) // then we are walking
child = this.getNextSibling(previousSibling);
else
child = this.getFirstChild(node);
if (this.showTextNodesWithWhitespace)
return child;
for (; child; child = this.getNextSibling(child)) {
if (!this.domplateUtils.isWhitespaceText(child))
return child;
}
return null; // we have no children worth showing.
},
getFirstChild: function IUI_getFirstChild(node)
{
this.treeWalker = node.ownerDocument.createTreeWalker(node,
NodeFilter.SHOW_ALL, null, false);
return this.treeWalker.firstChild();
},
getNextSibling: function IUI_getNextSibling(node)
{
let next = this.treeWalker.nextSibling();
if (!next)
delete this.treeWalker;
return next;
},
/**
@ -664,6 +623,10 @@ var InspectorUI = {
this.browser = gBrowser.selectedBrowser;
this.win = this.browser.contentWindow;
this.winID = this.getWindowID(this.win);
if (!this.domplate) {
Cu.import("resource:///modules/domplate.jsm", this);
this.domplateUtils.setDOM(window);
}
// DOM panel initialization and loading (via PropertyPanel.jsm)
let objectPanelTitle = this.strings.
@ -693,29 +656,16 @@ var InspectorUI = {
// setup highlighter and start inspecting
this.initializeHighlighter();
if (!InspectorStore.hasID(this.winID) ||
InspectorStore.getValue(this.winID, "inspecting")) {
// Setup the InspectorStore or restore state
this.initializeStore();
if (InspectorStore.getValue(this.winID, "inspecting"))
this.startInspecting();
}
this.win.document.addEventListener("scroll", this, false);
this.win.addEventListener("resize", this, false);
this.inspectCmd.setAttribute("checked", true);
if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
}
if (InspectorStore.hasID(this.winID)) {
let selectedNode = InspectorStore.getValue(this.winID, "selectedNode");
if (selectedNode) {
this.inspectNode(selectedNode);
}
} else {
InspectorStore.addStore(this.winID);
InspectorStore.setValue(this.winID, "selectedNode", null);
this.win.addEventListener("pagehide", this, true);
}
document.addEventListener("popupshown", this, false);
},
/**
@ -726,6 +676,30 @@ var InspectorUI = {
this.highlighter = new PanelHighlighter(this.browser);
},
/**
* Initialize the InspectorStore.
*/
initializeStore: function IUI_initializeStore()
{
// First time opened, add the TabSelect listener
if (InspectorStore.isEmpty())
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
// Has this windowID been inspected before?
if (InspectorStore.hasID(this.winID)) {
let selectedNode = InspectorStore.getValue(this.winID, "selectedNode");
if (selectedNode) {
this.inspectNode(selectedNode);
}
} else {
// First time inspecting, set state to no selection + live inspection.
InspectorStore.addStore(this.winID);
InspectorStore.setValue(this.winID, "selectedNode", null);
InspectorStore.setValue(this.winID, "inspecting", true);
this.win.addEventListener("pagehide", this, true);
}
},
/**
* Close inspector UI and associated panels. Unhighlight and stop inspecting.
* Remove event listeners for document scrolling, resize,
@ -736,13 +710,21 @@ var InspectorUI = {
*/
closeInspectorUI: function IUI_closeInspectorUI(aClearStore)
{
if (this.closing || !this.win || !this.browser) {
return;
}
this.closing = true;
if (aClearStore) {
InspectorStore.deleteStore(this.winID);
this.win.removeEventListener("pagehide", this, true);
} else {
// Update the store before closing.
InspectorStore.setValue(this.winID, "selectedNode",
this.treeView.selectedNode);
if (this.selection) {
InspectorStore.setValue(this.winID, "selectedNode",
this.selection);
}
InspectorStore.setValue(this.winID, "inspecting", this.inspecting);
}
@ -756,10 +738,28 @@ var InspectorUI = {
if (this.highlighter && this.highlighter.isHighlighting) {
this.highlighter.unhighlight();
}
if (this.isPanelOpen) {
if (this.isTreePanelOpen)
this.treePanel.hidePopup();
this.treeView.destroy();
if (this.treePanelDiv) {
this.treePanelDiv.ownerPanel = null;
let parent = this.treePanelDiv.parentNode;
parent.removeChild(this.treePanelDiv);
delete this.treePanelDiv;
delete this.treeBrowserDocument;
}
if (this.treeIFrame)
delete this.treeIFrame;
delete this.ioBox;
if (this.domplate) {
this.domplateUtils.setDOM(null);
delete this.domplate;
delete this.HTMLTemplates;
delete this.domplateUtils;
}
if (this.isStylePanelOpen) {
this.stylePanel.hidePopup();
}
@ -772,6 +772,9 @@ var InspectorUI = {
this.inspectCmd.setAttribute("checked", false);
this.browser = this.win = null; // null out references to browser and window
this.winID = null;
this.selection = null;
this.closing = false;
Services.obs.notifyObservers(null, "inspector-closed", null);
},
/**
@ -798,23 +801,40 @@ var InspectorUI = {
this.inspecting = false;
this.toggleDimForPanel(this.stylePanel);
this.toggleDimForPanel(this.domPanel);
if (this.treeView.selection) {
this.updateStylePanel(this.treeView.selectedNode);
this.updateDOMPanel(this.treeView.selectedNode);
if (this.highlighter.node) {
this.select(this.highlighter.node, true, true);
}
},
/**
* Select an object in the tree view.
* @param aNode
* node to inspect
* @param forceUpdate
* force an update?
* @param aScroll
* force scroll?
*/
select: function IUI_select(aNode, forceUpdate, aScroll)
{
if (!aNode)
aNode = this.defaultSelection;
if (forceUpdate || aNode != this.selection) {
this.selection = aNode;
let box = this.ioBox.createObjectBox(this.selection);
if (!this.inspecting) {
this.highlighter.highlightNode(this.selection);
this.updateStylePanel(this.selection);
this.updateDOMPanel(this.selection);
}
this.ioBox.select(aNode, true, true, aScroll);
}
},
/////////////////////////////////////////////////////////////////////////
//// Model Creation Methods
/**
* Create treeView object from content window.
*/
createDocumentModel: function IUI_createDocumentModel()
{
this.treeView = new InspectorTreeView(this.win);
},
/**
* Add a new item to the style panel listbox.
*
@ -879,8 +899,8 @@ var InspectorUI = {
createStyleItems: function IUI_createStyleItems(aRules, aSections)
{
this.createStyleRuleItems(aRules);
let inheritedString =
this.strings.GetStringFromName("style.inheritedFrom");
let inheritedString =
this.strings.GetStringFromName("style.inheritedFrom");
aSections.forEach(function(section) {
let sectionTitle = section.element.tagName;
if (section.element.id)
@ -954,19 +974,34 @@ var InspectorUI = {
{
let winID = null;
let win = null;
let inspectorClosed = false;
switch (event.type) {
case "popupshown":
if (event.target.id == "inspector-tree-panel" ||
event.target.id == "inspector-style-panel" ||
event.target.id == "inspector-dom-panel")
if (this.isTreePanelOpen && this.isStylePanelOpen && this.isDOMPanelOpen) {
document.removeEventListener("popupshowing", this, false);
Services.obs.notifyObservers(null, "inspector-opened", null);
}
break;
case "TabSelect":
winID = this.getWindowID(gBrowser.selectedBrowser.contentWindow);
if (this.isPanelOpen && winID != this.winID) {
if (this.isTreePanelOpen && winID != this.winID) {
this.closeInspectorUI(false);
inspectorClosed = true;
}
if (winID && InspectorStore.hasID(winID)) {
this.openInspectorUI();
}
if (InspectorStore.isEmpty()) {
if (inspectorClosed && this.closing) {
Services.obs.addObserver(function () {
InspectorUI.openInspectorUI();
}, "inspector-closed", false);
} else {
this.openInspectorUI();
}
} else if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
}
break;
@ -1014,24 +1049,31 @@ var InspectorUI = {
},
/**
* Event fired when a tree row is selected in the tree panel.
* Handle click events in the html tree panel.
* @param aEvent
* The mouse event.
*/
onTreeSelected: function IUI_onTreeSelected()
onTreeClick: function IUI_onTreeClick(aEvent)
{
if (this.selectEventsSuppressed) {
return false;
let node;
let target = aEvent.target;
let hitTwisty = false;
if (this.hasClass(target, "twisty")) {
node = this.getRepObject(aEvent.target.nextSibling);
hitTwisty = true;
} else {
node = this.getRepObject(aEvent.target);
}
let node = this.treeView.selectedNode;
this.highlighter.highlightNode(node);
this.stopInspecting();
this.updateStylePanel(node);
this.updateDOMPanel(node);
return true;
if (node) {
if (hitTwisty)
this.ioBox.toggleObject(node);
this.select(node, false, false);
}
},
/**
* Attach event listeners to content window and child windows to enable
* Attach event listeners to content window and child windows to enable
* highlighting and click to stop inspection.
*/
attachPageListeners: function IUI_attachPageListeners()
@ -1066,14 +1108,14 @@ var InspectorUI = {
{
this.highlighter.highlightNode(aNode);
this.selectEventsSuppressed = true;
this.treeView.selectedNode = aNode;
this.select(aNode, true, true);
this.selectEventsSuppressed = false;
this.updateStylePanel(aNode);
this.updateDOMPanel(aNode);
},
/**
* Find an element from the given coordinates. This method descends through
* Find an element from the given coordinates. This method descends through
* frames to find the element the user clicked inside frames.
*
* @param DOMDocument aDocument the document to look into.
@ -1104,6 +1146,47 @@ var InspectorUI = {
///////////////////////////////////////////////////////////////////////////
//// Utility functions
/**
* Does the given object have a class attribute?
* @param aNode
* the DOM node.
* @param aClass
* The class string.
* @returns boolean
*/
hasClass: function IUI_hasClass(aNode, aClass)
{
if (!(aNode instanceof Element))
return false;
return aNode.classList.contains(aClass);
},
/**
* Add the class name to the given object.
* @param aNode
* the DOM node.
* @param aClass
* The class string.
*/
addClass: function IUI_addClass(aNode, aClass)
{
if (aNode instanceof Element)
aNode.classList.add(aClass);
},
/**
* Remove the class name from the given object
* @param aNode
* the DOM node.
* @param aClass
* The class string.
*/
removeClass: function IUI_removeClass(aNode, aClass)
{
if (aNode instanceof Element)
aNode.classList.remove(aClass);
},
/**
* Retrieve the unique ID of a window object.
*
@ -1127,7 +1210,32 @@ var InspectorUI = {
},
/**
* debug logging facility
* Get the "repObject" from the HTML panel's domplate-constructed DOM node.
* In this system, a "repObject" is the Object being Represented by the box
* object. It is the "real" object that we're building our facade around.
*
* @param element
* The element in the HTML panel the user clicked.
* @returns either a real node or null
*/
getRepObject: function IUI_getRepObject(element)
{
let target = null;
for (let child = element; child; child = child.parentNode) {
if (this.hasClass(child, "repTarget"))
target = child;
if (child.repObject) {
if (!target && this.hasClass(child.repObject, "repIgnore"))
break;
else
return child.repObject;
}
}
return null;
},
/**
* @param msg
* text message to send to the log
*/
@ -1215,7 +1323,11 @@ var InspectorStore = {
*/
getValue: function IS_getValue(aID, aKey)
{
return aID in this.store ? this.store[aID][aKey] : null;
if (!this.hasID(aID))
return null;
if (aKey in this.store[aID])
return this.store[aID][aKey];
return null;
},
/**

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

@ -404,7 +404,8 @@ nsContextMenu.prototype = {
this.showItem("context-video-fullscreen", this.onVideo);
// Disable them when there isn't a valid media source loaded.
if (onMedia) {
var hasError = (this.target.error != null);
var hasError = this.target.error != null ||
this.target.networkState == this.target.NETWORK_NO_SOURCE;
this.setItemAttr("context-media-play", "disabled", hasError);
this.setItemAttr("context-media-pause", "disabled", hasError);
this.setItemAttr("context-media-mute", "disabled", hasError);

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

@ -312,3 +312,4 @@ var style = {
}
},
};

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

@ -758,7 +758,11 @@
if (!this._previewMode && oldTab != this.selectedTab)
oldTab.owner = null;
this._lastRelatedTab = null;
if (this._lastRelatedTab) {
if (this._lastRelatedTab != this.selectedTab)
this._lastRelatedTab.owner = null;
this._lastRelatedTab = null;
}
var oldBrowser = this.mCurrentBrowser;
if (oldBrowser) {
@ -808,6 +812,8 @@
this._fastFind.setDocShell(this.mCurrentBrowser.docShell);
this.updateTitlebar();
this.mCurrentTab.removeAttribute("titlechanged");
}
// If the new tab is busy, and our current state is not busy, then
@ -884,7 +890,7 @@
<body>
<![CDATA[
aTab.label = this.mStringBundle.getString("tabs.loading");
aTab.setAttribute("crop", "end");
aTab.crop = "end";
this._tabAttrModified(aTab);
]]>
</body>
@ -924,9 +930,14 @@
title = this.mStringBundle.getString("tabs.emptyTabTitle");
}
if (aTab.label == title &&
aTab.crop == crop)
return false;
aTab.label = title;
aTab.setAttribute("crop", crop);
aTab.crop = crop;
this._tabAttrModified(aTab);
return true;
]]>
</body>
</method>
@ -1245,6 +1256,10 @@
Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
let newTabPos = (this._lastRelatedTab ||
this.selectedTab)._tPos + 1;
if (this._lastRelatedTab)
this._lastRelatedTab.owner = null;
else
t.owner = this.selectedTab;
this.moveTabTo(t, newTabPos);
this._lastRelatedTab = t;
}
@ -1441,7 +1456,7 @@
filter.removeProgressListener(this.mTabListeners[aTab._tPos]);
this.mTabListeners[aTab._tPos].destroy();
if (browser.registeredOpenURI) {
if (browser.registeredOpenURI && !aTabWillBeMoved) {
this.mBrowserHistory.unregisterOpenPage(browser.registeredOpenURI);
delete browser.registeredOpenURI;
}
@ -1643,10 +1658,18 @@
filter.removeProgressListener(tabListener);
var tabListenerBlank = tabListener.mBlank;
var otherBrowser = aOtherTab.linkedBrowser;
// Restore current registered open URI.
if (ourBrowser.registeredOpenURI)
this.mBrowserHistory.unregisterOpenPage(ourBrowser.registeredOpenURI);
if (otherBrowser.registeredOpenURI)
ourBrowser.registeredOpenURI = otherBrowser.registeredOpenURI;
// Workarounds for bug 458697
// Icon might have been set on DOMLinkAdded, don't override that.
if (!ourBrowser.mIconURL && aOtherTab.linkedBrowser.mIconURL)
this.setIcon(aOurTab, aOtherTab.linkedBrowser.mIconURL);
if (!ourBrowser.mIconURL && otherBrowser.mIconURL)
this.setIcon(aOurTab, otherBrowser.mIconURL);
var isBusy = aOtherTab.hasAttribute("busy");
if (isBusy) {
aOurTab.setAttribute("busy", "true");
@ -1656,7 +1679,7 @@
}
// Swap the docshells
ourBrowser.swapDocShells(aOtherTab.linkedBrowser);
ourBrowser.swapDocShells(otherBrowser);
// Finish tearing down the tab that's going away.
remoteBrowser._endRemoveTab(aOtherTab);
@ -2446,9 +2469,14 @@
return;
var tab = this._getTabForContentWindow(contentWin);
this.setTabTitle(tab);
var titleChanged = this.setTabTitle(tab);
if (!titleChanged)
return;
if (tab == this.mCurrentTab)
this.updateTitlebar();
else if (!tab.hasAttribute("busy"))
tab.setAttribute("titlechanged", "true");
]]>
</handler>
</handlers>
@ -2773,7 +2801,16 @@
<method name="_getDragTargetTab">
<parameter name="event"/>
<body><![CDATA[
return event.target.localName == "tab" ? event.target : null;
let tab = event.target.localName == "tab" ? event.target : null;
if (tab &&
(event.type == "drop" || event.type == "dragover") &&
event.dataTransfer.dropEffect == "link") {
let boxObject = tab.boxObject;
if (event.screenX < boxObject.screenX + boxObject.width * .25 ||
event.screenX > boxObject.screenX + boxObject.width * .75)
return null;
}
return tab;
]]></body>
</method>
@ -3022,6 +3059,7 @@
this._dragTime = Date.now();
if (Date.now() >= this._dragTime + this._dragOverDelay)
this.selectedItem = tab;
ind.collapsed = true;
return;
}
}

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

@ -2,9 +2,9 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/tabview/AllTabs.jsm");
Cu.import("resource://gre/modules/tabview/groups.jsm");
Cu.import("resource://gre/modules/tabview/utils.jsm");
Cu.import("resource:///modules/tabview/AllTabs.jsm");
Cu.import("resource:///modules/tabview/groups.jsm");
Cu.import("resource:///modules/tabview/utils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

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

@ -81,6 +81,10 @@ var UIManager = {
// Used to facilitate zooming down from a previous tab.
_currentTab : null,
// Variable: _eventListeners
// Keeps track of event listeners added to the AllTabs object.
_eventListeners: {},
// ----------
// Function: init
// Must be called after the object is created.
@ -238,6 +242,7 @@ var UIManager = {
GroupItems.uninit();
Storage.uninit();
this._removeTabActionHandlers();
this._currentTab = null;
this._pageBounds = null;
this._reorderTabItemsOnShow = null;
@ -407,7 +412,7 @@ var UIManager = {
_addTabActionHandlers: function() {
var self = this;
AllTabs.register("close", function(tab) {
this._eventListeners.close = function(tab) {
if (tab.ownerDocument.defaultView != gWindow)
return;
@ -438,23 +443,34 @@ var UIManager = {
}
}
}
});
};
AllTabs.register("move", function(tab) {
this._eventListeners.move = function(tab) {
if (tab.ownerDocument.defaultView != gWindow)
return;
let activeGroupItem = GroupItems.getActiveGroupItem();
if (activeGroupItem)
self.setReorderTabItemsOnShow(activeGroupItem);
});
};
AllTabs.register("select", function(tab) {
this._eventListeners.select = function(tab) {
if (tab.ownerDocument.defaultView != gWindow)
return;
self.onTabSelect(tab);
});
};
for (let name in this._eventListeners)
AllTabs.register(name, this._eventListeners[name]);
},
// ----------
// Function: _removeTabActionHandlers
// Removes handlers to handle tab actions.
_removeTabActionHandlers: function() {
for (let name in this._eventListeners)
AllTabs.unregister(name, this._eventListeners[name]);
},
// ----------

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

@ -90,6 +90,8 @@ endif
# back to the clear recent history dialog (santize.xul), if it ever is (bug
# 480169)
# browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
_BROWSER_FILES = \
browser_typeAheadFind.js \
browser_NetworkPrioritizer.js \
@ -130,12 +132,14 @@ _BROWSER_FILES = \
browser_bug519216.js \
browser_bug520538.js \
browser_bug521216.js \
browser_bug533232.js \
browser_bug537474.js \
browser_bug550565.js \
browser_bug553455.js \
browser_bug555224.js \
browser_bug555767.js \
browser_bug556061.js \
browser_bug559991.js \
browser_bug561623.js \
browser_bug562649.js \
browser_bug563588.js \
@ -148,7 +152,6 @@ _BROWSER_FILES = \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \
browser_discovery.js \
browser_drag.js \
browser_duplicateIDs.js \
browser_gestureSupport.js \
browser_getshortcutoruri.js \
@ -162,6 +165,9 @@ _BROWSER_FILES = \
browser_inspector_scrolling.js \
browser_inspector_store.js \
browser_inspector_tab_switch.js \
browser_inspector_treePanel_output.js \
browser_inspector_treePanel_input.html \
browser_inspector_treePanel_result.html \
browser_pageInfo.js \
browser_page_style_menu.js \
browser_pinnedTabs.js \
@ -183,6 +189,7 @@ _BROWSER_FILES = \
browser_visibleTabs_bookmarkAllTabs.js \
browser_visibleTabs_tabPreview.js \
discovery.html \
domplate_test.js \
moz.png \
test_bug435035.html \
test_bug462673.html \
@ -198,7 +205,7 @@ _BROWSER_FILES = \
browser_tabMatchesInAwesomebar.js \
file_bug550565_popup.html \
file_bug550565_favicon.ico \
$(NULL)
$(NULL)
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
_BROWSER_FILES += \

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

@ -0,0 +1,36 @@
function test() {
var tab1 = gBrowser.selectedTab;
var tab2 = gBrowser.addTab();
var childTab1;
var childTab2;
childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
gBrowser.selectedTab = childTab1;
gBrowser.removeCurrentTab();
is(idx(gBrowser.selectedTab), idx(tab1),
"closing a tab next to its parent selects the parent");
childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
gBrowser.selectedTab = tab2;
gBrowser.selectedTab = childTab1;
gBrowser.removeCurrentTab();
is(idx(gBrowser.selectedTab), idx(tab2),
"closing a tab next to its parent doesn't select the parent if another tab had been selected ad interim");
gBrowser.selectedTab = tab1;
childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
childTab2 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
gBrowser.selectedTab = childTab1;
gBrowser.removeCurrentTab();
is(idx(gBrowser.selectedTab), idx(childTab2),
"closing a tab next to its parent selects the next tab with the same parent");
gBrowser.removeCurrentTab();
is(idx(gBrowser.selectedTab), idx(tab2),
"closing the last tab in a set of child tabs doesn't go back to the parent");
gBrowser.removeTab(tab2);
}
function idx(tab) {
return Array.indexOf(gBrowser.tabs, tab);
}

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

@ -0,0 +1,64 @@
function test() {
// ----------
// Test setup
waitForExplicitFinish();
let oldOLC = FullZoom.onLocationChange;
FullZoom.onLocationChange = function(aURI, aIsTabSwitch, aBrowser) {
// Ignore calls that are not about tab switching on this test
if (aIsTabSwitch)
oldOLC.call(FullZoom, aURI, aIsTabSwitch, aBrowser);
};
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
let oldAPTS = FullZoom._applyPrefToSetting;
let uri = "http://example.org/browser/browser/base/content/test/dummy_page.html";
// ------------------------------------------------------
// Test 1 - Zoom should not be called if URIs don't match
FullZoom._applyPrefToSetting = function() {
ok(false, "This should not be called");
};
FullZoom.onLocationChange(makeURI(uri), true);
let tab = gBrowser.addTab();
tab.linkedBrowser.addEventListener("load", function(event) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
// -------------------------------------------------------------------
// Test 2 - Trigger a tab switch that should now update the zoom level
FullZoom._applyPrefToSetting = function() {
ok(true, "applyPrefToSetting was called");
endTest();
}
gBrowser.selectedTab = tab;
}, true);
tab.linkedBrowser.loadURI(uri);
// -------------
// Test clean-up
function endTest() {
gBrowser.removeTab(tab);
FullZoom._applyPrefToSetting = oldAPTS;
FullZoom.onLocationChange = oldOLC;
oldAPTS = null;
oldOLC = null;
tab = null;
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
gPrefService.clearUserPref("browser.zoom.siteSpecific");
finish();
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше