Merge mozilla-central and mozilla-inbound

This commit is contained in:
Marco Bonardo 2011-08-04 11:35:17 +02:00
commit 527591fbb1
88 changed files with 974 additions and 390 deletions

View File

@ -408,12 +408,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
// the Component interface are supported by all nsIAccessible
interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
// Add Action interface if the action count is more than zero.
PRUint8 actionCount = 0;
nsresult rv = GetNumActions(&actionCount);
if (NS_SUCCEEDED(rv) && actionCount > 0) {
interfacesBits |= 1 << MAI_INTERFACE_ACTION;
}
// Add Action interface if the action count is more than zero.
if (ActionCount() > 0)
interfacesBits |= 1 << MAI_INTERFACE_ACTION;
//nsIAccessibleText
nsCOMPtr<nsIAccessibleText> accessInterfaceText;

View File

@ -73,13 +73,8 @@ doActionCB(AtkAction *aAction, gint aActionIndex)
gint
getActionCountCB(AtkAction *aAction)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
if (!accWrap)
return 0;
PRUint8 num = 0;
nsresult rv = accWrap->GetNumActions(&num);
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(num);
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
return accWrap ? accWrap->ActionCount() : 0;
}
const gchar *

View File

@ -132,27 +132,17 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
if (mParent)
return;
// Compute 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.
if (aRole == nsIAccessibleRole::ROLE_ROW &&
parentRole == nsIAccessibleRole::ROLE_TREE_TABLE) {
if (IsConceptualParent(aRole, parentRole))
mParent = parent;
return;
}
// In the case of ARIA tree, a tree can be arranged by using ARIA groups
// to organize levels. In this case the parent of the tree item will be
// a group and the previous treeitem of that should be the tree item
// parent. Or, if the parent is something other than a tree we will
// return that.
if (parentRole != nsIAccessibleRole::ROLE_GROUPING) {
mParent = parent;
// In the case of ARIA tree (not ARIA treegrid) a tree can be arranged by
// using ARIA groups to organize levels. In this case the parent of the tree
// item will be a group and the previous treeitem of that should be the tree
// item parent.
if (parentRole != nsIAccessibleRole::ROLE_GROUPING ||
aRole != nsIAccessibleRole::ROLE_OUTLINEITEM)
return;
}
nsAccessible* parentPrevSibling = parent->PrevSibling();
if (!parentPrevSibling)
@ -174,3 +164,37 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_OUTLINEITEM)
mParent = parentPrevSibling;
}
bool
AccGroupInfo::IsConceptualParent(PRUint32 aRole, PRUint32 aParentRole)
{
if (aParentRole == nsIAccessibleRole::ROLE_OUTLINE &&
aRole == nsIAccessibleRole::ROLE_OUTLINEITEM)
return true;
if ((aParentRole == nsIAccessibleRole::ROLE_TABLE ||
aParentRole == nsIAccessibleRole::ROLE_TREE_TABLE) &&
aRole == nsIAccessibleRole::ROLE_ROW)
return true;
if (aParentRole == nsIAccessibleRole::ROLE_ROW &&
(aRole == nsIAccessibleRole::ROLE_CELL ||
aRole == nsIAccessibleRole::ROLE_GRID_CELL))
return true;
if (aParentRole == nsIAccessibleRole::ROLE_LIST &&
aRole == nsIAccessibleRole::ROLE_LISTITEM)
return true;
if (aParentRole == nsIAccessibleRole::ROLE_COMBOBOX_LIST &&
aRole == nsIAccessibleRole::ROLE_COMBOBOX_OPTION)
return true;
if (aParentRole == nsIAccessibleRole::ROLE_LISTBOX &&
aRole == nsIAccessibleRole::ROLE_OPTION)
return true;
if (aParentRole == nsIAccessibleRole::ROLE_PAGETABLIST &&
aRole == nsIAccessibleRole::ROLE_PAGETAB)
return true;
if ((aParentRole == nsIAccessibleRole::ROLE_POPUP_MENU ||
aParentRole == nsIAccessibleRole::ROLE_MENUPOPUP) &&
aRole == nsIAccessibleRole::ROLE_MENUITEM)
return true;
return false;
}

View File

@ -52,7 +52,7 @@ public:
PRInt32 PosInSet() const { return mPosInSet; }
PRUint32 SetSize() const { return mSetSize; }
nsAccessible* GetConceptualParent() const { return mParent; }
nsAccessible* ConceptualParent() const { return mParent; }
/**
* Create group info.
@ -88,6 +88,12 @@ private:
return aRole;
}
/**
* Return true if the given parent role is conceptual parent of the given
* role.
*/
static bool IsConceptualParent(PRUint32 aRole, PRUint32 aParentRole);
PRUint32 mPosInSet;
PRUint32 mSetSize;
nsAccessible* mParent;

View File

@ -1849,22 +1849,23 @@ nsAccessible::NativeRole()
// readonly attribute PRUint8 numActions
NS_IMETHODIMP
nsAccessible::GetNumActions(PRUint8 *aNumActions)
nsAccessible::GetNumActions(PRUint8* aActionCount)
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 0;
NS_ENSURE_ARG_POINTER(aActionCount);
*aActionCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRUint32 actionRule = GetActionRule(State());
if (actionRule == eNoAction)
return NS_OK;
*aNumActions = 1;
*aActionCount = ActionCount();
return NS_OK;
}
PRUint8
nsAccessible::ActionCount()
{
return GetActionRule(State()) == eNoAction ? 0 : 1;
}
/* DOMString getAccActionName (in PRUint8 index); */
NS_IMETHODIMP
nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
@ -2140,7 +2141,7 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
return NS_OK_NO_RELATION_TARGET;
return nsRelUtils::AddTarget(aRelationType, aRelation,
groupInfo->GetConceptualParent());
groupInfo->ConceptualParent());
}
// If accessible is in its own Window, or is the root of a document,

View File

@ -418,6 +418,11 @@ public:
//////////////////////////////////////////////////////////////////////////////
// ActionAccessible
/**
* Return the number of actions that can be performed on this accessible.
*/
virtual PRUint8 ActionCount();
/**
* Return access key, such as Alt+D.
*/
@ -676,7 +681,7 @@ protected:
/**
* Return the action rule based on ARIA enum constants EActionRule
* (see nsARIAMap.h). Used by GetNumActions() and GetActionName().
* (see nsARIAMap.h). Used by ActionCount() and GetActionName().
*
* @param aStates [in] states of the accessible
*/

View File

@ -237,12 +237,10 @@ nsApplicationAccessible::TakeFocus()
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsApplicationAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 0;
return NS_OK;
return 0;
}
NS_IMETHODIMP

View File

@ -103,7 +103,6 @@ public:
NS_IMETHOD SetSelected(PRBool aIsSelected);
NS_IMETHOD TakeSelection();
NS_IMETHOD TakeFocus();
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString &aName);
NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString &aDescription);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -129,6 +128,7 @@ public:
virtual void InvalidateChildren();
// ActionAccessible
virtual PRUint8 ActionCount();
virtual KeyBinding AccessKey() const;
protected:

View File

@ -138,13 +138,10 @@ nsLinkableAccessible::GetValue(nsAString& aValue)
}
NS_IMETHODIMP
nsLinkableAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsLinkableAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = (mIsOnclick || mIsLink) ? 1 : 0;
return NS_OK;
return (mIsOnclick || mIsLink) ? 1 : 0;
}
NS_IMETHODIMP

View File

@ -87,7 +87,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetValue(nsAString& _retval);
@ -100,6 +99,7 @@ public:
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
virtual KeyBinding AccessKey() const;
// HyperLinkAccessible

View File

@ -191,13 +191,10 @@ nsRadioButtonAccessible::
{
}
NS_IMETHODIMP
nsRadioButtonAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsRadioButtonAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP nsRadioButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)

View File

@ -75,13 +75,15 @@ public:
nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual PRUint32 NativeRole();
// ActionAccessible
virtual PRUint8 ActionCount();
enum { eAction_Click = 0 };
};

View File

@ -112,14 +112,11 @@ nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
NS_IMETHODIMP
nsOuterDocAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsOuterDocAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 0;
// Internal frame, which is the doc's parent, should not have a click action.
return NS_OK;
return 0;
}
NS_IMETHODIMP

View File

@ -58,7 +58,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString& aDescription);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -77,6 +76,9 @@ public:
virtual PRBool AppendChild(nsAccessible *aAccessible);
virtual PRBool RemoveChild(nsAccessible *aAccessible);
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
// nsAccessible
virtual void CacheChildren();

View File

@ -78,10 +78,10 @@ nsHTMLCheckboxAccessible::NativeRole()
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsHTMLCheckboxAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
@ -237,10 +237,10 @@ nsHTMLButtonAccessible::
{
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsHTMLButtonAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
@ -325,10 +325,10 @@ nsHTML4ButtonAccessible::
{
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsHTML4ButtonAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;;
return 1;
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
@ -514,10 +514,10 @@ nsHTMLTextFieldAccessible::NativeState()
return state;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsHTMLTextFieldAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;;
return 1;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)

View File

@ -59,13 +59,15 @@ public:
nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};
@ -98,7 +100,6 @@ public:
nsHTMLButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -106,6 +107,9 @@ public:
virtual nsresult GetNameInternal(nsAString& aName);
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};
@ -121,13 +125,15 @@ public:
nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};
@ -146,7 +152,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -157,6 +162,9 @@ public:
virtual nsresult GetNameInternal(nsAString& aName);
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};

View File

@ -131,22 +131,11 @@ nsHTMLImageAccessible::NativeRole()
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
NS_IMETHODIMP
nsHTMLImageAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsHTMLImageAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv= nsLinkableAccessible::GetNumActions(aNumActions);
NS_ENSURE_SUCCESS(rv, rv);
if (HasLongDesc())
(*aNumActions)++;
return NS_OK;
PRUint8 actionCount = nsLinkableAccessible::ActionCount();
return HasLongDesc() ? actionCount + 1 : actionCount;
}
NS_IMETHODIMP
@ -248,9 +237,5 @@ nsHTMLImageAccessible::IsValidLongDescIndex(PRUint8 aIndex)
if (!HasLongDesc())
return PR_FALSE;
PRUint8 numActions = 0;
nsresult rv = nsLinkableAccessible::GetNumActions(&numActions);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
return (aIndex == numActions);
return aIndex == nsLinkableAccessible::ActionCount();
}

View File

@ -57,7 +57,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -70,6 +69,9 @@ public:
virtual PRUint64 NativeState();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
// ActionAccessible
virtual PRUint8 ActionCount();
private:
/**
* Determine if this image accessible has a longdesc attribute.

View File

@ -120,16 +120,10 @@ nsHTMLLinkAccessible::GetValue(nsAString& aValue)
return presShell->GetLinkLocation(DOMNode, aValue);
}
NS_IMETHODIMP
nsHTMLLinkAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsHTMLLinkAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
if (!IsLinked())
return nsHyperTextAccessible::GetNumActions(aNumActions);
*aNumActions = 1;
return NS_OK;
return IsLinked() ? 1 : nsHyperTextAccessible::ActionCount();
}
NS_IMETHODIMP

View File

@ -52,7 +52,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -60,6 +59,9 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
// HyperLinkAccessible
virtual bool IsLink();
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);

View File

@ -371,10 +371,10 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetActionName(PRUint8 aIndex, nsAStr
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsHTMLSelectOptionAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
@ -616,9 +616,10 @@ NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::GetActionName(PRUint8 aIndex, nsAS
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsHTMLSelectOptGroupAccessible::ActionCount()
{
return NS_ERROR_NOT_IMPLEMENTED;
return 0;
}
////////////////////////////////////////////////////////////////////////////////
@ -773,11 +774,10 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetValue(nsAString& aValue)
return option ? option->GetName(aValue) : NS_OK;
}
/** Just one action ( click ). */
NS_IMETHODIMP nsHTMLComboboxAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsHTMLComboboxAccessible::ActionCount()
{
*aNumActions = 1;
return NS_OK;
return 1;
}
/**

View File

@ -108,7 +108,6 @@ public:
// nsIAccessible
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD SetSelected(PRBool aSelect);
// nsAccessible
@ -120,6 +119,9 @@ public:
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize);
// ActionAccessible
virtual PRUint8 ActionCount();
/**
* Return focused option if any.
*/
@ -154,12 +156,14 @@ public:
// nsIAccessible
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
// nsAccessible
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
// nsAccessible
virtual void CacheChildren();
@ -185,7 +189,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessNode
@ -197,6 +200,9 @@ public:
virtual PRUint64 NativeState();
virtual void InvalidateChildren();
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
// nsAccessible
virtual void CacheChildren();

View File

@ -63,21 +63,19 @@ CAccessibleAction::QueryInterface(REFIID iid, void** ppv)
// IAccessibleAction
STDMETHODIMP
CAccessibleAction::nActions(long *aNumActions)
CAccessibleAction::nActions(long* aActionCount)
{
__try {
*aNumActions = 0;
if (!aActionCount)
return E_INVALIDARG;
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
*aActionCount = 0;
nsRefPtr<nsAccessible> acc(do_QueryObject(this));
if (!acc || acc->IsDefunct())
return E_FAIL;
PRUint8 count = 0;
nsresult rv = acc->GetNumActions(&count);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aNumActions = count;
*aActionCount = acc->ActionCount();
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

View File

@ -545,13 +545,10 @@ nsXFormsSelectableItemAccessible::GetValue(nsAString& aValue)
return sXFormsService->GetValue(DOMNode, aValue);
}
NS_IMETHODIMP
nsXFormsSelectableItemAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXFormsSelectableItemAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -190,9 +190,11 @@ public:
nsIWeakReference *aShell);
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD DoAction(PRUint8 aIndex);
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
bool IsSelected();
};

View File

@ -115,13 +115,10 @@ nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsTriggerAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXFormsTriggerAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP
@ -163,13 +160,10 @@ nsXFormsInputAccessible::NativeRole()
return nsIAccessibleRole::ROLE_ENTRY;
}
NS_IMETHODIMP
nsXFormsInputAccessible::GetNumActions(PRUint8* aCount)
PRUint8
nsXFormsInputAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP
@ -225,13 +219,10 @@ nsXFormsInputBooleanAccessible::NativeState()
return state;
}
NS_IMETHODIMP
nsXFormsInputBooleanAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXFormsInputBooleanAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -81,12 +81,14 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual PRUint32 NativeRole();
// ActionAccessible
virtual PRUint8 ActionCount();
};
/**
@ -101,12 +103,14 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual PRUint32 NativeRole();
// ActionAccessible
virtual PRUint8 ActionCount();
};
/**
@ -119,13 +123,15 @@ public:
nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};
/**

View File

@ -70,13 +70,10 @@ nsXFormsDropmarkerWidgetAccessible::NativeState()
return isOpen ? states::PRESSED: 0;
}
NS_IMETHODIMP
nsXFormsDropmarkerWidgetAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXFormsDropmarkerWidgetAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -55,13 +55,15 @@ public:
nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};

View File

@ -151,15 +151,11 @@ nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
// menuitems
return PR_FALSE;
}
NS_IMETHODIMP
nsXULComboboxAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsXULComboboxAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
// Just one action (click).
*aNumActions = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -56,7 +56,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD DoAction(PRUint8 aIndex);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
@ -64,6 +63,9 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
virtual PRBool GetAllowsAnonChildAccessibles();
// ActionAccessible
virtual PRUint8 ActionCount();
};
#endif

View File

@ -82,13 +82,10 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsXULButtonAccessible, nsAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsXULButtonAccessible: nsIAccessible
NS_IMETHODIMP
nsXULButtonAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXULButtonAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP
@ -249,10 +246,10 @@ nsXULDropmarkerAccessible::
{
}
NS_IMETHODIMP nsXULDropmarkerAccessible::GetNumActions(PRUint8 *aResult)
PRUint8
nsXULDropmarkerAccessible::ActionCount()
{
*aResult = 1;
return NS_OK;
return 1;
}
PRBool nsXULDropmarkerAccessible::DropmarkerOpen(PRBool aToggleOpen)
@ -320,7 +317,6 @@ nsXULDropmarkerAccessible::NativeState()
return DropmarkerOpen(PR_FALSE) ? states::PRESSED : 0;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULCheckboxAccessible
////////////////////////////////////////////////////////////////////////////////
@ -337,10 +333,10 @@ nsXULCheckboxAccessible::NativeRole()
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
NS_IMETHODIMP nsXULCheckboxAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsXULCheckboxAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
/**
@ -756,14 +752,13 @@ nsXULTextFieldAccessible::NativeRole()
return nsIAccessibleRole::ROLE_ENTRY;
}
/**
* Only one actions available
*/
NS_IMETHODIMP nsXULTextFieldAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsXULTextFieldAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
/**

View File

@ -67,7 +67,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -75,6 +74,9 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
// nsAccessible
@ -95,13 +97,15 @@ public:
nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};
/**
@ -114,7 +118,6 @@ public:
nsXULDropmarkerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -122,6 +125,9 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
private:
PRBool DropmarkerOpen(PRBool aToggleOpen);
};
@ -240,7 +246,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
@ -253,6 +258,9 @@ public:
virtual PRUint64 NativeState();
virtual PRBool GetAllowsAnonChildAccessibles();
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
// nsAccessible
virtual void CacheChildren();

View File

@ -95,13 +95,10 @@ nsXULColumnItemAccessible::NativeState()
return states::READONLY;
}
NS_IMETHODIMP
nsXULColumnItemAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsXULColumnItemAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -72,7 +72,6 @@ public:
nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -80,6 +79,9 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
enum { eAction_Click = 0 };
};

View File

@ -565,10 +565,10 @@ NS_IMETHODIMP nsXULMenuitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsXULMenuitemAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
@ -612,12 +612,12 @@ NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetActionName(PRUint8 aIndex, nsAStr
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsXULMenuSeparatorAccessible::ActionCount()
{
return NS_ERROR_NOT_IMPLEMENTED;
return 0;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULMenupopupAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -84,7 +84,6 @@ public:
// nsIAccessible
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
// nsAccessible
virtual void Description(nsString& aDescription);
@ -98,6 +97,7 @@ public:
virtual PRBool GetAllowsAnonChildAccessibles();
// ActionAccessible
virtual PRUint8 ActionCount();
virtual KeyBinding AccessKey() const;
virtual KeyBinding KeyboardShortcut() const;
};
@ -113,12 +113,14 @@ public:
// nsIAccessible
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};

View File

@ -97,13 +97,10 @@ nsXULSliderAccessible::GetValue(nsAString& aValue)
return GetSliderAttr(nsAccessibilityAtoms::curpos, aValue);
}
NS_IMETHODIMP
nsXULSliderAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXULSliderAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -56,7 +56,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -68,6 +67,9 @@ public:
virtual PRUint64 NativeState();
virtual PRBool GetAllowsAnonChildAccessibles();
// ActionAccessible
virtual PRUint8 ActionCount();
protected:
already_AddRefed<nsIContent> GetSliderNode();

View File

@ -65,10 +65,10 @@ nsXULTabAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsXULTabAccessible: nsIAccessible
NS_IMETHODIMP nsXULTabAccessible::GetNumActions(PRUint8 *_retval)
PRUint8
nsXULTabAccessible::ActionCount()
{
*_retval = 1;
return NS_OK;
return 1;
}
/** Return the name of our only action */
@ -191,13 +191,10 @@ nsXULTabsAccessible::NativeRole()
return nsIAccessibleRole::ROLE_PAGETABLIST;
}
NS_IMETHODIMP
nsXULTabsAccessible::GetNumActions(PRUint8 *aCount)
PRUint8
nsXULTabsAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
return NS_OK;
return 0;
}
/** no value */

View File

@ -54,7 +54,6 @@ public:
nsXULTabAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
@ -65,6 +64,9 @@ public:
PRInt32 *aSetSize);
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
};
@ -77,12 +79,14 @@ public:
nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsIAccessible
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetValue(nsAString& _retval);
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual PRUint32 NativeRole();
// ActionAccessible
virtual PRUint8 ActionCount();
};

View File

@ -189,13 +189,10 @@ nsXULLinkAccessible::NativeState()
return nsHyperTextAccessible::NativeState() | states::LINKED;
}
NS_IMETHODIMP
nsXULLinkAccessible::GetNumActions(PRUint8 *aNumActions)
PRUint8
nsXULLinkAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 1;
return NS_OK;
return 1;
}
NS_IMETHODIMP

View File

@ -87,7 +87,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -96,6 +95,9 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
// ActionAccessible
virtual PRUint8 ActionCount();
// HyperLinkAccessible
virtual bool IsLink();
virtual PRUint32 StartOffset();

View File

@ -784,19 +784,12 @@ nsXULTreeItemAccessibleBase::GetRelationByType(PRUint32 aRelationType,
return nsAccessible::GetRelationByType(aRelationType, aRelation);
}
NS_IMETHODIMP
nsXULTreeItemAccessibleBase::GetNumActions(PRUint8 *aActionsCount)
PRUint8
nsXULTreeItemAccessibleBase::ActionCount()
{
NS_ENSURE_ARG_POINTER(aActionsCount);
*aActionsCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
// "activate" action is available for all treeitems, "expand/collapse" action
// is avaible for treeitem which is container.
*aActionsCount = IsExpandable() ? 2 : 1;
return NS_OK;
return IsExpandable() ? 2 : 1;
}
NS_IMETHODIMP

View File

@ -195,7 +195,6 @@ public:
PRInt32 *aSimilarItemsInGroup,
PRInt32 *aPositionInGroup);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -209,6 +208,9 @@ public:
virtual PRInt32 IndexInParent() const;
virtual nsAccessible* FocusedChild();
// ActionAccessible
virtual PRUint8 ActionCount();
// nsXULTreeItemAccessibleBase
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)

View File

@ -919,28 +919,20 @@ nsXULTreeGridCellAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetNumActions(PRUint8 *aActionsCount)
PRUint8
nsXULTreeGridCellAccessible::ActionCount()
{
NS_ENSURE_ARG_POINTER(aActionsCount);
*aActionsCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRBool isCycler = PR_FALSE;
mColumn->GetCycler(&isCycler);
if (isCycler) {
*aActionsCount = 1;
return NS_OK;
}
if (isCycler)
return 1;
PRInt16 type;
mColumn->GetType(&type);
if (type == nsITreeColumn::TYPE_CHECKBOX && IsEditable())
*aActionsCount = 1;
return 1;
return NS_OK;
return 0;
}
NS_IMETHODIMP

View File

@ -148,7 +148,6 @@ public:
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
@ -163,9 +162,12 @@ public:
// nsAccessible
virtual nsAccessible* FocusedChild();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual PRInt32 IndexInParent() const;
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
virtual PRInt32 IndexInParent() const;
// ActionAccessible
virtual PRUint8 ActionCount();
// nsXULTreeGridCellAccessible
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)

View File

@ -69,6 +69,10 @@
testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4");
// no relation node_child_of for accessible contained in an unexpected
// parent
testRelation("treeitem6", RELATION_NODE_CHILD_OF, null);
// 'node child of' relation for the document having window, returns
// direct accessible parent (fixed in bug 419770).
var iframeElmObj = {};
@ -146,6 +150,11 @@
title="mochitests for accessible relations">
Mozilla Bug 475298
</a><br/>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=673389"
title="node_child_of on an item not in a proper container">
Mozilla Bug 67389
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
@ -192,6 +201,8 @@
<description role="treeitem" id="treeitem5" aria-level="2">Light green</description>
</vbox>
<description role="treeitem" id="treeitem6">Dark green</description>
<iframe id="iframe"/>
<hbox id="tablist" role="tablist">

View File

@ -234,14 +234,6 @@
close="true"
onpopuphiding="InspectorUI.closeInspectorUI();"
label="&inspectPanelTitle.label;">
<toolbar id="inspector-toolbar"
nowindowdrag="true">
<toolbarbutton id="inspector-inspect-toolbutton"
label="&inspectButton.label;"
accesskey="&inspectButton.accesskey;"
class="toolbarbutton-text"
command="Inspector:Inspect"/>
</toolbar>
<hbox id="tree-panel-resizer-box" align="end">
<spacer flex="1" />
<resizer dir="bottomend" />
@ -971,6 +963,18 @@
</hbox>
<vbox id="browser-bottombox" layer="true">
<toolbar id="inspector-toolbar"
hidden="true">
<toolbarbutton id="inspector-inspect-toolbutton"
label="&inspectButton.label;"
accesskey="&inspectButton.accesskey;"
class="toolbarbutton-text"
command="Inspector:Inspect"/>
<toolbarseparator />
<hbox id="inspector-tools">
<!-- registered tools go here -->
</hbox>
</toolbar>
<toolbar id="addon-bar"
toolbarname="&addonBarCmd.label;" accesskey="&addonBarCmd.accesskey;"
collapsed="true"

View File

@ -222,6 +222,7 @@ Highlighter.prototype = {
this.highlighterContainer = null;
this.win = null
this.browser = null;
this.toolbar = null;
},
/**
@ -758,6 +759,8 @@ var InspectorUI = {
this.browser = gBrowser.selectedBrowser;
this.win = this.browser.contentWindow;
this.winID = this.getWindowID(this.win);
this.toolbar = document.getElementById("inspector-toolbar");
if (!this.domplate) {
Cu.import("resource:///modules/domplate.jsm", this);
this.domplateUtils.setDOM(window);
@ -765,6 +768,7 @@ var InspectorUI = {
this.openTreePanel();
this.toolbar.hidden = null;
this.inspectCmd.setAttribute("checked", true);
},
@ -818,6 +822,7 @@ var InspectorUI = {
}
this.closing = true;
this.toolbar.hidden = true;
if (!aKeepStore) {
InspectorStore.deleteStore(this.winID);
@ -897,8 +902,10 @@ var InspectorUI = {
/**
* Stop inspecting webpage, detach page listeners, disable highlighter
* event listeners.
* @param aPreventScroll
* Prevent scroll in the HTML tree?
*/
stopInspecting: function IUI_stopInspecting()
stopInspecting: function IUI_stopInspecting(aPreventScroll)
{
if (!this.inspecting) {
return;
@ -908,7 +915,7 @@ var InspectorUI = {
this.detachPageListeners();
this.inspecting = false;
if (this.highlighter.node) {
this.select(this.highlighter.node, true, true);
this.select(this.highlighter.node, true, true, !aPreventScroll);
} else {
this.select(null, true, true);
}
@ -1048,9 +1055,16 @@ var InspectorUI = {
}
if (node) {
if (hitTwisty)
if (hitTwisty) {
this.ioBox.toggleObject(node);
this.select(node, false, false);
} else {
if (this.inspecting) {
this.stopInspecting(true);
} else {
this.select(node, true, false);
this.highlighter.highlightNode(node);
}
}
}
},
@ -1277,7 +1291,7 @@ var InspectorUI = {
this.tools[id] = aRegObj;
}
let toolbar = document.getElementById("inspector-toolbar");
let toolbox = document.getElementById("inspector-tools");
let btn = document.createElement("toolbarbutton");
btn.setAttribute("id", aRegObj.buttonId);
btn.setAttribute("label", aRegObj.label);
@ -1285,7 +1299,7 @@ var InspectorUI = {
btn.setAttribute("accesskey", aRegObj.accesskey);
btn.setAttribute("class", "toolbarbutton-text");
btn.setAttribute("image", aRegObj.icon || "");
toolbar.appendChild(btn);
toolbox.appendChild(btn);
btn.addEventListener("click",
function IUI_ToolButtonClick(aEvent) {

View File

@ -1372,19 +1372,15 @@
// aReferrerURI is null or undefined if the tab is opened from
// an external application or bookmark, i.e. somewhere other
// than the current tab.
if (aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) {
if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
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;
if (!this.selectedTab.pinned &&
Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent"))
this.moveTabTo(t, newTabPos);
this.moveTabTo(t, newTabPos);
this._lastRelatedTab = t;
}

View File

@ -263,11 +263,10 @@ function GroupItem(listOfEls, options) {
if (options.dontPush) {
this.setZ(drag.zIndex);
drag.zIndex++;
} else
} else {
// Calling snap will also trigger pushAway
this.snap(immediately);
if ($container)
this.setBounds(rectToBe, immediately);
}
if (!options.immediately && listOfEls.length > 0)
$container.hide().fadeIn();
@ -1656,11 +1655,12 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
container.mousedown(function(e) {
let target = e.target;
// only set the last mouse down target if it is a left click, not on the
// close button, not on the new tab button, not on the title bar and its
// element
// close button, not on the expand button, not on the title bar and its
// elements
if (Utils.isLeftClick(e) &&
self.$closeButton[0] != target &&
self.$titlebar[0] != target &&
self.$expander[0] != target &&
!self.$titlebar.contains(target) &&
!self.$appTabTray.contains(target)) {
lastMouseDownTarget = target;

View File

@ -310,9 +310,14 @@ Item.prototype = {
// Parameters:
// immediately - boolean for doing the pushAway without animation
pushAway: function Item_pushAway(immediately) {
var items = Items.getTopLevelItems();
// we need at least two top-level items to push something away
if (items.length < 2)
return;
var buffer = Math.floor(Items.defaultGutter / 2);
var items = Items.getTopLevelItems();
// setup each Item's pushAwayData attribute:
items.forEach(function pushAway_setupPushAwayData(item) {
var data = {};

View File

@ -188,15 +188,6 @@ _BROWSER_FILES = \
browser_gestureSupport.js \
browser_getshortcutoruri.js \
browser_hide_removing.js \
browser_scratchpad_initialization.js \
browser_scratchpad_contexts.js \
browser_scratchpad_tab_switch.js \
browser_scratchpad_execute_print.js \
browser_scratchpad_inspect.js \
browser_scratchpad_files.js \
browser_scratchpad_ui.js \
browser_scratchpad_bug_646070_chrome_context_pref.js \
browser_scratchpad_bug_660560_tab.js \
browser_overflowScroll.js \
browser_locationBarExternalLoad.js \
browser_pageInfo.js \

View File

@ -78,14 +78,5 @@ function test() {
testPosition(7, 8, "blank tab without referrer opens at the end");
testPosition(8, 9, "tab without referrer opens at the end");
gBrowser.selectedTab = tabs[0];
gBrowser.pinTab(gBrowser.selectedTab);
addTab("http://mochi.test:8888/#8", gBrowser.currentURI);
testPosition(9, 10, "tab with referrer should open at the end when the selected tab is pinned");
gBrowser.selectedTab = tabs[9];
gBrowser.removeTab(tabs.pop());
is(gBrowser.selectedTab, tabs[0],
"opening a tab from a pinned tab, selecting it and closing it should go back to the pinned tab");
tabs.forEach(gBrowser.removeTab, gBrowser);
}

View File

@ -52,6 +52,7 @@ function runInspectorTests()
Services.obs.addObserver(finishInspectorTests,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(!InspectorUI.toolbar.hidden, "toolbar is visible");
let iframe = document.getElementById("inspector-tree-iframe");
is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches");
ok(InspectorUI.inspecting, "Inspector is inspecting");
@ -71,6 +72,7 @@ function finishInspectorTests()
ok(!InspectorUI.highlighter, "Highlighter is gone");
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
ok(InspectorUI.toolbar.hidden, "toolbar is hidden");
gBrowser.removeCurrentTab();
finish();

View File

@ -0,0 +1,61 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
let doc;
let node1;
let node2;
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
doc = content.document;
waitForFocus(setupTest, content);
}, true);
content.location = "data:text/html,<div><p></p></div>";
function setupTest() {
node1 = doc.querySelector("div");
node2 = doc.querySelector("p");
Services.obs.addObserver(runTests, INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runTests() {
Services.obs.removeObserver(runTests, INSPECTOR_NOTIFICATIONS.OPENED);
testNode1();
}
function testNode1() {
let box = InspectorUI.ioBox.createObjectBox(node1);
box.click();
executeSoon(function() {
is(InspectorUI.selection, node1, "selection matches node");
is(InspectorUI.highlighter.node, node1, "selection matches node");
testNode2();
});
}
function testNode2() {
let box = InspectorUI.ioBox.createObjectBox(node2);
box.click();
executeSoon(function() {
is(InspectorUI.selection, node2, "selection matches node");
is(InspectorUI.highlighter.node, node2, "selection matches node");
Services.obs.addObserver(finishUp, INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI();
});
}
function finishUp() {
Services.obs.removeObserver(finishUp, INSPECTOR_NOTIFICATIONS.CLOSED);
doc = node1 = node2 = null;
gBrowser.removeCurrentTab();
finish();
}
}

View File

@ -150,6 +150,8 @@ _BROWSER_FILES = \
browser_tabview_bug663421.js \
browser_tabview_bug665502.js \
browser_tabview_bug669694.js \
browser_tabview_bug673196.js \
browser_tabview_bug673729.js \
browser_tabview_click_group.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

View File

@ -3,75 +3,75 @@
function test() {
waitForExplicitFinish();
newWindowWithTabView(onTabViewWindowLoaded);
newWindowWithTabView(onTabViewShown);
}
function onTabViewWindowLoaded(win) {
win.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
ok(win.TabView.isVisible(), "Tab View is visible");
let contentWindow = win.document.getElementById("tab-view").contentWindow;
let [originalTab] = win.gBrowser.visibleTabs;
function onTabViewShown(win) {
registerCleanupFunction(function () win.close());
let contentWindow = win.TabView.getContentWindow();
let currentGroup = contentWindow.GroupItems.getActiveGroupItem();
function checkResized(diffX, diffY, shouldResize, text, callback) {
let {width: origWidth, height: origHeight} = currentGroup.getBounds();
resizeWindow(win, diffX, diffY, function () {
let {width: newWidth, height: newHeight} = currentGroup.getBounds();
let resized = (origWidth != newWidth || origHeight != newHeight);
is(resized, shouldResize, text + ": The group should " +
(shouldResize ? "" : "not ") + "have been resized");
callback();
});
}
function next() {
let test = tests.shift();
if (test)
checkResized.apply(this, test.concat([next]));
else
finishTest();
}
function finishTest() {
// reset the usersize of the group, so this should clear the "cramped" feeling.
currentGroup.setSize(100, 100, true);
currentGroup.setUserSize();
checkResized(400, 400, false, "After clearing the cramp", finish);
}
let tests = [
// diffX, diffY, shouldResize, text
[ -50, -50, false, "A little smaller"],
[ 50, 50, false, "A little bigger"],
[-400, -400, true, "Much smaller"],
[ 400, 400, true, "Bigger after much smaller"],
[-400, -400, true, "Much smaller"]
];
// setup
currentGroup.setSize(600, 600, true);
currentGroup.setUserSize();
let down1 = function down1(resized) {
checkResized(currentGroup, 50, 50, false, "A little bigger", up1, contentWindow, win);
};
let up1 = function up1(resized) {
checkResized(currentGroup, -400, -400, true, "Much smaller", down2, contentWindow, win);
}
let down2 = function down2(resized) {
checkResized(currentGroup, 400, 400, undefined,
"Bigger after much smaller: TODO (bug 625668): the group should be resized!",
up2, contentWindow, win);
};
let up2 = function up2(resized) {
checkResized(currentGroup, -400, -400, undefined,
"Much smaller: TODO (bug 625668): the group should be resized!",
down3, contentWindow, win);
}
let down3 = function down3(resized) {
// reset the usersize of the group, so this should clear the "cramped" feeling.
currentGroup.setSize(100,100,true);
currentGroup.setUserSize();
checkResized(currentGroup, 400, 400, false,
"After clearing the cramp",
up3, contentWindow, win);
};
let up3 = function up3(resized) {
win.close();
finish();
}
// start by making it a little smaller.
checkResized(currentGroup, -50, -50, false, "A little smaller", down1, contentWindow, win);
// run the tests
next();
}
function simulateResizeBy(xDiff, yDiff, win) {
win = win || window;
// ----------
function resizeWindow(win, diffX, diffY, callback) {
let targetWidth = win.outerWidth + diffX;
let targetHeight = win.outerHeight + diffY;
win.resizeBy(xDiff, yDiff);
}
function checkResized(item, xDiff, yDiff, expectResized, note, callback, contentWindow, win) {
let originalBounds = new contentWindow.Rect(item.getBounds());
simulateResizeBy(xDiff, yDiff, win);
let newBounds = item.getBounds();
let resized = !newBounds.equals(originalBounds);
if (expectResized !== undefined)
is(resized, expectResized, note + ": The group should " +
(expectResized ? "" : "not ") + "be resized");
callback(resized);
win.addEventListener("resize", function onResize() {
let {outerWidth: width, outerHeight: height} = win;
if (width != targetWidth || height != targetHeight)
return;
win.removeEventListener("resize", onResize, false);
executeSoon(callback);
}, false);
win.resizeBy(diffX, diffY);
}

View File

@ -0,0 +1,36 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
function onLoad(win) {
registerCleanupFunction(function () win.close());
win.gBrowser.addTab();
}
function onShow(win) {
let cw = win.TabView.getContentWindow();
let group = cw.GroupItems.groupItems[0];
// shrink the group to make some room for dragging
group.setSize(200, 200, true);
waitForFocus(function () {
let target = group.getChild(0).container;
EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
EventUtils.synthesizeMouse(target, 0, 300, {type: "mousemove"}, cw);
EventUtils.synthesizeMouseAtCenter(target, {type: "mouseup"}, cw);
let newGroup = cw.GroupItems.groupItems[1];
let groupBounds = newGroup.getBounds();
let safeWindowBounds = cw.Items.getSafeWindowBounds();
ok(safeWindowBounds.contains(groupBounds),
"new group is within safe window bounds");
finish();
}, cw);
}
waitForExplicitFinish();
newWindowWithTabView(onShow, onLoad);
}

View File

@ -0,0 +1,42 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
newWindowWithTabView(function (win) {
let cw = win.TabView.getContentWindow();
// turn off zoom animations
cw.gPrefBranch.setBoolPref("animate_zoom", false);
registerCleanupFunction(function () {
cw.gPrefBranch.clearUserPref("animate_zoom");
win.close();
});
let group = cw.GroupItems.groupItems[0];
group.setSize(100, 100, true);
while (!group.isStacked())
win.gBrowser.addTab();
waitForFocus(function () {
whenGroupIsExpanded(group, function () {
ok(win.TabView.isVisible(), "tabview is visible");
finish();
});
let expander = group.$expander[0];
EventUtils.synthesizeMouseAtCenter(expander, {}, cw);
}, cw);
});
}
// ----------
function whenGroupIsExpanded(group, callback) {
group.addSubscriber("expanded", function onExpanded() {
group.removeSubscriber("expanded", onExpanded);
executeSoon(callback);
});
}

View File

@ -32,8 +32,6 @@ browser.jar:
* content/browser/content.js (content/content.js)
* content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml)
* content/browser/inspector.html (content/inspector.html)
* content/browser/scratchpad.xul (content/scratchpad.xul)
* content/browser/scratchpad.js (content/scratchpad.js)
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
* content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
* content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)

View File

@ -47,6 +47,7 @@ include $(topsrcdir)/config/config.mk
DIRS = \
webconsole \
scratchpad \
$(NULL)
ifdef ENABLE_TESTS

View File

@ -1,2 +1,4 @@
browser.jar:
content/browser/NetworkPanel.xhtml (webconsole/NetworkPanel.xhtml)
* content/browser/scratchpad.xul (scratchpad/scratchpad.xul)
* content/browser/scratchpad.js (scratchpad/scratchpad.js)

View File

@ -0,0 +1,52 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is HUDService code.
#
# The Initial Developer of the Original Code is Mozilla Corporation.
#
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Rob Campbell <rcampbell@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
DIRS += test
endif
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,58 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is HUD test code.
#
# The Initial Developer of the Original Code is Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Rob Campbell <rcampbell@mozilla.com> (Original Author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/devtools/scratchpad/test
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
browser_scratchpad_initialization.js \
browser_scratchpad_contexts.js \
browser_scratchpad_tab_switch.js \
browser_scratchpad_execute_print.js \
browser_scratchpad_inspect.js \
browser_scratchpad_files.js \
browser_scratchpad_ui.js \
browser_scratchpad_bug_646070_chrome_context_pref.js \
browser_scratchpad_bug_660560_tab.js \
libs:: $(_BROWSER_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

View File

@ -158,6 +158,7 @@ const LEVELS = {
info: SEVERITY_INFO,
log: SEVERITY_LOG,
trace: SEVERITY_LOG,
dir: SEVERITY_LOG
};
// The lowest HTTP response code (inclusive) that is considered an error.
@ -1235,6 +1236,10 @@ function pruneConsoleOutputIfNecessary(aHUDId, aCategory)
}
delete hudRef.cssNodes[desc + location];
}
else if (messageNodes[i].classList.contains("webconsole-msg-inspector")) {
hudRef.pruneConsoleDirNode(messageNodes[i]);
continue;
}
messageNodes[i].parentNode.removeChild(messageNodes[i]);
}
@ -1969,6 +1974,13 @@ HUD_SERVICE.prototype =
clipboardText = clipboardText.trimRight();
break;
case "dir":
body = unwrap(args[0]);
clipboardText = body.toString();
sourceURL = aMessage.filename;
sourceLine = aMessage.lineNumber;
break;
default:
Cu.reportError("Unknown Console API log level: " + level);
return;
@ -1980,7 +1992,8 @@ HUD_SERVICE.prototype =
body,
sourceURL,
sourceLine,
clipboardText);
clipboardText,
level);
// Make the node bring up the property panel, to allow the user to inspect
// the stack trace.
@ -2014,6 +2027,14 @@ HUD_SERVICE.prototype =
}
ConsoleUtils.outputMessageNode(node, aHUDId);
if (level == "dir") {
// Initialize the inspector message node, by setting the PropertyTreeView
// object on the tree view. This has to be done *after* the node is
// shown, because the tree binding must be attached first.
let tree = node.querySelector("tree");
tree.view = node.propertyTreeView;
}
},
/**
@ -3786,6 +3807,24 @@ HeadsUpDisplay.prototype = {
aToolbar.appendChild(clearButton);
},
/**
* Destroy the property inspector message node. This performs the necessary
* cleanup for the tree widget and removes it from the DOM.
*
* @param nsIDOMNode aMessageNode
* The message node that contains the property inspector from a
* console.dir call.
*/
pruneConsoleDirNode: function HUD_pruneConsoleDirNode(aMessageNode)
{
aMessageNode.parentNode.removeChild(aMessageNode);
let tree = aMessageNode.querySelector("tree");
tree.parentNode.removeChild(tree);
aMessageNode.propertyTreeView = null;
tree.view = null;
tree = null;
},
/**
* Create the Web Console UI.
*
@ -4222,6 +4261,25 @@ function JSTermHelper(aJSTerm)
return nodes;
};
/**
* Returns the currently selected object in the highlighter.
*
* @returns nsIDOMNode or null
*/
Object.defineProperty(aJSTerm.sandbox, "$0", {
get: function() {
let mw = HUDService.currentContext();
try {
return mw.InspectorUI.selection;
}
catch (ex) {
aJSTerm.console.error(ex.message);
}
},
enumerable: true,
configurable: false
});
/**
* Clears the output of the JSTerm.
*/
@ -4775,8 +4833,15 @@ JSTerm.prototype = {
let hud = HUDService.getHudReferenceById(this.hudId);
hud.cssNodes = {};
while (hud.outputNode.firstChild) {
hud.outputNode.removeChild(hud.outputNode.firstChild);
let node = hud.outputNode;
while (node.firstChild) {
if (node.firstChild.classList &&
node.firstChild.classList.contains("webconsole-msg-inspector")) {
hud.pruneConsoleDirNode(node.firstChild);
}
else {
hud.outputNode.removeChild(node.firstChild);
}
}
hud.HUDBox.lastTimestamp = 0;
@ -5381,6 +5446,8 @@ ConsoleUtils = {
* The text that should be copied to the clipboard when this node is
* copied. If omitted, defaults to the body text. If `aBody` is not
* a string, then the clipboard text must be supplied.
* @param number aLevel [optional]
* The level of the console API message.
* @return nsIDOMNode
* The message node: a XUL richlistitem ready to be inserted into
* the Web Console output node.
@ -5388,7 +5455,7 @@ ConsoleUtils = {
createMessageNode:
function ConsoleUtils_createMessageNode(aDocument, aCategory, aSeverity,
aBody, aSourceURL, aSourceLine,
aClipboardText) {
aClipboardText, aLevel) {
if (aBody instanceof Ci.nsIDOMNode && aClipboardText == null) {
throw new Error("HUDService.createMessageNode(): DOM node supplied " +
"without any clipboard text");
@ -5416,12 +5483,15 @@ ConsoleUtils = {
bodyNode.setAttribute("flex", "1");
bodyNode.classList.add("webconsole-msg-body");
// Store the body text, since it is needed later for the property tree
// case.
let body = aBody;
// If a string was supplied for the body, turn it into a DOM node and an
// associated clipboard string now.
aClipboardText = aClipboardText ||
(aBody + (aSourceURL ? " @ " + aSourceURL : "") +
(aSourceLine ? ":" + aSourceLine : ""));
aBody = aBody instanceof Ci.nsIDOMNode ?
aBody = aBody instanceof Ci.nsIDOMNode && !(aLevel == "dir") ?
aBody : aDocument.createTextNode(aBody);
bodyNode.appendChild(aBody);
@ -5456,12 +5526,47 @@ ConsoleUtils = {
node.timestamp = timestamp;
ConsoleUtils.setMessageType(node, aCategory, aSeverity);
node.appendChild(timestampNode); // childNode[0]
node.appendChild(iconContainer); // childNode[1]
node.appendChild(bodyNode); // childNode[2]
node.appendChild(repeatContainer); // childNode[3]
node.appendChild(timestampNode);
node.appendChild(iconContainer);
// Display the object tree after the message node.
if (aLevel == "dir") {
// Make the body container, which is a vertical box, for grouping the text
// and tree widgets.
let bodyContainer = aDocument.createElement("vbox");
bodyContainer.setAttribute("flex", "1");
bodyContainer.appendChild(bodyNode);
// Create the tree.
let tree = createElement(aDocument, "tree", {
flex: 1,
hidecolumnpicker: "true"
});
let treecols = aDocument.createElement("treecols");
let treecol = createElement(aDocument, "treecol", {
primary: "true",
flex: 1,
hideheader: "true",
ignoreincolumnpicker: "true"
});
treecols.appendChild(treecol);
tree.appendChild(treecols);
tree.appendChild(aDocument.createElement("treechildren"));
bodyContainer.appendChild(tree);
node.appendChild(bodyContainer);
node.classList.add("webconsole-msg-inspector");
// Create the treeView object.
let treeView = node.propertyTreeView = new PropertyTreeView();
treeView.data = body;
tree.setAttribute("rows", treeView.rowCount);
}
else {
node.appendChild(bodyNode);
}
node.appendChild(repeatContainer);
if (locationNode) {
node.appendChild(locationNode); // childNode[4]
node.appendChild(locationNode);
}
node.setAttribute("id", "console-msg-" + HUDService.sequenceId());
@ -5664,7 +5769,7 @@ ConsoleUtils = {
let lastMessage = aOutput.lastChild;
// childNodes[2] is the description element
if (lastMessage &&
if (lastMessage && !aNode.classList.contains("webconsole-msg-inspector") &&
aNode.childNodes[2].textContent ==
lastMessage.childNodes[2].textContent) {
this.mergeFilteredMessageNode(lastMessage, aNode);
@ -5698,7 +5803,7 @@ ConsoleUtils = {
(aNode.classList.contains("webconsole-msg-console") ||
aNode.classList.contains("webconsole-msg-exception") ||
aNode.classList.contains("webconsole-msg-error"))) {
isRepeated = this.filterRepeatedConsole(aNode, outputNode, aHUDId);
isRepeated = this.filterRepeatedConsole(aNode, outputNode);
}
if (!isRepeated) {

View File

@ -141,6 +141,8 @@ _BROWSER_TEST_FILES = \
browser_webconsole_bug_663443_panel_title.js \
browser_webconsole_bug_660806_history_nav.js \
browser_webconsole_bug_651501_document_body_autocomplete.js \
browser_webconsole_bug_653531_highlighter_console_helper.js \
browser_webconsole_bug_659907_console_dir.js \
head.js \
$(NULL)

View File

@ -0,0 +1,148 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Inspector Highlighter Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Campbell <rcampbell@mozilla.com>
* Mihai Sucan <mihai.sucan@gmail.com>
* Panos Astithas <past@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Tests that the $0 console helper works as intended.
let doc;
let h1;
function createDocument()
{
let div = doc.createElement("div");
let h1 = doc.createElement("h1");
let p1 = doc.createElement("p");
let p2 = doc.createElement("p");
let div2 = doc.createElement("div");
let p3 = doc.createElement("p");
doc.title = "Inspector Tree Selection Test";
h1.textContent = "Inspector Tree Selection Test";
p1.textContent = "This is some example text";
p2.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
"elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
"laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
"dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
"fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
p3.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
"elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
"laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
"dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
"fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
div.appendChild(h1);
div.appendChild(p1);
div.appendChild(p2);
div2.appendChild(p3);
doc.body.appendChild(div);
doc.body.appendChild(div2);
setupHighlighterTests();
}
function setupHighlighterTests()
{
h1 = doc.querySelectorAll("h1")[0];
ok(h1, "we have the header node");
Services.obs.addObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runSelectionTests()
{
Services.obs.removeObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
executeSoon(function() {
Services.obs.addObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
});
}
function performTestComparisons(evt)
{
Services.obs.removeObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.stopInspecting();
ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");
is(InspectorUI.selection, h1, "selection matches node");
HUDService.activateHUDForContext(gBrowser.selectedTab);
let hudId = HUDService.getHudIdByWindow(content);
let hud = HUDService.hudReferences[hudId];
let jsterm = hud.jsterm;
outputNode = hud.outputNode;
jsterm.clearOutput();
jsterm.execute("$0");
findLogEntry("[object HTMLHeadingElement");
jsterm.clearOutput();
let msg = "foo";
jsterm.execute("$0.textContent = '" + msg + "'");
findLogEntry(msg);
is(InspectorUI.selection.textContent, msg, "node successfully updated");
doc = h1 = null;
executeSoon(finishUp);
}
function finishUp() {
InspectorUI.closeInspectorUI();
gBrowser.removeCurrentTab();
finish();
}
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
doc = content.document;
waitForFocus(createDocument, content);
}, true);
content.location = "data:text/html,test for highlighter helper in web console";
}

View File

@ -0,0 +1,45 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that console.dir works as intended.
function test() {
addTab("data:text/html,Web Console test for bug 659907: Expand console " +
"object with a dir method");
browser.addEventListener("load", onLoad, true);
}
function onLoad(aEvent) {
browser.removeEventListener(aEvent.type, arguments.callee, true);
openConsole();
let hudId = HUDService.getHudIdByWindow(content);
let hud = HUDService.hudReferences[hudId];
outputNode = hud.outputNode;
content.console.dir(content.document);
findLogEntry("[object HTMLDocument");
let msg = outputNode.querySelectorAll(".webconsole-msg-inspector");
is(msg.length, 1, "one message node displayed");
let rows = msg[0].propertyTreeView._rows;
let foundQSA = false;
let foundLocation = false;
let foundWrite = false;
for (let i = 0; i < rows.length; i++) {
if (rows[i].display == "querySelectorAll: function querySelectorAll()") {
foundQSA = true;
}
else if (rows[i].display == "location: Object") {
foundLocation = true;
}
else if (rows[i].display == "write: function write()") {
foundWrite = true;
}
}
ok(foundQSA, "found document.querySelectorAll");
ok(foundLocation, "found document.location");
ok(foundWrite, "found document.write");
finishTest();
}

View File

@ -9,7 +9,6 @@
console.exception()
console.assert()
console.clear()
console.dir()
console.dirxml()
console.group()
console.groupCollapsed()

View File

@ -581,18 +581,21 @@ nsHTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
rv = mCurrentContext->SetIsOpaque(GetIsOpaque());
if (NS_FAILED(rv)) {
mCurrentContext = nsnull;
mCurrentContextId.AssignLiteral("");
return rv;
}
rv = mCurrentContext->SetContextOptions(aNewContextOptions);
if (NS_FAILED(rv)) {
mCurrentContext = nsnull;
mCurrentContextId.AssignLiteral("");
return rv;
}
rv = mCurrentContext->SetDimensions(sz.width, sz.height);
if (NS_FAILED(rv)) {
mCurrentContext = nsnull;
mCurrentContextId.AssignLiteral("");
return rv;
}

View File

@ -83,6 +83,10 @@ ConsoleAPI.prototype = {
trace: function CA_trace() {
self.notifyObservers(id, "trace", self.getStackTrace());
},
// Displays an interactive listing of all the properties of an object.
dir: function CA_dir() {
self.notifyObservers(id, "dir", arguments);
},
__exposedProps__: {
log: "r",
info: "r",
@ -90,6 +94,7 @@ ConsoleAPI.prototype = {
error: "r",
debug: "r",
trace: "r",
dir: "r"
}
};
@ -107,6 +112,7 @@ ConsoleAPI.prototype = {
error: genPropDesc('error'),
debug: genPropDesc('debug'),
trace: genPropDesc('trace'),
dir: genPropDesc('dir'),
__noSuchMethod__: { enumerable: true, configurable: true, writable: true,
value: function() {} },
__mozillaConsole__: { value: true }

View File

@ -164,6 +164,9 @@ function observeConsoleTest() {
expect("warn", "arg", "extra arg", 1);
win.console.warn("arg", "extra arg", 1);
expect("dir", win.toString());
win.console.dir(win);
expect("error", "arg");
win.console.error("arg");
}
@ -178,6 +181,7 @@ function consoleAPISanityTest() {
ok(win.console.warn, "console.warn is here");
ok(win.console.error, "console.error is here");
ok(win.console.trace, "console.trace is here");
ok(win.console.dir, "console.dir is here");
}
var ConsoleObserver = {

View File

@ -27,6 +27,7 @@ function doTest() {
"error": "function",
"debug": "function",
"trace": "function",
"dir": "function",
"__noSuchMethod__": "function"
};

View File

@ -1 +1 @@
http://hg.mozilla.org/projects/addon-sdk/archive/55619c4ed726.tar.bz2
http://hg.mozilla.org/projects/addon-sdk/archive/cfcf0515ae75.tar.bz2

View File

@ -18,6 +18,10 @@
.mediaControlsFrame {
direction: ltr;
/* Prevent unwanted style inheritance. See bug 554717. */
list-style-image: none !important;
font: normal normal normal 100%/normal sans-serif !important;
text-decoration: none !important;
}
/* CSS Transitions