зеркало из https://github.com/mozilla/gecko-dev.git
Merge MC -> JM
This commit is contained in:
Коммит
a19a98106f
|
@ -82,7 +82,6 @@ EXPORTS = \
|
|||
nsHyperTextAccessibleWrap.h \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
$(NULL)
|
||||
|
||||
# we want to force the creation of a static lib.
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef _NS_ACCESSIBLE_RELATION_WRAP_H
|
||||
#define _NS_ACCESSIBLE_RELATION_WRAP_H
|
||||
|
||||
#include "nsAccessibleRelation.h"
|
||||
|
||||
typedef class nsAccessibleRelation nsAccessibleRelationWrap;
|
||||
|
||||
#endif
|
||||
|
|
@ -38,10 +38,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsAccessibleWrap.h"
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsDocAccessibleWrap.h"
|
||||
#include "nsIAccessibleValue.h"
|
||||
|
@ -49,8 +51,8 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "prprf.h"
|
||||
#include "nsRoleMap.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsStateMap.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsMaiInterfaceComponent.h"
|
||||
|
@ -941,60 +943,45 @@ refStateSetCB(AtkObject *aAtkObj)
|
|||
AtkRelationSet *
|
||||
refRelationSetCB(AtkObject *aAtkObj)
|
||||
{
|
||||
AtkRelationSet *relation_set = nsnull;
|
||||
relation_set = ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);
|
||||
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
|
||||
if (!accWrap) {
|
||||
return relation_set;
|
||||
}
|
||||
|
||||
AtkRelation* relation;
|
||||
|
||||
PRUint32 relationType[] = {nsIAccessibleRelation::RELATION_LABELLED_BY,
|
||||
nsIAccessibleRelation::RELATION_LABEL_FOR,
|
||||
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
|
||||
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
|
||||
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
|
||||
nsIAccessibleRelation::RELATION_EMBEDS,
|
||||
nsIAccessibleRelation::RELATION_FLOWS_TO,
|
||||
nsIAccessibleRelation::RELATION_FLOWS_FROM,
|
||||
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
|
||||
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
|
||||
};
|
||||
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationType); i++) {
|
||||
relation = atk_relation_set_get_relation_by_type(relation_set, static_cast<AtkRelationType>(relationType[i]));
|
||||
if (relation) {
|
||||
atk_relation_set_remove(relation_set, relation);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibleRelation> geckoRelation;
|
||||
nsresult rv = accWrap->GetRelationByType(relationType[i],
|
||||
getter_AddRefs(geckoRelation));
|
||||
if (NS_SUCCEEDED(rv) && geckoRelation) {
|
||||
PRUint32 targetsCount = 0;
|
||||
geckoRelation->GetTargetsCount(&targetsCount);
|
||||
if (targetsCount) {
|
||||
AtkObject** accessible_array = new AtkObject*[targetsCount];
|
||||
for (PRUint32 index = 0; index < targetsCount; index++) {
|
||||
nsCOMPtr<nsIAccessible> geckoTarget;
|
||||
geckoRelation->GetTarget(index, getter_AddRefs(geckoTarget));
|
||||
accessible_array[index] =
|
||||
nsAccessibleWrap::GetAtkObject(geckoTarget);
|
||||
}
|
||||
|
||||
relation = atk_relation_new(accessible_array, targetsCount,
|
||||
static_cast<AtkRelationType>(relationType[i]));
|
||||
atk_relation_set_add(relation_set, relation);
|
||||
g_object_unref(relation);
|
||||
|
||||
delete [] accessible_array;
|
||||
}
|
||||
}
|
||||
}
|
||||
AtkRelationSet* relation_set =
|
||||
ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);
|
||||
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
|
||||
if (!accWrap)
|
||||
return relation_set;
|
||||
|
||||
PRUint32 relationTypes[] = {
|
||||
nsIAccessibleRelation::RELATION_LABELLED_BY,
|
||||
nsIAccessibleRelation::RELATION_LABEL_FOR,
|
||||
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
|
||||
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
|
||||
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
|
||||
nsIAccessibleRelation::RELATION_EMBEDS,
|
||||
nsIAccessibleRelation::RELATION_FLOWS_TO,
|
||||
nsIAccessibleRelation::RELATION_FLOWS_FROM,
|
||||
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
|
||||
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
|
||||
};
|
||||
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationTypes); i++) {
|
||||
AtkRelationType atkType = static_cast<AtkRelationType>(relationTypes[i]);
|
||||
AtkRelation* atkRelation =
|
||||
atk_relation_set_get_relation_by_type(relation_set, atkType);
|
||||
if (atkRelation)
|
||||
atk_relation_set_remove(relation_set, atkRelation);
|
||||
|
||||
Relation rel(accWrap->RelationByType(relationTypes[i]));
|
||||
nsTArray<AtkObject*> targets;
|
||||
nsAccessible* tempAcc = nsnull;
|
||||
while ((tempAcc = rel.Next()))
|
||||
targets.AppendElement(nsAccessibleWrap::GetAtkObject(tempAcc));
|
||||
|
||||
atkRelation = atk_relation_new(targets.Elements(), targets.Length(), atkType);
|
||||
atk_relation_set_add(relation_set, atkRelation);
|
||||
g_object_unref(atkRelation);
|
||||
}
|
||||
|
||||
return relation_set;
|
||||
}
|
||||
|
||||
// Check if aAtkObj is a valid MaiAtkObject, and return the nsAccessibleWrap
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccIterator
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -62,7 +64,7 @@ AccIterator::~AccIterator()
|
|||
}
|
||||
|
||||
nsAccessible*
|
||||
AccIterator::GetNext()
|
||||
AccIterator::Next()
|
||||
{
|
||||
while (mState) {
|
||||
nsAccessible *child = mState->mParent->GetChildAt(mState->mIndex++);
|
||||
|
@ -255,3 +257,93 @@ XULDescriptionIterator::Next()
|
|||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IDRefsIterator
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IDRefsIterator::IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr) :
|
||||
mCurrIdx(0)
|
||||
{
|
||||
if (!aContent->IsInDoc() ||
|
||||
!aContent->GetAttr(kNameSpaceID_None, aIDRefsAttr, mIDs))
|
||||
return;
|
||||
|
||||
if (aContent->IsInAnonymousSubtree()) {
|
||||
mXBLDocument = do_QueryInterface(aContent->GetOwnerDoc());
|
||||
mBindingParent = do_QueryInterface(aContent->GetBindingParent());
|
||||
} else {
|
||||
mDocument = aContent->GetOwnerDoc();
|
||||
}
|
||||
}
|
||||
|
||||
const nsDependentSubstring
|
||||
IDRefsIterator::NextID()
|
||||
{
|
||||
for (; mCurrIdx < mIDs.Length(); mCurrIdx++) {
|
||||
if (!NS_IsAsciiWhitespace(mIDs[mCurrIdx]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (mCurrIdx >= mIDs.Length())
|
||||
return nsDependentSubstring();
|
||||
|
||||
nsAString::index_type idStartIdx = mCurrIdx;
|
||||
while (++mCurrIdx < mIDs.Length()) {
|
||||
if (NS_IsAsciiWhitespace(mIDs[mCurrIdx]))
|
||||
break;
|
||||
}
|
||||
|
||||
return Substring(mIDs, idStartIdx, mCurrIdx++ - idStartIdx);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
IDRefsIterator::NextElem()
|
||||
{
|
||||
while (true) {
|
||||
const nsDependentSubstring id = NextID();
|
||||
if (id.IsEmpty())
|
||||
break;
|
||||
|
||||
nsIContent* refContent = GetElem(id);
|
||||
if (refContent)
|
||||
return refContent;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
IDRefsIterator::GetElem(const nsDependentSubstring& aID)
|
||||
{
|
||||
if (mXBLDocument) {
|
||||
// If content is anonymous subtree then use "anonid" attribute to get
|
||||
// elements, otherwise search elements in DOM by ID attribute.
|
||||
|
||||
nsCOMPtr<nsIDOMElement> refElm;
|
||||
mXBLDocument->GetAnonymousElementByAttribute(mBindingParent,
|
||||
NS_LITERAL_STRING("anonid"),
|
||||
aID,
|
||||
getter_AddRefs(refElm));
|
||||
nsCOMPtr<nsIContent> refContent = do_QueryInterface(refElm);
|
||||
return refContent;
|
||||
}
|
||||
|
||||
return mDocument->GetElementById(aID);
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
IDRefsIterator::Next()
|
||||
{
|
||||
nsIContent* nextElm = NextElem();
|
||||
return nextElm ? GetAccService()->GetAccessible(nextElm) : nsnull;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
SingleAccIterator::Next()
|
||||
{
|
||||
nsRefPtr<nsAccessible> nextAcc;
|
||||
mAcc.swap(nextAcc);
|
||||
return (nextAcc && !nextAcc->IsDefunct()) ? nextAcc : nsnull;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -38,15 +40,32 @@
|
|||
#ifndef nsAccIterator_h_
|
||||
#define nsAccIterator_h_
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "filters.h"
|
||||
#include "nscore.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
|
||||
/**
|
||||
* AccIterable is a basic interface for iterators over accessibles.
|
||||
*/
|
||||
class AccIterable
|
||||
{
|
||||
public:
|
||||
virtual ~AccIterable() { }
|
||||
virtual nsAccessible* Next() = 0;
|
||||
|
||||
private:
|
||||
friend class Relation;
|
||||
nsAutoPtr<AccIterable> mNextIter;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows to iterate through accessible children or subtree complying with
|
||||
* filter function.
|
||||
*/
|
||||
class AccIterator
|
||||
class AccIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -67,13 +86,13 @@ public:
|
|||
|
||||
AccIterator(nsAccessible* aRoot, filters::FilterFuncPtr aFilterFunc,
|
||||
IterationType aIterationType = eFlatNav);
|
||||
~AccIterator();
|
||||
virtual ~AccIterator();
|
||||
|
||||
/**
|
||||
* Return next accessible complying with filter function. Return the first
|
||||
* accessible for the first time.
|
||||
*/
|
||||
nsAccessible *GetNext();
|
||||
virtual nsAccessible *Next();
|
||||
|
||||
private:
|
||||
AccIterator();
|
||||
|
@ -99,7 +118,7 @@ private:
|
|||
* Allows to traverse through related accessibles that are pointing to the given
|
||||
* dependent accessible by relation attribute.
|
||||
*/
|
||||
class RelatedAccIterator
|
||||
class RelatedAccIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -115,10 +134,12 @@ public:
|
|||
RelatedAccIterator(nsDocAccessible* aDocument, nsIContent* aDependentContent,
|
||||
nsIAtom* aRelAttr);
|
||||
|
||||
virtual ~RelatedAccIterator() { }
|
||||
|
||||
/**
|
||||
* Return next related accessible for the given dependent accessible.
|
||||
*/
|
||||
nsAccessible* Next();
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
RelatedAccIterator();
|
||||
|
@ -136,7 +157,7 @@ private:
|
|||
/**
|
||||
* Used to iterate through HTML labels associated with the given element.
|
||||
*/
|
||||
class HTMLLabelIterator
|
||||
class HTMLLabelIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
enum LabelFilter {
|
||||
|
@ -147,10 +168,12 @@ public:
|
|||
HTMLLabelIterator(nsDocAccessible* aDocument, nsIContent* aElement,
|
||||
LabelFilter aFilter = eAllLabels);
|
||||
|
||||
virtual ~HTMLLabelIterator() { }
|
||||
|
||||
/**
|
||||
* Return next label accessible associated with the given element.
|
||||
*/
|
||||
nsAccessible* Next();
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
HTMLLabelIterator();
|
||||
|
@ -166,15 +189,16 @@ private:
|
|||
/**
|
||||
* Used to iterate through HTML outputs associated with the given element.
|
||||
*/
|
||||
class HTMLOutputIterator
|
||||
class HTMLOutputIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
HTMLOutputIterator(nsDocAccessible* aDocument, nsIContent* aElement);
|
||||
virtual ~HTMLOutputIterator() { }
|
||||
|
||||
/**
|
||||
* Return next output accessible associated with the given element.
|
||||
*/
|
||||
nsAccessible* Next();
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
HTMLOutputIterator();
|
||||
|
@ -188,15 +212,16 @@ private:
|
|||
/**
|
||||
* Used to iterate through XUL labels associated with the given element.
|
||||
*/
|
||||
class XULLabelIterator
|
||||
class XULLabelIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
XULLabelIterator(nsDocAccessible* aDocument, nsIContent* aElement);
|
||||
virtual ~XULLabelIterator() { }
|
||||
|
||||
/**
|
||||
* Return next label accessible associated with the given element.
|
||||
*/
|
||||
nsAccessible* Next();
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
XULLabelIterator();
|
||||
|
@ -210,15 +235,16 @@ private:
|
|||
/**
|
||||
* Used to iterate through XUL descriptions associated with the given element.
|
||||
*/
|
||||
class XULDescriptionIterator
|
||||
class XULDescriptionIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
XULDescriptionIterator(nsDocAccessible* aDocument, nsIContent* aElement);
|
||||
virtual ~XULDescriptionIterator() { }
|
||||
|
||||
/**
|
||||
* Return next description accessible associated with the given element.
|
||||
*/
|
||||
nsAccessible* Next();
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
XULDescriptionIterator();
|
||||
|
@ -228,4 +254,66 @@ private:
|
|||
RelatedAccIterator mRelIter;
|
||||
};
|
||||
|
||||
/**
|
||||
* Used to iterate through IDs, elements or accessibles pointed by IDRefs
|
||||
* attribute. Note, any method used to iterate through IDs, elements, or
|
||||
* accessibles moves iterator to next position.
|
||||
*/
|
||||
class IDRefsIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr);
|
||||
virtual ~IDRefsIterator() { }
|
||||
|
||||
/**
|
||||
* Return next ID.
|
||||
*/
|
||||
const nsDependentSubstring NextID();
|
||||
|
||||
/**
|
||||
* Return next element.
|
||||
*/
|
||||
nsIContent* NextElem();
|
||||
|
||||
/**
|
||||
* Return the element with the given ID.
|
||||
*/
|
||||
nsIContent* GetElem(const nsDependentSubstring& aID);
|
||||
|
||||
// AccIterable
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
IDRefsIterator();
|
||||
IDRefsIterator(const IDRefsIterator&);
|
||||
IDRefsIterator operator = (const IDRefsIterator&);
|
||||
|
||||
nsString mIDs;
|
||||
nsAString::index_type mCurrIdx;
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsCOMPtr<nsIDOMDocumentXBL> mXBLDocument;
|
||||
nsCOMPtr<nsIDOMElement> mBindingParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterator that points to a single accessible returning it on the first call
|
||||
* to Next().
|
||||
*/
|
||||
class SingleAccIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
SingleAccIterator(nsAccessible* aTarget): mAcc(aTarget) { }
|
||||
virtual ~SingleAccIterator() { }
|
||||
|
||||
virtual nsAccessible* Next();
|
||||
|
||||
private:
|
||||
SingleAccIterator();
|
||||
SingleAccIterator(const SingleAccIterator&);
|
||||
SingleAccIterator& operator = (const SingleAccIterator&);
|
||||
|
||||
nsRefPtr<nsAccessible> mAcc;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -63,10 +63,8 @@ CPPSRCS = \
|
|||
nsAccessibilityAtoms.cpp \
|
||||
nsCoreUtils.cpp \
|
||||
nsAccUtils.cpp \
|
||||
nsRelUtils.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessible.cpp \
|
||||
nsAccessibleRelation.cpp \
|
||||
nsAccTreeWalker.cpp \
|
||||
nsBaseWidgetAccessible.cpp \
|
||||
nsEventShell.cpp \
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Trevor Saunders <trev.saunders@gmail.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef RELATION_H_
|
||||
#define RELATION_H_
|
||||
|
||||
#include "AccIterator.h"
|
||||
|
||||
/**
|
||||
* This class is used to return Relation objects from functions. A copy
|
||||
* constructor doesn't work here because we need to mutate the old relation to
|
||||
* have its nsAutoPtr forget what it points to.
|
||||
*/
|
||||
struct RelationCopyHelper
|
||||
{
|
||||
RelationCopyHelper(AccIterable* aFirstIter, AccIterable* aLastIter) :
|
||||
mFirstIter(aFirstIter), mLastIter(aLastIter) { }
|
||||
|
||||
AccIterable* mFirstIter;
|
||||
AccIterable* mLastIter;
|
||||
};
|
||||
|
||||
/**
|
||||
* A collection of relation targets of a certain type. Targets are computed
|
||||
* lazily while enumerating.
|
||||
*/
|
||||
class Relation
|
||||
{
|
||||
public:
|
||||
Relation() : mFirstIter(nsnull), mLastIter(nsnull) { }
|
||||
|
||||
Relation(const RelationCopyHelper aRelation) :
|
||||
mFirstIter(aRelation.mFirstIter), mLastIter(aRelation.mLastIter) { }
|
||||
|
||||
Relation(AccIterable* aIter) : mFirstIter(aIter), mLastIter(aIter) { }
|
||||
|
||||
Relation(nsAccessible* aAcc) :
|
||||
mFirstIter(nsnull), mLastIter(nsnull)
|
||||
{ AppendTarget(aAcc); }
|
||||
|
||||
Relation(nsIContent* aContent) :
|
||||
mFirstIter(nsnull), mLastIter(nsnull)
|
||||
{ AppendTarget(aContent); }
|
||||
|
||||
Relation& operator = (const RelationCopyHelper& aRH)
|
||||
{
|
||||
mFirstIter = aRH.mFirstIter;
|
||||
mLastIter = aRH.mLastIter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Relation& operator = (Relation& aRelation)
|
||||
{
|
||||
mFirstIter = aRelation.mFirstIter;
|
||||
mLastIter = aRelation.mLastIter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator RelationCopyHelper()
|
||||
{
|
||||
return RelationCopyHelper(mFirstIter.forget(), mLastIter);
|
||||
}
|
||||
|
||||
inline void AppendIter(AccIterable* aIter)
|
||||
{
|
||||
if (mLastIter)
|
||||
mLastIter->mNextIter = aIter;
|
||||
else
|
||||
mFirstIter = aIter;
|
||||
|
||||
mLastIter = aIter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the given accessible to the set of related accessibles.
|
||||
*/
|
||||
inline void AppendTarget(nsAccessible* aAcc)
|
||||
{
|
||||
if (aAcc)
|
||||
AppendIter(new SingleAccIterator(aAcc));
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the one accessible for this content node to the set of related
|
||||
* accessibles.
|
||||
*/
|
||||
inline void AppendTarget(nsIContent* aContent)
|
||||
{
|
||||
if (aContent)
|
||||
AppendTarget(GetAccService()->GetAccessible(aContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* compute and return the next related accessible.
|
||||
*/
|
||||
inline nsAccessible* Next()
|
||||
{
|
||||
nsAccessible* target = nsnull;
|
||||
|
||||
// a trick nsAutoPtr deletes what it used to point to when assigned to
|
||||
while (mFirstIter && !(target = mFirstIter->Next()))
|
||||
mFirstIter = mFirstIter->mNextIter;
|
||||
|
||||
if (!mFirstIter)
|
||||
mLastIter = nsnull;
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
private:
|
||||
Relation& operator = (const Relation&);
|
||||
|
||||
nsAutoPtr<AccIterable> mFirstIter;
|
||||
AccIterable* mLastIter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -106,14 +106,14 @@ nsARIAGridAccessible::GetColumnCount(PRInt32 *acolumnCount)
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
nsAccessible* row = rowIter.GetNext();
|
||||
nsAccessible* row = rowIter.Next();
|
||||
if (!row)
|
||||
return NS_OK;
|
||||
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
|
||||
while ((cell = cellIter.GetNext()))
|
||||
while ((cell = cellIter.Next()))
|
||||
(*acolumnCount)++;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -129,7 +129,7 @@ nsARIAGridAccessible::GetRowCount(PRInt32 *arowCount)
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
while (rowIter.GetNext())
|
||||
while (rowIter.Next())
|
||||
(*arowCount)++;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -327,7 +327,7 @@ nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
|||
NS_ENSURE_ARG(IsValidColumn(aColumn));
|
||||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
nsAccessible *row = rowIter.GetNext();
|
||||
nsAccessible *row = rowIter.Next();
|
||||
if (!row)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -340,7 +340,7 @@ nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
|||
if (!nsAccUtils::IsARIASelected(cell))
|
||||
return NS_OK;
|
||||
}
|
||||
} while ((row = rowIter.GetNext()));
|
||||
} while ((row = rowIter.Next()));
|
||||
|
||||
*aIsSelected = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -361,7 +361,7 @@ nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
|||
if (!nsAccUtils::IsARIASelected(row)) {
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
while ((cell = cellIter.GetNext())) {
|
||||
while ((cell = cellIter.Next())) {
|
||||
if (!nsAccUtils::IsARIASelected(cell))
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ nsARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
while ((row = rowIter.GetNext())) {
|
||||
while ((row = rowIter.Next())) {
|
||||
if (nsAccUtils::IsARIASelected(row)) {
|
||||
(*aCount) += colCount;
|
||||
continue;
|
||||
|
@ -420,7 +420,7 @@ nsARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
|
|||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
|
||||
while ((cell = cellIter.GetNext())) {
|
||||
while ((cell = cellIter.Next())) {
|
||||
if (nsAccUtils::IsARIASelected(cell))
|
||||
(*aCount)++;
|
||||
}
|
||||
|
@ -447,14 +447,14 @@ nsARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
while ((row = rowIter.GetNext())) {
|
||||
while ((row = rowIter.Next())) {
|
||||
if (nsAccUtils::IsARIASelected(row)) {
|
||||
(*aCount)++;
|
||||
continue;
|
||||
}
|
||||
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = cellIter.GetNext();
|
||||
nsAccessible *cell = cellIter.Next();
|
||||
if (!cell)
|
||||
continue;
|
||||
|
||||
|
@ -464,7 +464,7 @@ nsARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
|||
isRowSelected = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} while ((cell = cellIter.GetNext()));
|
||||
} while ((cell = cellIter.Next()));
|
||||
|
||||
if (isRowSelected)
|
||||
(*aCount)++;
|
||||
|
@ -490,18 +490,18 @@ nsARIAGridAccessible::GetSelectedCells(nsIArray **aCells)
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
while ((row = rowIter.GetNext())) {
|
||||
while ((row = rowIter.Next())) {
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
|
||||
if (nsAccUtils::IsARIASelected(row)) {
|
||||
while ((cell = cellIter.GetNext()))
|
||||
while ((cell = cellIter.Next()))
|
||||
selCells->AppendElement(static_cast<nsIAccessible *>(cell), PR_FALSE);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
while ((cell = cellIter.GetNext())) {
|
||||
while ((cell = cellIter.Next())) {
|
||||
if (nsAccUtils::IsARIASelected(cell))
|
||||
selCells->AppendElement(static_cast<nsIAccessible *>(cell), PR_FALSE);
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ nsARIAGridAccessible::GetSelectedCellIndices(PRUint32 *aCellsCount,
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
for (PRInt32 rowIdx = 0; (row = rowIter.GetNext()); rowIdx++) {
|
||||
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
||||
if (nsAccUtils::IsARIASelected(row)) {
|
||||
for (PRInt32 colIdx = 0; colIdx < colCount; colIdx++)
|
||||
selCells.AppendElement(rowIdx * colCount + colIdx);
|
||||
|
@ -545,7 +545,7 @@ nsARIAGridAccessible::GetSelectedCellIndices(PRUint32 *aCellsCount,
|
|||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
|
||||
for (PRInt32 colIdx = 0; (cell = cellIter.GetNext()); colIdx++) {
|
||||
for (PRInt32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
|
||||
if (nsAccUtils::IsARIASelected(cell))
|
||||
selCells.AppendElement(rowIdx * colCount + colIdx);
|
||||
}
|
||||
|
@ -594,14 +594,14 @@ nsARIAGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
for (PRInt32 rowIdx = 0; (row = rowIter.GetNext()); rowIdx++) {
|
||||
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
||||
if (nsAccUtils::IsARIASelected(row)) {
|
||||
selRows.AppendElement(rowIdx);
|
||||
continue;
|
||||
}
|
||||
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = cellIter.GetNext();
|
||||
nsAccessible *cell = cellIter.Next();
|
||||
if (!cell)
|
||||
continue;
|
||||
|
||||
|
@ -611,7 +611,7 @@ nsARIAGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
|
|||
isRowSelected = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} while ((cell = cellIter.GetNext()));
|
||||
} while ((cell = cellIter.Next()));
|
||||
|
||||
if (isRowSelected)
|
||||
selRows.AppendElement(rowIdx);
|
||||
|
@ -640,7 +640,7 @@ nsARIAGridAccessible::SelectRow(PRInt32 aRow)
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
for (PRInt32 rowIdx = 0; (row = rowIter.GetNext()); rowIdx++) {
|
||||
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
||||
nsresult rv = SetARIASelected(row, rowIdx == aRow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ nsARIAGridAccessible::SelectColumn(PRInt32 aColumn)
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
while ((row = rowIter.GetNext())) {
|
||||
while ((row = rowIter.Next())) {
|
||||
// Unselect all cells in the row.
|
||||
nsresult rv = SetARIASelected(row, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -698,7 +698,7 @@ nsARIAGridAccessible::UnselectColumn(PRInt32 aColumn)
|
|||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = nsnull;
|
||||
while ((row = rowIter.GetNext())) {
|
||||
while ((row = rowIter.Next())) {
|
||||
nsAccessible *cell = GetCellInRowAt(row, aColumn);
|
||||
if (cell) {
|
||||
nsresult rv = SetARIASelected(cell, PR_FALSE);
|
||||
|
@ -766,8 +766,8 @@ nsARIAGridAccessible::GetRowAt(PRInt32 aRow)
|
|||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
|
||||
nsAccessible *row = rowIter.GetNext();
|
||||
while (rowIdx != 0 && (row = rowIter.GetNext()))
|
||||
nsAccessible *row = rowIter.Next();
|
||||
while (rowIdx != 0 && (row = rowIter.Next()))
|
||||
rowIdx--;
|
||||
|
||||
return row;
|
||||
|
@ -779,8 +779,8 @@ nsARIAGridAccessible::GetCellInRowAt(nsAccessible *aRow, PRInt32 aColumn)
|
|||
PRInt32 colIdx = aColumn;
|
||||
|
||||
AccIterator cellIter(aRow, filters::GetCell);
|
||||
nsAccessible *cell = cellIter.GetNext();
|
||||
while (colIdx != 0 && (cell = cellIter.GetNext()))
|
||||
nsAccessible *cell = cellIter.Next();
|
||||
while (colIdx != 0 && (cell = cellIter.Next()))
|
||||
colIdx--;
|
||||
|
||||
return cell;
|
||||
|
@ -821,7 +821,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
|
|||
AccIterator cellIter(aAccessible, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
|
||||
while ((cell = cellIter.GetNext())) {
|
||||
while ((cell = cellIter.Next())) {
|
||||
rv = SetARIASelected(cell, PR_FALSE, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
|
|||
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
while ((cell = cellIter.GetNext())) {
|
||||
while ((cell = cellIter.Next())) {
|
||||
if (cell != aAccessible) {
|
||||
rv = SetARIASelected(cell, PR_TRUE, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -868,7 +868,7 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
nsAccessible *row = rowIter.GetNext();
|
||||
nsAccessible *row = rowIter.Next();
|
||||
if (!row)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -892,14 +892,14 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
|
|||
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
for (colIdx = 0; (cell = cellIter.GetNext()); colIdx++) {
|
||||
for (colIdx = 0; (cell = cellIter.Next()); colIdx++) {
|
||||
if (isColSelArray.SafeElementAt(colIdx, PR_FALSE) &&
|
||||
!nsAccUtils::IsARIASelected(cell)) {
|
||||
isColSelArray[colIdx] = PR_FALSE;
|
||||
selColCount--;
|
||||
}
|
||||
}
|
||||
} while ((row = rowIter.GetNext()));
|
||||
} while ((row = rowIter.Next()));
|
||||
|
||||
if (!selColCount)
|
||||
return NS_OK;
|
||||
|
|
|
@ -48,10 +48,12 @@
|
|||
#include "nsEventShell.h"
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
|
@ -1528,13 +1530,11 @@ nsAccessible::State()
|
|||
state |= states::SELECTED;
|
||||
} else {
|
||||
// If focus is in a child of the tab panel surely the tab is selected!
|
||||
nsCOMPtr<nsIAccessible> tabPanel = nsRelUtils::
|
||||
GetRelatedAccessible(this, nsIAccessibleRelation::RELATION_LABEL_FOR);
|
||||
|
||||
if (nsAccUtils::Role(tabPanel) == nsIAccessibleRole::ROLE_PROPERTYPAGE) {
|
||||
nsRefPtr<nsAccessible> tabPanelAcc(do_QueryObject(tabPanel));
|
||||
nsINode *tabPanelNode = tabPanelAcc->GetNode();
|
||||
if (nsCoreUtils::IsAncestorOf(tabPanelNode, gLastFocusedNode))
|
||||
Relation rel = RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
|
||||
nsAccessible* relTarget = nsnull;
|
||||
while ((relTarget = rel.Next())) {
|
||||
if (relTarget->Role() == nsIAccessibleRole::ROLE_PROPERTYPAGE &&
|
||||
nsCoreUtils::IsAncestorOf(relTarget->GetNode(), gLastFocusedNode))
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
}
|
||||
|
@ -1830,11 +1830,11 @@ nsAccessible::ARIARoleInternal()
|
|||
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;
|
||||
Relation rel = RelationByType(nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
|
||||
nsAccessible* targetAcc = nsnull;
|
||||
while ((targetAcc = rel.Next()))
|
||||
if (targetAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX)
|
||||
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
|
||||
}
|
||||
|
||||
} else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_OPTION) {
|
||||
|
@ -1998,155 +1998,95 @@ NS_IMETHODIMP nsAccessible::GetAccessibleBelow(nsIAccessible **_retval)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIDOMNode* nsAccessible::GetAtomicRegion()
|
||||
nsIContent*
|
||||
nsAccessible::GetAtomicRegion() const
|
||||
{
|
||||
nsIContent *loopContent = mContent;
|
||||
nsAutoString atomic;
|
||||
while (loopContent && !loopContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_atomic, atomic)) {
|
||||
while (loopContent && !loopContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_atomic, atomic))
|
||||
loopContent = loopContent->GetParent();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> atomicRegion;
|
||||
if (atomic.EqualsLiteral("true")) {
|
||||
atomicRegion = do_QueryInterface(loopContent);
|
||||
}
|
||||
return atomicRegion;
|
||||
return atomic.EqualsLiteral("true") ? loopContent : nsnull;
|
||||
}
|
||||
|
||||
// nsIAccessible getRelationByType()
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
nsAccessible::GetRelationByType(PRUint32 aType,
|
||||
nsIAccessibleRelation** aRelation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
Relation rel = RelationByType(aType);
|
||||
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel));
|
||||
return *aRelation ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Relation
|
||||
nsAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
// Relationships are defined on the same content node that the role would be
|
||||
// defined on.
|
||||
nsresult rv = NS_OK_NO_RELATION_TARGET;
|
||||
switch (aRelationType)
|
||||
{
|
||||
case nsIAccessibleRelation::RELATION_LABEL_FOR:
|
||||
{
|
||||
RelatedAccIterator iter(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_labelledby);
|
||||
switch (aType) {
|
||||
case nsIAccessibleRelation::RELATION_LABEL_FOR: {
|
||||
Relation rel(new RelatedAccIterator(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_labelledby));
|
||||
if (mContent->Tag() == nsAccessibilityAtoms::label)
|
||||
rel.AppendIter(new IDRefsIterator(mContent, mContent->IsHTML() ?
|
||||
nsAccessibilityAtoms::_for :
|
||||
nsAccessibilityAtoms::control));
|
||||
|
||||
nsAccessible* related = nsnull;
|
||||
while ((related = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, related);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (mContent->Tag() == nsAccessibilityAtoms::label) {
|
||||
nsIAtom *IDAttr = mContent->IsHTML() ?
|
||||
nsAccessibilityAtoms::_for : nsAccessibilityAtoms::control;
|
||||
rv = nsRelUtils::
|
||||
AddTargetFromIDRefAttr(aRelationType, aRelation, mContent, IDAttr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
return rel;
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_LABELLED_BY:
|
||||
{
|
||||
rv = nsRelUtils::
|
||||
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||
nsAccessibilityAtoms::aria_labelledby);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccessible* label = nsnull;
|
||||
case nsIAccessibleRelation::RELATION_LABELLED_BY: {
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
nsAccessibilityAtoms::aria_labelledby));
|
||||
if (mContent->IsHTML()) {
|
||||
HTMLLabelIterator iter(GetDocAccessible(), mContent);
|
||||
while ((label = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, label);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
rel.AppendIter(new HTMLLabelIterator(GetDocAccessible(), mContent));
|
||||
} else if (mContent->IsXUL()) {
|
||||
rel.AppendIter(new XULLabelIterator(GetDocAccessible(), mContent));
|
||||
}
|
||||
|
||||
if (mContent->IsXUL()) {
|
||||
XULLabelIterator iter(GetDocAccessible(), mContent);
|
||||
while ((label = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, label);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
return rel;
|
||||
}
|
||||
case nsIAccessibleRelation::RELATION_DESCRIBED_BY: {
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
nsAccessibilityAtoms::aria_describedby));
|
||||
if (mContent->IsXUL())
|
||||
rel.AppendIter(new XULDescriptionIterator(GetDocAccessible(), mContent));
|
||||
|
||||
case nsIAccessibleRelation::RELATION_DESCRIBED_BY:
|
||||
{
|
||||
rv = nsRelUtils::
|
||||
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||
nsAccessibilityAtoms::aria_describedby);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mContent->IsXUL()) {
|
||||
XULDescriptionIterator iter(GetDocAccessible(), mContent);
|
||||
nsAccessible* descr = nsnull;
|
||||
while ((descr = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, descr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
return rel;
|
||||
}
|
||||
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR: {
|
||||
Relation rel(new RelatedAccIterator(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_describedby));
|
||||
|
||||
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR:
|
||||
{
|
||||
RelatedAccIterator iter(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_describedby);
|
||||
|
||||
nsAccessible* related = nsnull;
|
||||
while ((related = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, related);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// This affectively adds an optional control attribute to xul:description,
|
||||
// which only affects accessibility, by allowing the description to be
|
||||
// tied to a control.
|
||||
if (mContent->Tag() == nsAccessibilityAtoms::description &&
|
||||
mContent->IsXUL()) {
|
||||
// This affectively adds an optional control attribute to xul:description,
|
||||
// which only affects accessibility, by allowing the description to be
|
||||
// tied to a control.
|
||||
return nsRelUtils::
|
||||
AddTargetFromIDRefAttr(aRelationType, aRelation, mContent,
|
||||
nsAccessibilityAtoms::control);
|
||||
}
|
||||
mContent->IsXUL())
|
||||
rel.AppendIter(new IDRefsIterator(mContent,
|
||||
nsAccessibilityAtoms::control));
|
||||
|
||||
return rv;
|
||||
return rel;
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF:
|
||||
{
|
||||
RelatedAccIterator iter(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_owns);
|
||||
|
||||
nsAccessible* related = nsnull;
|
||||
while ((related = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, related);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Got relation from aria-owns, don't calculate it from native markup.
|
||||
if (rv != NS_OK_NO_RELATION_TARGET)
|
||||
return NS_OK;
|
||||
|
||||
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: {
|
||||
Relation rel(new RelatedAccIterator(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_owns));
|
||||
|
||||
// This is an ARIA tree or treegrid that doesn't use owns, so we need to
|
||||
// get the parent the hard way.
|
||||
if (mRoleMapEntry &&
|
||||
(mRoleMapEntry->role == nsIAccessibleRole::ROLE_OUTLINEITEM ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_ROW)) {
|
||||
|
||||
AccGroupInfo* groupInfo = GetGroupInfo();
|
||||
if (!groupInfo)
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
return rel;
|
||||
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation,
|
||||
groupInfo->ConceptualParent());
|
||||
rel.AppendTarget(groupInfo->ConceptualParent());
|
||||
}
|
||||
|
||||
// If accessible is in its own Window, or is the root of a document,
|
||||
|
@ -2161,65 +2101,28 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
if (view) {
|
||||
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
|
||||
if (scrollFrame || view->GetWidget() || !frame->GetParent())
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, Parent());
|
||||
rel.AppendTarget(Parent());
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
return rel;
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
|
||||
{
|
||||
RelatedAccIterator iter(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_controls);
|
||||
|
||||
nsAccessible* related = nsnull;
|
||||
while ((related = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, related);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
|
||||
return Relation(new RelatedAccIterator(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_controls));
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR: {
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
nsAccessibilityAtoms::aria_controls));
|
||||
rel.AppendIter(new HTMLOutputIterator(GetDocAccessible(), mContent));
|
||||
return rel;
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
|
||||
{
|
||||
nsresult rv = nsRelUtils::
|
||||
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||
nsAccessibilityAtoms::aria_controls);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
HTMLOutputIterator iter(GetDocAccessible(), mContent);
|
||||
nsAccessible* related = nsnull;
|
||||
while ((related = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, related);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_TO:
|
||||
{
|
||||
return nsRelUtils::
|
||||
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||
nsAccessibilityAtoms::aria_flowto);
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
|
||||
{
|
||||
RelatedAccIterator iter(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_flowto);
|
||||
|
||||
nsAccessible* related = nsnull;
|
||||
while ((related = iter.Next())) {
|
||||
rv = nsRelUtils::AddTarget(aRelationType, aRelation, related);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON:
|
||||
{
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_TO:
|
||||
return Relation(new IDRefsIterator(mContent,
|
||||
nsAccessibilityAtoms::aria_flowto));
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
|
||||
return Relation(new RelatedAccIterator(GetDocAccessible(), mContent,
|
||||
nsAccessibilityAtoms::aria_flowto));
|
||||
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON: {
|
||||
if (mContent->IsHTML()) {
|
||||
// HTML form controls implements nsIFormControl interface.
|
||||
nsCOMPtr<nsIFormControl> control(do_QueryInterface(mContent));
|
||||
|
@ -2228,12 +2131,10 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
if (form) {
|
||||
nsCOMPtr<nsIContent> formContent =
|
||||
do_QueryInterface(form->GetDefaultSubmitElement());
|
||||
return nsRelUtils::AddTargetFromContent(aRelationType, aRelation,
|
||||
formContent);
|
||||
return Relation(formContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// In XUL, use first <button default="true" .../> in the document
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
||||
do_QueryInterface(mContent->GetOwnerDoc());
|
||||
|
@ -2271,40 +2172,32 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
}
|
||||
}
|
||||
nsCOMPtr<nsIContent> relatedContent(do_QueryInterface(buttonEl));
|
||||
return nsRelUtils::AddTargetFromContent(aRelationType, aRelation,
|
||||
relatedContent);
|
||||
return Relation(relatedContent);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
return Relation();
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_MEMBER_OF:
|
||||
{
|
||||
nsCOMPtr<nsIContent> regionContent = do_QueryInterface(GetAtomicRegion());
|
||||
return nsRelUtils::
|
||||
AddTargetFromContent(aRelationType, aRelation, regionContent);
|
||||
}
|
||||
|
||||
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
|
||||
case nsIAccessibleRelation::RELATION_EMBEDS:
|
||||
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
|
||||
case nsIAccessibleRelation::RELATION_POPUP_FOR:
|
||||
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
|
||||
{
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
}
|
||||
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
case nsIAccessibleRelation::RELATION_MEMBER_OF:
|
||||
return Relation(GetAtomicRegion());
|
||||
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
|
||||
case nsIAccessibleRelation::RELATION_EMBEDS:
|
||||
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
|
||||
case nsIAccessibleRelation::RELATION_POPUP_FOR:
|
||||
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
|
||||
default:
|
||||
return Relation();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetRelationsCount(PRUint32 *aCount)
|
||||
nsAccessible::GetRelationsCount(PRUint32* aCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
*aCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIArray> relations;
|
||||
nsresult rv = GetRelations(getter_AddRefs(relations));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -2313,33 +2206,31 @@ nsAccessible::GetRelationsCount(PRUint32 *aCount)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetRelation(PRUint32 aIndex, nsIAccessibleRelation **aRelation)
|
||||
nsAccessible::GetRelation(PRUint32 aIndex, nsIAccessibleRelation** aRelation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIArray> relations;
|
||||
nsresult rv = GetRelations(getter_AddRefs(relations));
|
||||
nsresult rv= GetRelations(getter_AddRefs(relations));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessibleRelation> relation;
|
||||
rv = relations->QueryElementAt(aIndex, NS_GET_IID(nsIAccessibleRelation),
|
||||
getter_AddRefs(relation));
|
||||
|
||||
// nsIArray::QueryElementAt() returns NS_ERROR_ILLEGAL_VALUE on invalid index.
|
||||
if (rv == NS_ERROR_ILLEGAL_VALUE)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_IF_ADDREF(*aRelation = relation);
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIAccessibleRelation> relation = do_QueryElementAt(relations,
|
||||
aIndex, &rv);
|
||||
NS_ADDREF(*aRelation = relation);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetRelations(nsIArray **aRelations)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelations);
|
||||
*aRelations = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIMutableArray> relations = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
NS_ENSURE_TRUE(relations, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -2351,8 +2242,12 @@ nsAccessible::GetRelations(nsIArray **aRelations)
|
|||
nsCOMPtr<nsIAccessibleRelation> relation;
|
||||
nsresult rv = GetRelationByType(relType, getter_AddRefs(relation));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && relation)
|
||||
relations->AppendElement(relation, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv) && relation) {
|
||||
PRUint32 targets = 0;
|
||||
relation->GetTargetsCount(&targets);
|
||||
if (targets)
|
||||
relations->AppendElement(relation, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(*aRelations = relations);
|
||||
|
@ -2974,7 +2869,7 @@ nsAccessible::SelectedItems()
|
|||
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
nsIAccessible* selected = nsnull;
|
||||
while ((selected = iter.GetNext()))
|
||||
while ((selected = iter.Next()))
|
||||
selectedItems->AppendElement(selected, PR_FALSE);
|
||||
|
||||
nsIMutableArray* items = nsnull;
|
||||
|
@ -2988,7 +2883,7 @@ nsAccessible::SelectedItemCount()
|
|||
PRUint32 count = 0;
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
nsAccessible* selected = nsnull;
|
||||
while ((selected = iter.GetNext()))
|
||||
while ((selected = iter.Next()))
|
||||
++count;
|
||||
|
||||
return count;
|
||||
|
@ -3001,7 +2896,7 @@ nsAccessible::GetSelectedItem(PRUint32 aIndex)
|
|||
nsAccessible* selected = nsnull;
|
||||
|
||||
PRUint32 index = 0;
|
||||
while ((selected = iter.GetNext()) && index < aIndex)
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
|
||||
return selected;
|
||||
|
@ -3013,7 +2908,7 @@ nsAccessible::IsItemSelected(PRUint32 aIndex)
|
|||
PRUint32 index = 0;
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
nsAccessible* selected = nsnull;
|
||||
while ((selected = iter.GetNext()) && index < aIndex)
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
|
||||
return selected &&
|
||||
|
@ -3026,7 +2921,7 @@ nsAccessible::AddItemToSelection(PRUint32 aIndex)
|
|||
PRUint32 index = 0;
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
nsAccessible* selected = nsnull;
|
||||
while ((selected = iter.GetNext()) && index < aIndex)
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
|
||||
if (selected)
|
||||
|
@ -3041,7 +2936,7 @@ nsAccessible::RemoveItemFromSelection(PRUint32 aIndex)
|
|||
PRUint32 index = 0;
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
nsAccessible* selected = nsnull;
|
||||
while ((selected = iter.GetNext()) && index < aIndex)
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
|
||||
if (selected)
|
||||
|
@ -3057,7 +2952,7 @@ nsAccessible::SelectAll()
|
|||
nsAccessible* selectable = nsnull;
|
||||
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
while((selectable = iter.GetNext())) {
|
||||
while((selectable = iter.Next())) {
|
||||
success = true;
|
||||
selectable->SetSelected(PR_TRUE);
|
||||
}
|
||||
|
@ -3071,7 +2966,7 @@ nsAccessible::UnselectAll()
|
|||
nsAccessible* selected = nsnull;
|
||||
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
while ((selected = iter.GetNext())) {
|
||||
while ((selected = iter.Next())) {
|
||||
success = true;
|
||||
selected->SetSelected(PR_FALSE);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ class nsAccessible;
|
|||
class nsHyperTextAccessible;
|
||||
class nsHTMLLIAccessible;
|
||||
struct nsRoleMapEntry;
|
||||
class Relation;
|
||||
class nsTextAccessible;
|
||||
|
||||
struct nsRect;
|
||||
|
@ -237,6 +238,11 @@ public:
|
|||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Get the relation of the given type.
|
||||
*/
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Initializing methods
|
||||
|
||||
|
@ -667,7 +673,7 @@ protected:
|
|||
* Get the container node for an atomic region, defined by aria-atomic="true"
|
||||
* @return the container node
|
||||
*/
|
||||
nsIDOMNode* GetAtomicRegion();
|
||||
nsIContent* GetAtomicRegion() const;
|
||||
|
||||
/**
|
||||
* Get numeric value of the given ARIA attribute.
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
@ -170,38 +171,22 @@ nsApplicationAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
nsAccessible*
|
||||
nsApplicationAccessible::FocusedChild()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
return NS_OK;
|
||||
if (gLastFocusedNode) {
|
||||
nsAccessible* focusedChild =
|
||||
GetAccService()->GetAccessible(gLastFocusedNode);
|
||||
if (focusedChild && focusedChild->Parent() == this)
|
||||
return focusedChild;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelationsCount(PRUint32 *aCount)
|
||||
Relation
|
||||
nsApplicationAccessible::RelationByType(PRUint32 aRelationType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
*aCount = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelation(PRUint32 aIndex,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRelations(nsIArray **aRelations)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelations);
|
||||
*aRelations = nsnull;
|
||||
return NS_OK;
|
||||
return Relation();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -93,11 +93,6 @@ public:
|
|||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup);
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
NS_IMETHOD GetRelationsCount(PRUint32 *aRelationsCount);
|
||||
NS_IMETHOD GetRelation(PRUint32 aIndex, nsIAccessibleRelation **aRelation);
|
||||
NS_IMETHOD GetRelations(nsIArray **aRelations);
|
||||
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight);
|
||||
NS_IMETHOD SetSelected(PRBool aIsSelected);
|
||||
|
@ -122,8 +117,11 @@ public:
|
|||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 State();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual Relation RelationByType(PRUint32 aRelType);
|
||||
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* FocusedChild();
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
|
|
|
@ -211,10 +211,10 @@ nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
|
|||
nsDocAccessible* document = GetAccService()->GetDocAccessible(documentNode);
|
||||
|
||||
#ifdef DEBUG_NOTIFICATIONS
|
||||
nsCOMPtr<nsISelection2> sel2(do_QueryInterface(aSelection));
|
||||
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
|
||||
|
||||
PRInt16 type = 0;
|
||||
sel2->GetType(&type);
|
||||
privSel->GetType(&type);
|
||||
|
||||
if (type == nsISelectionController::SELECTION_NORMAL ||
|
||||
type == nsISelectionController::SELECTION_SPELLCHECK) {
|
||||
|
@ -245,10 +245,10 @@ nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
|
|||
void
|
||||
nsCaretAccessible::ProcessSelectionChanged(nsISelection* aSelection)
|
||||
{
|
||||
nsCOMPtr<nsISelection2> sel2(do_QueryInterface(aSelection));
|
||||
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
|
||||
|
||||
PRInt16 type = 0;
|
||||
sel2->GetType(&type);
|
||||
privSel->GetType(&type);
|
||||
|
||||
if (type == nsISelectionController::SELECTION_NORMAL)
|
||||
NormalSelectionChanged(aSelection);
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
#include "nsISelectionListener.h"
|
||||
#include "nsISelection2.h"
|
||||
|
||||
class nsRootAccessible;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsISelection2.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
@ -331,20 +331,18 @@ nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
|
|||
scrollToRange->SetStart(aStartNode, aStartIndex);
|
||||
scrollToRange->SetEnd(aEndNode, aEndIndex);
|
||||
|
||||
nsCOMPtr<nsISelection> selection1;
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_ACCESSIBILITY,
|
||||
getter_AddRefs(selection1));
|
||||
getter_AddRefs(selection));
|
||||
|
||||
nsCOMPtr<nsISelection2> selection(do_QueryInterface(selection1));
|
||||
if (selection) {
|
||||
selection->RemoveAllRanges();
|
||||
selection->AddRange(scrollToRange);
|
||||
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(selection));
|
||||
selection->RemoveAllRanges();
|
||||
selection->AddRange(scrollToRange);
|
||||
|
||||
selection->ScrollIntoView(nsISelectionController::SELECTION_ANCHOR_REGION,
|
||||
PR_TRUE, aVPercent, aHPercent);
|
||||
privSel->ScrollIntoView(nsISelectionController::SELECTION_ANCHOR_REGION,
|
||||
PR_TRUE, aVPercent, aHPercent);
|
||||
|
||||
selection->CollapseToStart();
|
||||
}
|
||||
selection->CollapseToStart();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -830,77 +828,3 @@ nsAccessibleDOMStringList::Contains(const nsAString& aString, PRBool *aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IDRefsIterator
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IDRefsIterator::IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr) :
|
||||
mCurrIdx(0)
|
||||
{
|
||||
if (!aContent->IsInDoc() ||
|
||||
!aContent->GetAttr(kNameSpaceID_None, aIDRefsAttr, mIDs))
|
||||
return;
|
||||
|
||||
if (aContent->IsInAnonymousSubtree()) {
|
||||
mXBLDocument = do_QueryInterface(aContent->GetOwnerDoc());
|
||||
mBindingParent = do_QueryInterface(aContent->GetBindingParent());
|
||||
} else {
|
||||
mDocument = aContent->GetOwnerDoc();
|
||||
}
|
||||
}
|
||||
|
||||
const nsDependentSubstring
|
||||
IDRefsIterator::NextID()
|
||||
{
|
||||
for (; mCurrIdx < mIDs.Length(); mCurrIdx++) {
|
||||
if (!NS_IsAsciiWhitespace(mIDs[mCurrIdx]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (mCurrIdx >= mIDs.Length())
|
||||
return nsDependentSubstring();
|
||||
|
||||
nsAString::index_type idStartIdx = mCurrIdx;
|
||||
while (++mCurrIdx < mIDs.Length()) {
|
||||
if (NS_IsAsciiWhitespace(mIDs[mCurrIdx]))
|
||||
break;
|
||||
}
|
||||
|
||||
return Substring(mIDs, idStartIdx, mCurrIdx++ - idStartIdx);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
IDRefsIterator::NextElem()
|
||||
{
|
||||
while (true) {
|
||||
const nsDependentSubstring id = NextID();
|
||||
if (id.IsEmpty())
|
||||
break;
|
||||
|
||||
nsIContent* refContent = GetElem(id);
|
||||
if (refContent)
|
||||
return refContent;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
IDRefsIterator::GetElem(const nsDependentSubstring& aID)
|
||||
{
|
||||
if (mXBLDocument) {
|
||||
// If content is anonymous subtree then use "anonid" attribute to get
|
||||
// elements, otherwise search elements in DOM by ID attribute.
|
||||
|
||||
nsCOMPtr<nsIDOMElement> refElm;
|
||||
mXBLDocument->GetAnonymousElementByAttribute(mBindingParent,
|
||||
NS_LITERAL_STRING("anonid"),
|
||||
aID,
|
||||
getter_AddRefs(refElm));
|
||||
nsCOMPtr<nsIContent> refContent = do_QueryInterface(refElm);
|
||||
return refContent;
|
||||
}
|
||||
|
||||
return mDocument->GetElementById(aID);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIBoxObject.h"
|
||||
|
@ -401,39 +400,5 @@ private:
|
|||
nsTArray<nsString> mNames;
|
||||
};
|
||||
|
||||
/**
|
||||
* Used to iterate through IDs or elements pointed by IDRefs attribute. Note,
|
||||
* any method used to iterate through IDs or elements moves iterator to next
|
||||
* position.
|
||||
*/
|
||||
class IDRefsIterator
|
||||
{
|
||||
public:
|
||||
IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr);
|
||||
|
||||
/**
|
||||
* Return next ID.
|
||||
*/
|
||||
const nsDependentSubstring NextID();
|
||||
|
||||
/**
|
||||
* Return next element.
|
||||
*/
|
||||
nsIContent* NextElem();
|
||||
|
||||
/**
|
||||
* Return the element with the given ID.
|
||||
*/
|
||||
nsIContent* GetElem(const nsDependentSubstring& aID);
|
||||
|
||||
private:
|
||||
nsString mIDs;
|
||||
nsAString::index_type mCurrIdx;
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsCOMPtr<nsIDOMDocumentXBL> mXBLDocument;
|
||||
nsCOMPtr<nsIDOMElement> mBindingParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "AccIterator.h"
|
||||
#include "States.h"
|
||||
#include "nsAccCache.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.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 ***** */
|
||||
|
||||
#include "nsRelUtils.h"
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsRelUtils::GetRelatedAccessible(nsIAccessible *aAccessible,
|
||||
PRUint32 aRelationType)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibleRelation> relation;
|
||||
nsresult rv = aAccessible->GetRelationByType(aRelationType,
|
||||
getter_AddRefs(relation));
|
||||
if (NS_FAILED(rv) || !relation)
|
||||
return nsnull;
|
||||
|
||||
nsIAccessible *targetAccessible = nsnull;
|
||||
rv = relation->GetTarget(0, &targetAccessible);
|
||||
return targetAccessible;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRelUtils::AddTarget(PRUint32 aRelationType, nsIAccessibleRelation **aRelation,
|
||||
nsIAccessible *aTarget)
|
||||
{
|
||||
if (!aTarget)
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
|
||||
if (*aRelation) {
|
||||
nsRefPtr<nsAccessibleRelation> relation = QueryAccRelation(*aRelation);
|
||||
return relation->AddTarget(aTarget);
|
||||
}
|
||||
|
||||
*aRelation = new nsAccessibleRelationWrap(aRelationType, aTarget);
|
||||
NS_ENSURE_TRUE(*aRelation, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aRelation);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRelUtils::AddTargetFromContent(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIContent *aContent)
|
||||
{
|
||||
if (!aContent)
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
|
||||
nsAccessible* accessible = GetAccService()->GetAccessible(aContent);
|
||||
return AddTarget(aRelationType, aRelation, accessible);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRelUtils::AddTargetFromIDRefAttr(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIContent *aContent, nsIAtom *aAttr,
|
||||
PRBool aMayBeAnon)
|
||||
{
|
||||
nsAutoString id;
|
||||
if (!aContent->GetAttr(kNameSpaceID_None, aAttr, id))
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> document =
|
||||
do_QueryInterface(aContent->GetOwnerDoc());
|
||||
NS_ASSERTION(document, "The given node is not in document!");
|
||||
if (!document)
|
||||
return NS_OK_NO_RELATION_TARGET;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> refElm;
|
||||
if (aMayBeAnon && aContent->GetBindingParent()) {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> documentXBL(do_QueryInterface(document));
|
||||
nsCOMPtr<nsIDOMElement> bindingParent =
|
||||
do_QueryInterface(aContent->GetBindingParent());
|
||||
documentXBL->GetAnonymousElementByAttribute(bindingParent,
|
||||
NS_LITERAL_STRING("id"),
|
||||
id,
|
||||
getter_AddRefs(refElm));
|
||||
}
|
||||
else {
|
||||
document->GetElementById(id, getter_AddRefs(refElm));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> refContent(do_QueryInterface(refElm));
|
||||
return AddTargetFromContent(aRelationType, aRelation, refContent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRelUtils::AddTargetFromIDRefsAttr(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIContent *aContent, nsIAtom *aAttr)
|
||||
{
|
||||
nsresult rv = NS_OK_NO_RELATION_TARGET;
|
||||
|
||||
nsIContent* refElm = nsnull;
|
||||
IDRefsIterator iter(aContent, aAttr);
|
||||
while ((refElm = iter.NextElem())) {
|
||||
rv = AddTargetFromContent(aRelationType, aRelation, refElm);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.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 ***** */
|
||||
|
||||
#ifndef _nsRelUtils_H_
|
||||
#define _nsRelUtils_H_
|
||||
|
||||
#include "nsAccessibleRelationWrap.h"
|
||||
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
// Used by AddTarget...() methods. Returned when can't get target accessible.
|
||||
#define NS_OK_NO_RELATION_TARGET \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x24)
|
||||
|
||||
/**
|
||||
* Utils class designed to work with accessible relations.
|
||||
*/
|
||||
class nsRelUtils
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Return first target of the relation of the given relation type for
|
||||
* the given accessible.
|
||||
*
|
||||
* @param aAccessible [in] the accessible to get an relation
|
||||
* @param aRelationType [in] relation type
|
||||
* @return an accessible
|
||||
*/
|
||||
static already_AddRefed<nsIAccessible>
|
||||
GetRelatedAccessible(nsIAccessible *aAccessible, PRUint32 aRelationType);
|
||||
|
||||
/**
|
||||
* Create the relation if the given relation is null. Add target to it
|
||||
* which is the given accessible.
|
||||
*
|
||||
* @param aRelationType [in] relation type
|
||||
* @param aRelation [in, out] relation object
|
||||
* @param aTarget [in] accessible object
|
||||
*/
|
||||
static nsresult AddTarget(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIAccessible *aTarget);
|
||||
|
||||
/**
|
||||
* Create the relation if the given relation is null and add the target to it
|
||||
* which is the accessible for the given node.
|
||||
*
|
||||
* @param aRelationType [in] relation type
|
||||
* @param aRelation [in, out] relation object
|
||||
* @param aContent [in] accessible node
|
||||
*/
|
||||
static nsresult AddTargetFromContent(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Create the relation if the given relation is null and add the target to it
|
||||
* pointed by IDRef attribute on the given node.
|
||||
*
|
||||
* @param aRelationType [in] relation type
|
||||
* @param aRelation [in, out] relation object
|
||||
* @param aContent [in] node having the given IDRef attribute
|
||||
* @param aAttr [in] IDRef attribute
|
||||
* @param aMayBeAnon [in] true if the target may be anonymous; if so,
|
||||
* we need to look for it under the binding
|
||||
* parent of aContent.
|
||||
*/
|
||||
static nsresult AddTargetFromIDRefAttr(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIContent *aContent, nsIAtom *aAttr,
|
||||
PRBool aMayBeAnon = PR_FALSE);
|
||||
|
||||
/**
|
||||
* Create the relation if the given relation is null and add the targets to it
|
||||
* that are pointed by IDRefs attribute on the given node.
|
||||
*
|
||||
* @param aRelationType [in] relation type
|
||||
* @param aRelation [in, out] relation object
|
||||
* @param aContent [in] node having the given IDRefs attribute
|
||||
* @param aAttr [in] IDRefs attribute
|
||||
*/
|
||||
static nsresult AddTargetFromIDRefsAttr(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation,
|
||||
nsIContent *aContent, nsIAtom *aAttr);
|
||||
|
||||
/**
|
||||
* Query nsAccessibleRelation from the given nsIAccessibleRelation.
|
||||
*/
|
||||
static already_AddRefed<nsAccessibleRelation>
|
||||
QueryAccRelation(nsIAccessibleRelation *aRelation)
|
||||
{
|
||||
nsAccessibleRelation* relation = nsnull;
|
||||
if (aRelation)
|
||||
CallQueryInterface(aRelation, &relation);
|
||||
|
||||
return relation;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -38,15 +38,16 @@
|
|||
#define CreateEvent CreateEventA
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
|
@ -830,27 +831,20 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
|
|||
}
|
||||
|
||||
// nsIAccessible method
|
||||
NS_IMETHODIMP
|
||||
nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsRootAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
|
||||
if (!mDocument || aRelationType != nsIAccessibleRelation::RELATION_EMBEDS) {
|
||||
return nsDocAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||
}
|
||||
if (!mDocument || aType != nsIAccessibleRelation::RELATION_EMBEDS)
|
||||
return nsDocAccessibleWrap::RelationByType(aType);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsCoreUtils::GetDocShellTreeItemFor(mDocument);
|
||||
nsCOMPtr<nsIDocShellTreeItem> contentTreeItem = GetContentDocShell(treeItem);
|
||||
// there may be no content area, so we need a null check
|
||||
if (contentTreeItem) {
|
||||
nsDocAccessible *accDoc = nsAccUtils::GetDocAccessibleFor(contentTreeItem);
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, accDoc);
|
||||
}
|
||||
if (!contentTreeItem)
|
||||
return Relation();
|
||||
|
||||
return NS_OK;
|
||||
return Relation(nsAccUtils::GetDocAccessibleFor(contentTreeItem));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
class Relation;
|
||||
|
||||
#define NS_ROOTACCESSIBLE_IMPL_CID \
|
||||
{ /* eaba2cf0-21b1-4e2b-b711-d3a89dcd5e1a */ \
|
||||
0xeaba2cf0, \
|
||||
|
@ -73,8 +75,6 @@ public:
|
|||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
@ -83,6 +83,7 @@ public:
|
|||
virtual void Shutdown();
|
||||
|
||||
// nsAccessible
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ nsTextAttrsMgr::GetAttributes(nsIPersistentProperties *aAttributes,
|
|||
frame = offsetElm->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
nsTPtrArray<nsITextAttr> textAttrArray(10);
|
||||
nsTArray<nsITextAttr*> textAttrArray(10);
|
||||
|
||||
// "language" text attribute
|
||||
nsLangTextAttr langTextAttr(mHyperTextAcc, hyperTextElm, offsetNode);
|
||||
|
@ -212,7 +212,7 @@ nsTextAttrsMgr::GetAttributes(nsIPersistentProperties *aAttributes,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsTextAttrsMgr::GetRange(const nsTPtrArray<nsITextAttr>& aTextAttrArray,
|
||||
nsTextAttrsMgr::GetRange(const nsTArray<nsITextAttr*>& aTextAttrArray,
|
||||
PRInt32 *aStartHTOffset, PRInt32 *aEndHTOffset)
|
||||
{
|
||||
PRUint32 attrLen = aTextAttrArray.Length();
|
||||
|
|
|
@ -52,7 +52,6 @@ class nsHyperTextAccessible;
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTPtrArray.h"
|
||||
|
||||
class nsITextAttr;
|
||||
|
||||
|
@ -112,7 +111,7 @@ protected:
|
|||
* @param aStartHTOffset [in, out] the start offset
|
||||
* @param aEndHTOffset [in, out] the end offset
|
||||
*/
|
||||
nsresult GetRange(const nsTPtrArray<nsITextAttr>& aTextAttrArray,
|
||||
nsresult GetRange(const nsTArray<nsITextAttr*>& aTextAttrArray,
|
||||
PRInt32 *aStartHTOffset, PRInt32 *aEndHTOffset);
|
||||
|
||||
private:
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "nsTextEquivUtils.h"
|
||||
|
||||
#include "AccIterator.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
|
|
@ -38,12 +38,13 @@
|
|||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMNSHTMLElement.h"
|
||||
|
@ -51,6 +52,7 @@
|
|||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLLegendElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
@ -615,24 +617,17 @@ nsHTMLGroupboxAccessible::GetNameInternal(nsAString& aName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLGroupboxAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsHTMLGroupboxAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetRelationByType(aRelationType,
|
||||
aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_LABELLED_BY) {
|
||||
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
|
||||
// No override for label, so use <legend> for this <fieldset>
|
||||
return nsRelUtils::
|
||||
AddTargetFromContent(aRelationType, aRelation, GetLegend());
|
||||
}
|
||||
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
|
||||
rel.AppendTarget(GetLegend());
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLLegendAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -643,35 +638,18 @@ nsHTMLLegendAccessible::
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsHTMLLegendAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::
|
||||
GetRelationByType(aRelationType, aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
|
||||
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
|
||||
return rel;
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
|
||||
// Look for groupbox parent
|
||||
nsAccessible* groupbox = Parent();
|
||||
nsAccessible* groupbox = Parent();
|
||||
if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING)
|
||||
rel.AppendTarget(groupbox);
|
||||
|
||||
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 =
|
||||
nsRelUtils::GetRelatedAccessible(groupbox,
|
||||
nsIAccessibleRelation::RELATION_LABELLED_BY);
|
||||
|
||||
if (testLabelAccessible == this) {
|
||||
// We're the first child of the parent groupbox, see
|
||||
// nsHTMLGroupboxAccessible::GetRelationByType().
|
||||
return nsRelUtils::
|
||||
AddTarget(aRelationType, aRelation, groupbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
|
|
|
@ -176,13 +176,10 @@ class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
|
|||
public:
|
||||
nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
|
||||
protected:
|
||||
nsIContent* GetLegend();
|
||||
|
@ -197,12 +194,9 @@ class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
|
|||
public:
|
||||
nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,20 +39,21 @@
|
|||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsISelection2.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLTableCellElement.h"
|
||||
#include "nsIDOMHTMLTableElement.h"
|
||||
|
@ -65,6 +66,7 @@
|
|||
#include "nsFrameSelection.h"
|
||||
#include "nsLayoutErrors.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
@ -505,18 +507,14 @@ nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLTableAccessible: nsIAccessible implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsHTMLTableAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType,
|
||||
aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Relation rel = nsAccessibleWrap::RelationByType(aType);
|
||||
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
|
||||
rel.AppendTarget(Caption());
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_LABELLED_BY)
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, Caption());
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1522,19 +1520,14 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
|||
// nsHTMLCaptionAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsHTMLCaptionAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessible::GetRelationByType(aRelationType,
|
||||
aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Relation rel = nsHyperTextAccessible::RelationByType(aType);
|
||||
if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR)
|
||||
rel.AppendTarget(Parent());
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, Parent());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
|
|
|
@ -130,16 +130,13 @@ public:
|
|||
NS_DECL_NSIACCESSIBLETABLE
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID)
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual void Description(nsString& aDescription);
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual Relation RelationByType(PRUint32 aRelationType);
|
||||
|
||||
// TableAccessible
|
||||
inline nsAccessible* Caption() const
|
||||
|
@ -219,11 +216,10 @@ public:
|
|||
nsHyperTextAccessibleWrap(aContent, aShell) { }
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual Relation RelationByType(PRUint32 aRelationType);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,10 +41,11 @@
|
|||
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
@ -198,23 +199,14 @@ nsHTMLOutputAccessible::
|
|||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLOutputAccessible, nsHyperTextAccessible)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOutputAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation** aRelation)
|
||||
Relation
|
||||
nsHTMLOutputAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Relation rel = nsAccessibleWrap::RelationByType(aType);
|
||||
if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY)
|
||||
rel.AppendIter(new IDRefsIterator(mContent, nsAccessibilityAtoms::_for));
|
||||
|
||||
if (rv != NS_OK_NO_RELATION_TARGET)
|
||||
return NS_OK; // XXX bug 381599, avoid performance problems
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_CONTROLLED_BY) {
|
||||
return nsRelUtils::
|
||||
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||
nsAccessibilityAtoms::_for);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
|
|
|
@ -115,13 +115,10 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation** aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsISelection2.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsTextFragment.h"
|
||||
|
@ -1791,8 +1790,7 @@ nsHyperTextAccessible::GetSelections(PRInt16 aType,
|
|||
}
|
||||
|
||||
if (aRanges) {
|
||||
nsCOMPtr<nsISelection2> selection2(do_QueryInterface(domSel));
|
||||
NS_ENSURE_TRUE(selection2, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(domSel));
|
||||
|
||||
nsCOMPtr<nsINode> startNode = GetNode();
|
||||
if (peditor) {
|
||||
|
@ -1804,7 +1802,7 @@ nsHyperTextAccessible::GetSelections(PRInt16 aType,
|
|||
|
||||
PRUint32 childCount = startNode->GetChildCount();
|
||||
nsCOMPtr<nsIDOMNode> startDOMNode(do_QueryInterface(startNode));
|
||||
nsresult rv = selection2->
|
||||
nsresult rv = privSel->
|
||||
GetRangesForIntervalCOMArray(startDOMNode, 0, startDOMNode, childCount,
|
||||
PR_TRUE, aRanges);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -72,7 +72,6 @@ EXPORTS = \
|
|||
nsHyperTextAccessibleWrap.h \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
nsApplicationAccessibleWrap.h \
|
||||
mozDocAccessible.h \
|
||||
mozAccessible.h \
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* ***** 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef _NS_ACCESSIBLE_RELATION_WRAP_H
|
||||
#define _NS_ACCESSIBLE_RELATION_WRAP_H
|
||||
|
||||
#include "nsAccessibleRelation.h"
|
||||
|
||||
typedef class nsAccessibleRelation nsAccessibleRelationWrap;
|
||||
|
||||
#endif
|
||||
|
|
@ -61,7 +61,6 @@ CPPSRCS = \
|
|||
nsHyperTextAccessibleWrap.cpp \
|
||||
nsHTMLImageAccessibleWrap.cpp \
|
||||
nsHTMLTableAccessibleWrap.cpp \
|
||||
nsAccessibleRelationWrap.cpp \
|
||||
nsApplicationAccessibleWrap.cpp \
|
||||
nsWinUtils.cpp \
|
||||
CAccessibleAction.cpp \
|
||||
|
@ -71,6 +70,7 @@ CPPSRCS = \
|
|||
CAccessibleEditableText.cpp \
|
||||
CAccessibleHyperlink.cpp \
|
||||
CAccessibleHypertext.cpp \
|
||||
ia2AccessibleRelation.cpp \
|
||||
CAccessibleTable.cpp \
|
||||
CAccessibleTableCell.cpp \
|
||||
CAccessibleValue.cpp \
|
||||
|
@ -90,7 +90,6 @@ EXPORTS = \
|
|||
nsHyperTextAccessibleWrap.h \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
nsApplicationAccessibleWrap.h \
|
||||
CAccessibleAction.h \
|
||||
CAccessibleImage.h \
|
||||
|
|
|
@ -38,37 +38,31 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessibleRelationWrap.h"
|
||||
#include "ia2AccessibleRelation.h"
|
||||
|
||||
#include "Relation.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsID.h"
|
||||
|
||||
#include "AccessibleRelation_i.c"
|
||||
#include "nsAccessNodeWrap.h"
|
||||
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
nsAccessibleRelationWrap::
|
||||
nsAccessibleRelationWrap(PRUint32 aType, nsIAccessible *aTarget) :
|
||||
nsAccessibleRelation(aType, aTarget)
|
||||
ia2AccessibleRelation::ia2AccessibleRelation(PRUint32 aType, Relation* aRel) :
|
||||
mType(aType), mReferences(0)
|
||||
{
|
||||
}
|
||||
|
||||
// ISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessibleRelationWrap, nsAccessibleRelation,
|
||||
nsIWinAccessNode)
|
||||
|
||||
// nsIWinAccessNode
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibleRelationWrap::QueryNativeInterface(REFIID aIID, void** aInstancePtr)
|
||||
{
|
||||
return QueryInterface(aIID, aInstancePtr);
|
||||
nsAccessible* target = nsnull;
|
||||
while ((target = aRel->Next()))
|
||||
mTargets.AppendElement(target);
|
||||
}
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleRelationWrap::QueryInterface(REFIID iid, void** ppv)
|
||||
ia2AccessibleRelation::QueryInterface(REFIID iid, void** ppv)
|
||||
{
|
||||
if (!ppv)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
if (IID_IAccessibleRelation == iid || IID_IUnknown == iid) {
|
||||
|
@ -80,63 +74,78 @@ nsAccessibleRelationWrap::QueryInterface(REFIID iid, void** ppv)
|
|||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE
|
||||
ia2AccessibleRelation::AddRef()
|
||||
{
|
||||
return mReferences++;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE
|
||||
ia2AccessibleRelation::Release()
|
||||
{
|
||||
mReferences--;
|
||||
ULONG references = mReferences;
|
||||
if (!mReferences)
|
||||
delete this;
|
||||
|
||||
return references;
|
||||
}
|
||||
|
||||
// IAccessibleRelation
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleRelationWrap::get_relationType(BSTR *aRelationType)
|
||||
ia2AccessibleRelation::get_relationType(BSTR *aRelationType)
|
||||
{
|
||||
__try {
|
||||
if (!aRelationType)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aRelationType = NULL;
|
||||
|
||||
PRUint32 type = 0;
|
||||
nsresult rv = GetRelationType(&type);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
switch (type) {
|
||||
case RELATION_CONTROLLED_BY:
|
||||
switch (mType) {
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLED_BY);
|
||||
break;
|
||||
case RELATION_CONTROLLER_FOR:
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLER_FOR);
|
||||
break;
|
||||
case RELATION_DESCRIBED_BY:
|
||||
case nsIAccessibleRelation::RELATION_DESCRIBED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIBED_BY);
|
||||
break;
|
||||
case RELATION_DESCRIPTION_FOR:
|
||||
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIPTION_FOR);
|
||||
break;
|
||||
case RELATION_EMBEDDED_BY:
|
||||
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDDED_BY);
|
||||
break;
|
||||
case RELATION_EMBEDS:
|
||||
case nsIAccessibleRelation::RELATION_EMBEDS:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDS);
|
||||
break;
|
||||
case RELATION_FLOWS_FROM:
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_FROM);
|
||||
break;
|
||||
case RELATION_FLOWS_TO:
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_TO:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_TO);
|
||||
break;
|
||||
case RELATION_LABEL_FOR:
|
||||
case nsIAccessibleRelation::RELATION_LABEL_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_LABEL_FOR);
|
||||
break;
|
||||
case RELATION_LABELLED_BY:
|
||||
case nsIAccessibleRelation::RELATION_LABELLED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_LABELED_BY);
|
||||
break;
|
||||
case RELATION_MEMBER_OF:
|
||||
case nsIAccessibleRelation::RELATION_MEMBER_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_MEMBER_OF);
|
||||
break;
|
||||
case RELATION_NODE_CHILD_OF:
|
||||
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_NODE_CHILD_OF);
|
||||
break;
|
||||
case RELATION_PARENT_WINDOW_OF:
|
||||
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_PARENT_WINDOW_OF);
|
||||
break;
|
||||
case RELATION_POPUP_FOR:
|
||||
case nsIAccessibleRelation::RELATION_POPUP_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_POPUP_FOR);
|
||||
break;
|
||||
case RELATION_SUBWINDOW_OF:
|
||||
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_SUBWINDOW_OF);
|
||||
break;
|
||||
default:
|
||||
|
@ -150,9 +159,12 @@ __try {
|
|||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleRelationWrap::get_localizedRelationType(BSTR *aLocalizedRelationType)
|
||||
ia2AccessibleRelation::get_localizedRelationType(BSTR *aLocalizedRelationType)
|
||||
{
|
||||
__try {
|
||||
if (!aLocalizedRelationType)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aLocalizedRelationType = NULL;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -160,17 +172,26 @@ __try {
|
|||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleRelationWrap::get_nTargets(long *aNTargets)
|
||||
ia2AccessibleRelation::get_nTargets(long *aNTargets)
|
||||
{
|
||||
__try {
|
||||
*aNTargets = 0;
|
||||
if (!aNTargets)
|
||||
return E_INVALIDARG;
|
||||
|
||||
PRUint32 count = 0;
|
||||
nsresult rv = GetTargetsCount(&count);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
*aNTargets = mTargets.Length();
|
||||
return S_OK;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*aNTargets = count;
|
||||
STDMETHODIMP
|
||||
ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown **aTarget)
|
||||
{
|
||||
__try {
|
||||
if (aTargetIndex < 0 || aTargetIndex >= mTargets.Length() || !aTarget)
|
||||
return E_INVALIDARG;
|
||||
|
||||
mTargets[aTargetIndex]->QueryInterface((const nsID&) IID_IUnknown, (void**) aTarget);
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -178,77 +199,22 @@ __try {
|
|||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleRelationWrap::get_target(long aTargetIndex, IUnknown **aTarget)
|
||||
ia2AccessibleRelation::get_targets(long aMaxTargets, IUnknown **aTargets,
|
||||
long *aNTargets)
|
||||
{
|
||||
__try {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsresult rv = GetTarget(aTargetIndex, getter_AddRefs(accessible));
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
if (!aNTargets || !aTargets)
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(accessible));
|
||||
if (!winAccessNode)
|
||||
return E_FAIL;
|
||||
|
||||
void *instancePtr = NULL;
|
||||
rv = winAccessNode->QueryNativeInterface(IID_IUnknown, &instancePtr);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
*aTarget = static_cast<IUnknown*>(instancePtr);
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleRelationWrap::get_targets(long aMaxTargets, IUnknown **aTarget,
|
||||
long *aNTargets)
|
||||
{
|
||||
__try {
|
||||
*aNTargets = 0;
|
||||
PRUint32 maxTargets = mTargets.Length();
|
||||
if (maxTargets > aMaxTargets)
|
||||
maxTargets = aMaxTargets;
|
||||
|
||||
nsCOMPtr<nsIArray> targets;
|
||||
nsresult rv = GetTargets(getter_AddRefs(targets));
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
for (PRUint32 idx = 0; idx < maxTargets; idx++)
|
||||
get_target(idx, aTargets + idx);
|
||||
|
||||
PRUint32 length = 0;
|
||||
rv = targets->GetLength(&length);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (length == 0)
|
||||
return S_FALSE;
|
||||
|
||||
PRUint32 count = length < PRUint32(aMaxTargets) ? length : aMaxTargets;
|
||||
|
||||
PRUint32 index = 0;
|
||||
for (; index < count; index++) {
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode =
|
||||
do_QueryElementAt(targets, index, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
void *instancePtr = NULL;
|
||||
nsresult rv = winAccessNode->QueryNativeInterface(IID_IUnknown,
|
||||
&instancePtr);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
aTarget[index] = static_cast<IUnknown*>(instancePtr);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
for (PRUint32 index2 = 0; index2 < index; index2++) {
|
||||
aTarget[index2]->Release();
|
||||
aTarget[index2] = NULL;
|
||||
}
|
||||
return GetHRESULT(rv);
|
||||
}
|
||||
|
||||
*aNTargets = count;
|
||||
*aNTargets = maxTargets;
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
|
@ -41,27 +41,22 @@
|
|||
#ifndef _NS_ACCESSIBLE_RELATION_WRAP_H
|
||||
#define _NS_ACCESSIBLE_RELATION_WRAP_H
|
||||
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "AccessibleRelation.h"
|
||||
|
||||
#include "nsIWinAccessNode.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsAccessibleRelationWrap: public nsAccessibleRelation,
|
||||
public nsIWinAccessNode,
|
||||
public IAccessibleRelation
|
||||
class ia2AccessibleRelation : public IAccessibleRelation
|
||||
{
|
||||
public:
|
||||
nsAccessibleRelationWrap(PRUint32 aType, nsIAccessible *aTarget);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIWinAccessNode
|
||||
NS_DECL_NSIWINACCESSNODE
|
||||
ia2AccessibleRelation(PRUint32 aType, Relation* aRel);
|
||||
virtual ~ia2AccessibleRelation() { }
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID aIID, void** aOutPtr);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
// IAccessibleRelation
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType(
|
||||
|
@ -82,6 +77,17 @@ public:
|
|||
/* [length_is][size_is][out] */ IUnknown **target,
|
||||
/* [retval][out] */ long *nTargets);
|
||||
|
||||
inline bool HasTargets() const
|
||||
{ return mTargets.Length(); }
|
||||
|
||||
private:
|
||||
ia2AccessibleRelation();
|
||||
ia2AccessibleRelation(const ia2AccessibleRelation&);
|
||||
ia2AccessibleRelation& operator = (const ia2AccessibleRelation&);
|
||||
|
||||
PRUint32 mType;
|
||||
nsTArray<nsRefPtr<nsAccessible> > mTargets;
|
||||
ULONG mReferences;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -41,12 +41,15 @@
|
|||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "ia2AccessibleRelation.h"
|
||||
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIAccessibleWin32Object.h"
|
||||
|
||||
#include "Accessible2_i.c"
|
||||
|
@ -894,13 +897,15 @@ __try {
|
|||
|
||||
pvarEndUpAt->vt = VT_EMPTY;
|
||||
|
||||
if (xpRelation)
|
||||
xpAccessibleResult = nsRelUtils::GetRelatedAccessible(this, xpRelation);
|
||||
if (xpRelation) {
|
||||
Relation rel = RelationByType(xpRelation);
|
||||
xpAccessibleResult = rel.Next();
|
||||
}
|
||||
|
||||
if (xpAccessibleResult) {
|
||||
pvarEndUpAt->pdispVal = NativeAccessible(xpAccessibleResult);
|
||||
pvarEndUpAt->vt = VT_DISPATCH;
|
||||
return NS_OK;
|
||||
return S_OK;
|
||||
}
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
|
@ -1056,12 +1061,21 @@ STDMETHODIMP
|
|||
nsAccessibleWrap::get_nRelations(long *aNRelations)
|
||||
{
|
||||
__try {
|
||||
PRUint32 count = 0;
|
||||
nsresult rv = GetRelationsCount(&count);
|
||||
*aNRelations = count;
|
||||
if (!aNRelations)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return GetHRESULT(rv);
|
||||
*aNRelations = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
|
||||
relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
|
||||
Relation rel = RelationByType(relType);
|
||||
if (rel.Next())
|
||||
(*aNRelations)++;
|
||||
}
|
||||
return S_OK;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -1071,26 +1085,31 @@ nsAccessibleWrap::get_relation(long aRelationIndex,
|
|||
IAccessibleRelation **aRelation)
|
||||
{
|
||||
__try {
|
||||
if (!aRelation)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aRelation = NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessibleRelation> relation;
|
||||
nsresult rv = GetRelation(aRelationIndex, getter_AddRefs(relation));
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(relation));
|
||||
if (!winAccessNode)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
void *instancePtr = NULL;
|
||||
rv = winAccessNode->QueryNativeInterface(IID_IAccessibleRelation,
|
||||
&instancePtr);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
PRUint32 relIdx = 0;
|
||||
for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
|
||||
relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
|
||||
Relation rel = RelationByType(relType);
|
||||
nsRefPtr<ia2AccessibleRelation> ia2Relation =
|
||||
new ia2AccessibleRelation(relType, &rel);
|
||||
if (ia2Relation->HasTargets()) {
|
||||
if (relIdx == aRelationIndex) {
|
||||
ia2Relation.forget(aRelation);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*aRelation = static_cast<IAccessibleRelation*>(instancePtr);
|
||||
return S_OK;
|
||||
relIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -1101,49 +1120,25 @@ nsAccessibleWrap::get_relations(long aMaxRelations,
|
|||
long *aNRelations)
|
||||
{
|
||||
__try {
|
||||
*aRelation = NULL;
|
||||
if (!aRelation || !aNRelations)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aNRelations = 0;
|
||||
|
||||
nsCOMPtr<nsIArray> relations;
|
||||
nsresult rv = GetRelations(getter_AddRefs(relations));
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
PRUint32 length = 0;
|
||||
rv = relations->GetLength(&length);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (length == 0)
|
||||
return S_FALSE;
|
||||
|
||||
PRUint32 count = length < (PRUint32)aMaxRelations ? length : aMaxRelations;
|
||||
|
||||
PRUint32 index = 0;
|
||||
for (; index < count; index++) {
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode =
|
||||
do_QueryElementAt(relations, index, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
void *instancePtr = NULL;
|
||||
nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessibleRelation,
|
||||
&instancePtr);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
aRelation[index] = static_cast<IAccessibleRelation*>(instancePtr);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
for (PRUint32 index2 = 0; index2 < index; index2++) {
|
||||
aRelation[index2]->Release();
|
||||
aRelation[index2] = NULL;
|
||||
for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
|
||||
relType <= nsIAccessibleRelation::RELATION_LAST &&
|
||||
*aNRelations < aMaxRelations; relType++) {
|
||||
Relation rel = RelationByType(relType);
|
||||
nsRefPtr<ia2AccessibleRelation> ia2Rel =
|
||||
new ia2AccessibleRelation(relType, &rel);
|
||||
if (ia2Rel->HasTargets()) {
|
||||
ia2Rel.forget(aRelation + (*aNRelations));
|
||||
(*aNRelations)++;
|
||||
}
|
||||
return GetHRESULT(rv);
|
||||
}
|
||||
|
||||
*aNRelations = count;
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
|
|
@ -66,7 +66,6 @@ EXPORTS = \
|
|||
nsHyperTextAccessibleWrap.h \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
nsApplicationAccessibleWrap.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsIMutableArray.h"
|
||||
#include "nsIXFormsUtilityService.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsINodeList.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ LIBXUL_LIBRARY = 1
|
|||
|
||||
CPPSRCS = \
|
||||
nsAccEvent.cpp \
|
||||
nsAccessibleRelation.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -38,28 +38,30 @@
|
|||
|
||||
#include "nsAccessibleRelation.h"
|
||||
|
||||
#include "Relation.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
nsAccessibleRelation::
|
||||
nsAccessibleRelation(PRUint32 aType, nsIAccessible *aTarget) :
|
||||
nsAccessibleRelation::nsAccessibleRelation(PRUint32 aType,
|
||||
Relation* aRel) :
|
||||
mType(aType)
|
||||
{
|
||||
mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
if (aTarget)
|
||||
mTargets->AppendElement(aTarget, PR_FALSE);
|
||||
nsIAccessible* targetAcc = nsnull;
|
||||
while ((targetAcc = aRel->Next()))
|
||||
mTargets->AppendElement(targetAcc, false);
|
||||
}
|
||||
|
||||
// nsISupports
|
||||
NS_IMPL_ISUPPORTS2(nsAccessibleRelation, nsAccessibleRelation,
|
||||
nsIAccessibleRelation)
|
||||
NS_IMPL_ISUPPORTS1(nsAccessibleRelation, nsIAccessibleRelation)
|
||||
|
||||
// nsIAccessibleRelation
|
||||
NS_IMETHODIMP
|
||||
nsAccessibleRelation::GetRelationType(PRUint32 *aType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aType);
|
||||
|
||||
*aType = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -69,9 +71,6 @@ nsAccessibleRelation::GetTargetsCount(PRUint32 *aCount)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
*aCount = 0;
|
||||
|
||||
NS_ENSURE_TRUE(mTargets, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
return mTargets->GetLength(aCount);
|
||||
}
|
||||
|
||||
|
@ -79,37 +78,16 @@ NS_IMETHODIMP
|
|||
nsAccessibleRelation::GetTarget(PRUint32 aIndex, nsIAccessible **aTarget)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTarget);
|
||||
*aTarget = nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(mTargets, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIAccessible> target = do_QueryElementAt(mTargets, aIndex, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
target.swap(*aTarget);
|
||||
return NS_OK;
|
||||
target.forget(aTarget);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibleRelation::GetTargets(nsIArray **aTargets)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTargets);
|
||||
*aTargets = nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(mTargets, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
NS_ADDREF(*aTargets = mTargets);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsAccessibleRelation
|
||||
nsresult
|
||||
nsAccessibleRelation::AddTarget(nsIAccessible *aTarget)
|
||||
{
|
||||
NS_ENSURE_ARG(aTarget);
|
||||
|
||||
NS_ENSURE_TRUE(mTargets, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
return mTargets->AppendElement(aTarget, PR_FALSE);
|
||||
}
|
|
@ -39,19 +39,12 @@
|
|||
#ifndef _nsAccessibleRelation_H_
|
||||
#define _nsAccessibleRelation_H_
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
#define NS_ACCRELATION_IMPL_CID \
|
||||
{ \
|
||||
0xb20390d0, \
|
||||
0x40d3, \
|
||||
0x4c76, \
|
||||
{ 0xb6, 0x2e, 0xc2, 0x30, 0xc8, 0xea, 0x0c, 0x1e } \
|
||||
}
|
||||
class Relation;
|
||||
|
||||
/**
|
||||
* Class represents an accessible relation.
|
||||
|
@ -59,25 +52,18 @@
|
|||
class nsAccessibleRelation: public nsIAccessibleRelation
|
||||
{
|
||||
public:
|
||||
nsAccessibleRelation(PRUint32 aType, nsIAccessible *aTarget);
|
||||
nsAccessibleRelation(PRUint32 aType, Relation* aRel);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLERELATION
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCRELATION_IMPL_CID)
|
||||
|
||||
/**
|
||||
* Add target for the given key.
|
||||
*
|
||||
* @param aTarget - accessible target for the given relation.
|
||||
*/
|
||||
nsresult AddTarget(nsIAccessible *aTarget);
|
||||
|
||||
private:
|
||||
nsAccessibleRelation();
|
||||
nsAccessibleRelation(const nsAccessibleRelation&);
|
||||
nsAccessibleRelation& operator = (const nsAccessibleRelation&);
|
||||
|
||||
PRUint32 mType;
|
||||
nsCOMPtr<nsIMutableArray> mTargets;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessibleRelation, NS_ACCRELATION_IMPL_CID)
|
||||
|
||||
#endif
|
|
@ -44,12 +44,13 @@
|
|||
#include "nsAccTreeWalker.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsXULMenuAccessible.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
|
@ -417,48 +418,41 @@ nsresult
|
|||
nsXULGroupboxAccessible::GetNameInternal(nsAString& aName)
|
||||
{
|
||||
// XXX: we use the first related accessible only.
|
||||
nsCOMPtr<nsIAccessible> label =
|
||||
nsRelUtils::GetRelatedAccessible(this, nsIAccessibleRelation::RELATION_LABELLED_BY);
|
||||
|
||||
if (label) {
|
||||
nsAccessible* label =
|
||||
RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY).Next();
|
||||
if (label)
|
||||
return label->GetName(aName);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULGroupboxAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsXULGroupboxAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Relation rel = nsAccessibleWrap::RelationByType(aType);
|
||||
if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
|
||||
return rel;
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_LABELLED_BY) {
|
||||
// The label for xul:groupbox is generated from xul:label that is
|
||||
// inside the anonymous content of the xul:caption.
|
||||
// The xul:label has an accessible object but the xul:caption does not
|
||||
PRInt32 childCount = GetChildCount();
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsAccessible *childAcc = GetChildAt(childIdx);
|
||||
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.
|
||||
nsCOMPtr<nsIAccessible> testGroupboxAccessible =
|
||||
nsRelUtils::GetRelatedAccessible(childAcc,
|
||||
nsIAccessibleRelation::RELATION_LABEL_FOR);
|
||||
|
||||
if (testGroupboxAccessible == this) {
|
||||
// The label for xul:groupbox is generated from xul:label that is
|
||||
// inside the anonymous content of the xul:caption.
|
||||
// The xul:label has an accessible object but the xul:caption does not
|
||||
PRInt32 childCount = GetChildCount();
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsAccessible *childAcc = GetChildAt(childIdx);
|
||||
if (childAcc->Role() == nsIAccessibleRole::ROLE_LABEL) {
|
||||
// Ensure that it's our label
|
||||
Relation reverseRel =
|
||||
childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
|
||||
nsAccessible* testGroupbox = nsnull;
|
||||
while ((testGroupbox = reverseRel.Next()))
|
||||
if (testGroupbox == this) {
|
||||
// The <label> points back to this groupbox
|
||||
return nsRelUtils::
|
||||
AddTarget(aRelationType, aRelation, childAcc);
|
||||
rel.AppendTarget(childAcc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -140,13 +140,10 @@ class nsXULGroupboxAccessible : public nsAccessibleWrap
|
|||
public:
|
||||
nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual Relation RelationByType(PRUint32 aRelationType);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
#include "nsXULTabAccessible.h"
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -138,32 +139,28 @@ nsXULTabAccessible::NativeState()
|
|||
}
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHODIMP
|
||||
nsXULTabAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsXULTabAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType,
|
||||
aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aRelationType != nsIAccessibleRelation::RELATION_LABEL_FOR)
|
||||
return NS_OK;
|
||||
Relation rel = nsAccessibleWrap::RelationByType(aType);
|
||||
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
|
||||
return rel;
|
||||
|
||||
// Expose 'LABEL_FOR' relation on tab accessible for tabpanel accessible.
|
||||
nsCOMPtr<nsIDOMXULRelatedElement> tabsElm =
|
||||
do_QueryInterface(mContent->GetParent());
|
||||
if (!tabsElm)
|
||||
return NS_OK;
|
||||
return rel;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode());
|
||||
nsCOMPtr<nsIDOMNode> tabpanelNode;
|
||||
tabsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabpanelNode));
|
||||
if (!tabpanelNode)
|
||||
return NS_OK;
|
||||
return rel;
|
||||
|
||||
nsCOMPtr<nsIContent> tabpanelContent(do_QueryInterface(tabpanelNode));
|
||||
return nsRelUtils::AddTargetFromContent(aRelationType, aRelation,
|
||||
tabpanelContent);
|
||||
rel.AppendTarget(tabpanelContent);
|
||||
return rel;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -244,29 +241,26 @@ nsXULTabpanelAccessible::NativeRole()
|
|||
return nsIAccessibleRole::ROLE_PROPERTYPAGE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTabpanelAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsXULTabpanelAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aRelationType != nsIAccessibleRelation::RELATION_LABELLED_BY)
|
||||
return NS_OK;
|
||||
Relation rel = nsAccessibleWrap::RelationByType(aType);
|
||||
if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
|
||||
return rel;
|
||||
|
||||
// Expose 'LABELLED_BY' relation on tabpanel accessible for tab accessible.
|
||||
nsCOMPtr<nsIDOMXULRelatedElement> tabpanelsElm =
|
||||
do_QueryInterface(mContent->GetParent());
|
||||
if (!tabpanelsElm)
|
||||
return NS_OK;
|
||||
return rel;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode());
|
||||
nsCOMPtr<nsIDOMNode> tabNode;
|
||||
tabpanelsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabNode));
|
||||
if (!tabNode)
|
||||
return NS_OK;
|
||||
return rel;
|
||||
|
||||
nsCOMPtr<nsIContent> tabContent(do_QueryInterface(tabNode));
|
||||
return nsRelUtils::AddTargetFromContent(aRelationType, aRelation,
|
||||
tabContent);
|
||||
rel.AppendTarget(tabContent);
|
||||
return rel;
|
||||
}
|
||||
|
|
|
@ -56,14 +56,13 @@ public:
|
|||
// nsIAccessible
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
@ -118,12 +117,9 @@ class nsXULTabpanelAccessible : public nsAccessibleWrap
|
|||
public:
|
||||
nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,10 +44,11 @@
|
|||
#include "nsAccUtils.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMXULDescriptionElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsString.h"
|
||||
|
@ -88,25 +89,21 @@ nsXULTextAccessible::NativeState()
|
|||
return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTextAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsXULTextAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
nsresult rv =
|
||||
nsHyperTextAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
|
||||
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
|
||||
if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
|
||||
// Caption is the label for groupbox
|
||||
nsIContent *parent = mContent->GetParent();
|
||||
if (parent && parent->Tag() == nsAccessibilityAtoms::caption) {
|
||||
nsAccessible* parent = Parent();
|
||||
if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, parent);
|
||||
rel.AppendTarget(parent);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rel;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,18 +48,14 @@
|
|||
*/
|
||||
class nsXULTextAccessible : public nsHyperTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
nsXULTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual Relation RelationByType(PRUint32 aRelationType);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -42,9 +43,10 @@
|
|||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
|
@ -756,32 +758,26 @@ nsXULTreeItemAccessibleBase::TakeFocus()
|
|||
return nsAccessible::TakeFocus();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeItemAccessibleBase::GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation)
|
||||
Relation
|
||||
nsXULTreeItemAccessibleBase::RelationByType(PRUint32 aType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRelation);
|
||||
*aRelation = nsnull;
|
||||
if (aType != nsIAccessibleRelation::RELATION_NODE_CHILD_OF)
|
||||
return nsAccessible::RelationByType(aType);
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_NODE_CHILD_OF) {
|
||||
Relation rel;
|
||||
PRInt32 parentIndex;
|
||||
if (NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex))) {
|
||||
if (parentIndex == -1)
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, mParent);
|
||||
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex)))
|
||||
return rel;
|
||||
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
|
||||
|
||||
nsAccessible *logicalParent = treeAcc->GetTreeItemAccessible(parentIndex);
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, logicalParent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
if (parentIndex == -1) {
|
||||
rel.AppendTarget(mParent);
|
||||
return rel;
|
||||
}
|
||||
|
||||
return nsAccessible::GetRelationByType(aRelationType, aRelation);
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
|
||||
|
||||
rel.AppendTarget(treeAcc->GetTreeItemAccessible(parentIndex));
|
||||
return rel;
|
||||
}
|
||||
|
||||
PRUint8
|
||||
|
|
|
@ -188,9 +188,6 @@ public:
|
|||
NS_IMETHOD SetSelected(PRBool aSelect);
|
||||
NS_IMETHOD TakeFocus();
|
||||
|
||||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel,
|
||||
PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup);
|
||||
|
@ -206,6 +203,7 @@ public:
|
|||
// nsAccessible
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 IndexInParent() const;
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
virtual nsAccessible* FocusedChild();
|
||||
|
||||
// ActionAccessible
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "States.h"
|
||||
|
||||
#include "nsITreeSelection.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ DIRS = \
|
|||
attributes \
|
||||
editabletext \
|
||||
events \
|
||||
focus \
|
||||
hyperlink \
|
||||
hypertext \
|
||||
name \
|
||||
|
@ -103,7 +104,6 @@ _TEST_FILES =\
|
|||
test_nsIAccessNode_utils.html \
|
||||
test_nsOuterDocAccessible.html \
|
||||
test_role_nsHyperTextAcc.html \
|
||||
test_takeFocus.html \
|
||||
test_text_caret.html \
|
||||
test_textboxes.html \
|
||||
test_textboxes.xul \
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# ***** 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 mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Alexander Surkov <surkov.alexander@gmail.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 = accessible/focus
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES =\
|
||||
test_focusedChild.html \
|
||||
test_takeFocus.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
|
|
@ -0,0 +1,85 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>nsIAccessible::focusedChild testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function openWnd()
|
||||
{
|
||||
this.eventSeq = [ new invokerChecker(EVENT_FOCUS,
|
||||
getDialogAccessible,
|
||||
this) ];
|
||||
|
||||
this.invoke = function openWnd_invoke()
|
||||
{
|
||||
this.dialog = window.openDialog("about:mozilla",
|
||||
"AboutMozilla",
|
||||
"chrome,width=600,height=600");
|
||||
}
|
||||
|
||||
this.finalCheck = function openWnd_finalCheck()
|
||||
{
|
||||
var app = getApplicationAccessible();
|
||||
is(app.focusedChild, getDialogAccessible(this),
|
||||
"Wrong focused child");
|
||||
|
||||
this.dialog.close();
|
||||
}
|
||||
|
||||
this.getID = function openWnd_getID()
|
||||
{
|
||||
return "focusedChild for application accessible";
|
||||
}
|
||||
|
||||
function getDialogAccessible(aInvoker)
|
||||
{
|
||||
return getAccessible(aInvoker.dialog.document);
|
||||
}
|
||||
}
|
||||
|
||||
//gA11yEventDumpToConsole = true;
|
||||
var gQueue = null;
|
||||
|
||||
function doTest()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new openWnd());
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=677467"
|
||||
title="focusedChild crashes on application accessible">
|
||||
Mozilla Bug 677467
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -10,12 +10,13 @@
|
|||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="common.js"></script>
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="states.js"></script>
|
||||
src="../states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="events.js"></script>
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
////////////////////////////////////////////////////////////////////////////
|
|
@ -74,7 +74,7 @@
|
|||
};
|
||||
registerA11yEventListener(EVENT_REORDER, handler);
|
||||
|
||||
tabBrowser.loadTabs(["about:", "about:mozilla"], false, true);
|
||||
tabBrowser.loadTabs(docURIs, false, true);
|
||||
}
|
||||
|
||||
function testRelations()
|
||||
|
|
|
@ -156,10 +156,6 @@ endif
|
|||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),photon)
|
||||
LIBS += -lphexlib
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
#
|
||||
# Control the default heap size.
|
||||
|
|
|
@ -486,7 +486,13 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// ----------
|
||||
// Function: getContentBounds
|
||||
// Returns a <Rect> for the groupItem's content area (which doesn't include the title, etc).
|
||||
getContentBounds: function GroupItem_getContentBounds() {
|
||||
//
|
||||
// Parameters:
|
||||
// options - an object with additional parameters, see below
|
||||
//
|
||||
// Possible options:
|
||||
// forceStacked - true to force content bounds for stacked mode
|
||||
getContentBounds: function GroupItem_getContentBounds(options) {
|
||||
var box = this.getBounds();
|
||||
var titleHeight = this.$titlebar.height();
|
||||
box.top += titleHeight;
|
||||
|
@ -502,10 +508,14 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
box.left += appTabTrayWidth;
|
||||
}
|
||||
|
||||
// Make the computed bounds' "padding" and new tab button margin actually be
|
||||
// Make the computed bounds' "padding" and expand button margin actually be
|
||||
// themeable --OR-- compute this from actual bounds. Bug 586546
|
||||
box.inset(6, 6);
|
||||
box.height -= 33; // For new tab button
|
||||
|
||||
// make some room for the expand button if we're stacked
|
||||
let isStacked = (options && options.forceStacked) || this.isStacked();
|
||||
if (isStacked)
|
||||
box.height -= 33; // 33px room for the expand button
|
||||
|
||||
return box;
|
||||
},
|
||||
|
@ -1355,10 +1365,11 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
}
|
||||
|
||||
let shouldStack = this.shouldStack(childrenToArrange.length + (options.addTab ? 1 : 0));
|
||||
let box = this.getContentBounds();
|
||||
let shouldStackArrange = (shouldStack && !this.expanded);
|
||||
let box = this.getContentBounds({forceStacked: shouldStackArrange});
|
||||
|
||||
// if we should stack and we're not expanded
|
||||
if (shouldStack && !this.expanded) {
|
||||
if (shouldStackArrange) {
|
||||
this.showExpandControl();
|
||||
this._stackArrange(childrenToArrange, box, options);
|
||||
return false;
|
||||
|
|
|
@ -26,6 +26,7 @@ Browser context menu subtest.
|
|||
<menu id="myMenu" type="context">
|
||||
<menuitem label="Plain item" onclick="document.getElementById('test-pagemenu').removeAttribute('hopeless');"></menuitem>
|
||||
<menuitem label="Disabled item" disabled></menuitem>
|
||||
<menuitem> Item w/ textContent</menuitem>
|
||||
<menu>
|
||||
<menuitem type="checkbox" label="Checkbox" checked></menuitem>
|
||||
</menu>
|
||||
|
|
|
@ -10,7 +10,7 @@ function test() {
|
|||
registerCleanupFunction(function() {
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
hideTabView(function() {});
|
||||
hideTabView();
|
||||
});
|
||||
gBrowser.loadOneTab("about:blank", { inBackground: true });
|
||||
showTabView(setup);
|
||||
|
@ -20,7 +20,7 @@ function setup() {
|
|||
registerCleanupFunction(function() {
|
||||
let groupItem = contentWindow.GroupItems.groupItem(groupItemTwoId);
|
||||
if (groupItem)
|
||||
closeGroupItem(groupItem, function() {});
|
||||
closeGroupItem(groupItem);
|
||||
});
|
||||
|
||||
let contentWindow = TabView.getContentWindow();
|
||||
|
|
|
@ -15,7 +15,7 @@ function test() {
|
|||
registerCleanupFunction(function() {
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
hideTabView(function() {});
|
||||
hideTabView();
|
||||
});
|
||||
|
||||
showTabView(function() {
|
||||
|
@ -24,7 +24,7 @@ function test() {
|
|||
registerCleanupFunction(function() {
|
||||
let groupItem = contentWindow.GroupItems.groupItem(groupItemTwoId);
|
||||
if (groupItem)
|
||||
closeGroupItem(groupItem, function() {});
|
||||
closeGroupItem(groupItem);
|
||||
});
|
||||
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
|
|
|
@ -10,7 +10,7 @@ function test() {
|
|||
registerCleanupFunction(function() {
|
||||
if (gBrowser.tabs.length > 1)
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
hideTabView(function() {});
|
||||
hideTabView();
|
||||
});
|
||||
|
||||
showTabView(function() {
|
||||
|
|
|
@ -128,15 +128,19 @@ function test() {
|
|||
groupItem.setSize(250, 250, true);
|
||||
groupItem.setUserSize();
|
||||
|
||||
let originalBounds = groupItem.getChild(0).getBounds();
|
||||
ok(!groupItem.isStacked(), 'testRemoveWhileStacked: group is not stacked');
|
||||
|
||||
let originalBounds;
|
||||
let tabItem = groupItem.getChild(0);
|
||||
|
||||
// add new tabs to let the group stack
|
||||
while (!groupItem.isStacked())
|
||||
win.gBrowser.loadOneTab('about:blank', {inBackground: true});
|
||||
while (!groupItem.isStacked()) {
|
||||
originalBounds = tabItem.getBounds();
|
||||
win.gBrowser.addTab();
|
||||
}
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
groupItem.getChild(0).close();
|
||||
tabItem.close();
|
||||
ok(!groupItem.isStacked(), 'testRemoveWhileStacked: group is not stacked');
|
||||
|
||||
let bounds = groupItem.getChild(0).getBounds();
|
||||
|
|
|
@ -153,19 +153,3 @@ function enterAndLeavePrivateBrowsing(callback) {
|
|||
togglePrivateBrowsing(callback);
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
function togglePrivateBrowsing(callback) {
|
||||
let topic = "private-browsing-transition-complete";
|
||||
|
||||
function pbObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != topic)
|
||||
return;
|
||||
|
||||
Services.obs.removeObserver(pbObserver, topic, false);
|
||||
afterAllTabsLoaded(callback);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(pbObserver, topic, false);
|
||||
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
|
||||
}
|
||||
|
|
|
@ -63,8 +63,7 @@ function test() {
|
|||
let prefix = 'enter';
|
||||
ok(!pb.privateBrowsingEnabled, prefix + ': private browsing is disabled');
|
||||
registerCleanupFunction(function () {
|
||||
if (pb.privateBrowsingEnabled)
|
||||
pb.privateBrowsingEnabled = false
|
||||
pb.privateBrowsingEnabled = false;
|
||||
});
|
||||
|
||||
togglePrivateBrowsing(function () {
|
||||
|
@ -129,19 +128,3 @@ function test() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
function togglePrivateBrowsing(callback) {
|
||||
let topic = 'private-browsing-transition-complete';
|
||||
|
||||
function pbObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != topic)
|
||||
return;
|
||||
|
||||
Services.obs.removeObserver(pbObserver, topic);
|
||||
afterAllTabsLoaded(callback);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(pbObserver, topic, false);
|
||||
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ function test() {
|
|||
HttpRequestObserver.unregister();
|
||||
if (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
hideTabView(function () {});
|
||||
hideTabView();
|
||||
|
||||
contentWindow.ThumbnailStorage.enablePersistentHttpsCaching =
|
||||
enablePersistentHttpsCaching;
|
||||
|
|
|
@ -29,11 +29,11 @@ function test() {
|
|||
|
||||
registerCleanupFunction(function () {
|
||||
hideMoveToGroupPopup();
|
||||
hideTabView(function () {});
|
||||
hideTabView();
|
||||
|
||||
let groupItems = TabView.getContentWindow().GroupItems.groupItems;
|
||||
if (groupItems.length > 1)
|
||||
closeGroupItem(groupItems[0], function () {});
|
||||
closeGroupItem(groupItems[0]);
|
||||
});
|
||||
|
||||
showTabView(function () {
|
||||
|
|
|
@ -8,7 +8,7 @@ function test() {
|
|||
waitForExplicitFinish();
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
hideTabView(function () {});
|
||||
hideTabView();
|
||||
});
|
||||
|
||||
showTabView(function() {
|
||||
|
|
|
@ -12,8 +12,8 @@ function test() {
|
|||
contentWindow.gPrefBranch.clearUserPref("animate_zoom");
|
||||
let createdGroupItem = contentWindow.GroupItems.groupItem(groupItemId)
|
||||
if (createdGroupItem)
|
||||
closeGroupItem(createdGroupItem, function() {});
|
||||
hideTabView(function() {});
|
||||
closeGroupItem(createdGroupItem);
|
||||
hideTabView();
|
||||
});
|
||||
|
||||
showTabView(function() {
|
||||
|
|
|
@ -65,13 +65,13 @@ function onTabViewLoadedAndShown() {
|
|||
verifyNormal();
|
||||
|
||||
// go into private browsing and make sure Tab View becomes hidden
|
||||
togglePBAndThen(function() {
|
||||
togglePrivateBrowsing(function() {
|
||||
whenTabViewIsHidden(function() {
|
||||
ok(!TabView.isVisible(), "Tab View is no longer visible");
|
||||
verifyPB();
|
||||
|
||||
// exit private browsing and make sure Tab View is shown again
|
||||
togglePBAndThen(function() {
|
||||
togglePrivateBrowsing(function() {
|
||||
whenTabViewIsShown(function() {
|
||||
ok(TabView.isVisible(), "Tab View is visible again");
|
||||
verifyNormal();
|
||||
|
@ -89,12 +89,12 @@ function onTabViewHidden() {
|
|||
ok(!TabView.isVisible(), "Tab View is not visible");
|
||||
|
||||
// go into private browsing and make sure Tab View remains hidden
|
||||
togglePBAndThen(function() {
|
||||
togglePrivateBrowsing(function() {
|
||||
ok(!TabView.isVisible(), "Tab View is still not visible");
|
||||
verifyPB();
|
||||
|
||||
// turn private browsing back off
|
||||
togglePBAndThen(function() {
|
||||
togglePrivateBrowsing(function() {
|
||||
verifyNormal();
|
||||
|
||||
// end game
|
||||
|
@ -153,17 +153,3 @@ function verifyNormal() {
|
|||
prefix + "tab " + a + " is in group " + a);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------
|
||||
function togglePBAndThen(callback) {
|
||||
function pbObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != "private-browsing-transition-complete")
|
||||
return;
|
||||
|
||||
Services.obs.removeObserver(pbObserver, "private-browsing-transition-complete");
|
||||
afterAllTabsLoaded(callback);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(pbObserver, "private-browsing-transition-complete", false);
|
||||
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ function test() {
|
|||
registerCleanupFunction(function() {
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
hideTabView(function() {});
|
||||
hideTabView();
|
||||
});
|
||||
showTabView(onTabViewWindowLoaded);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ function onTabViewWindowLoaded() {
|
|||
registerCleanupFunction(function() {
|
||||
let groupItem = contentWindow.GroupItems.groupItem(groupItemId);
|
||||
if (groupItem)
|
||||
closeGroupItem(groupItem, function() {});
|
||||
closeGroupItem(groupItem);
|
||||
});
|
||||
|
||||
// create a group item
|
||||
|
|
|
@ -48,11 +48,12 @@ function createGroupItemWithBlankTabs(win, width, height, padding, numNewTabs, a
|
|||
|
||||
// ----------
|
||||
function closeGroupItem(groupItem, callback) {
|
||||
groupItem.addSubscriber("close", function onClose() {
|
||||
groupItem.removeSubscriber("close", onClose);
|
||||
if ("function" == typeof callback)
|
||||
if (callback) {
|
||||
groupItem.addSubscriber("close", function onClose() {
|
||||
groupItem.removeSubscriber("close", onClose);
|
||||
executeSoon(callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (groupItem.getChildren().length) {
|
||||
groupItem.addSubscriber("groupHidden", function onHide() {
|
||||
|
@ -140,9 +141,10 @@ function showTabView(callback, win) {
|
|||
return;
|
||||
}
|
||||
|
||||
whenTabViewIsShown(function() {
|
||||
whenTabViewIsShown(function () {
|
||||
waitForFocus(callback, win);
|
||||
}, win);
|
||||
|
||||
win.TabView.show();
|
||||
}
|
||||
|
||||
|
@ -151,11 +153,14 @@ function hideTabView(callback, win) {
|
|||
win = win || window;
|
||||
|
||||
if (!win.TabView.isVisible()) {
|
||||
callback();
|
||||
if (callback)
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
whenTabViewIsHidden(callback, win);
|
||||
if (callback)
|
||||
whenTabViewIsHidden(callback, win);
|
||||
|
||||
win.TabView.hide();
|
||||
}
|
||||
|
||||
|
@ -189,31 +194,20 @@ function whenTabViewIsShown(callback, win) {
|
|||
}, false);
|
||||
}
|
||||
|
||||
// ----------
|
||||
function showSearch(callback, win) {
|
||||
win = win || window;
|
||||
|
||||
let contentWindow = win.TabView.getContentWindow();
|
||||
if (contentWindow.isSearchEnabled()) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
whenSearchIsEnabled(callback, win);
|
||||
contentWindow.performSearch();
|
||||
}
|
||||
|
||||
// ----------
|
||||
function hideSearch(callback, win) {
|
||||
win = win || window;
|
||||
|
||||
let contentWindow = win.TabView.getContentWindow();
|
||||
if (!contentWindow.isSearchEnabled()) {
|
||||
callback();
|
||||
if (callback)
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
whenSearchIsDisabled(callback, win);
|
||||
if (callback)
|
||||
whenSearchIsDisabled(callback, win);
|
||||
|
||||
contentWindow.hideSearch();
|
||||
}
|
||||
|
||||
|
@ -253,28 +247,36 @@ function whenSearchIsDisabled(callback, win) {
|
|||
// ----------
|
||||
function hideGroupItem(groupItem, callback) {
|
||||
if (groupItem.hidden) {
|
||||
callback();
|
||||
if (callback)
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
groupItem.addSubscriber("groupHidden", function onHide() {
|
||||
groupItem.removeSubscriber("groupHidden", onHide);
|
||||
callback();
|
||||
});
|
||||
if (callback) {
|
||||
groupItem.addSubscriber("groupHidden", function onHide() {
|
||||
groupItem.removeSubscriber("groupHidden", onHide);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
groupItem.closeAll();
|
||||
}
|
||||
|
||||
// ----------
|
||||
function unhideGroupItem(groupItem, callback) {
|
||||
if (!groupItem.hidden) {
|
||||
callback();
|
||||
if (callback)
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
groupItem.addSubscriber("groupShown", function onShown() {
|
||||
groupItem.removeSubscriber("groupShown", onShown);
|
||||
callback();
|
||||
});
|
||||
if (callback) {
|
||||
groupItem.addSubscriber("groupShown", function onShown() {
|
||||
groupItem.removeSubscriber("groupShown", onShown);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
groupItem._unhide();
|
||||
}
|
||||
|
||||
|
@ -352,3 +354,18 @@ function restoreTab(callback, index, win) {
|
|||
finalize();
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
function togglePrivateBrowsing(callback) {
|
||||
let topic = "private-browsing-transition-complete";
|
||||
|
||||
Services.obs.addObserver(function observe() {
|
||||
Services.obs.removeObserver(observe, topic);
|
||||
afterAllTabsLoaded(callback);
|
||||
}, topic, false);
|
||||
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
|
||||
}
|
||||
|
|
|
@ -476,6 +476,7 @@ function runTest(testNum) {
|
|||
// Context menu for element with assigned content context menu
|
||||
checkContextMenu(["+Plain item", {type: "", icon: "", checked: false, disabled: false},
|
||||
"+Disabled item", {type: "", icon: "", checked: false, disabled: true},
|
||||
"+Item w/ textContent", {type: "", icon: "", checked: false, disabled: false},
|
||||
"---", null,
|
||||
"+Checkbox", {type: "checkbox", icon: "", checked: true, disabled: false},
|
||||
"---", null,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
dnl check if the build is using lto. This is really primitive and only detects llvm based
|
||||
dnl compilers right now.
|
||||
AC_DEFUN(MOZ_DOING_LTO,
|
||||
AC_DEFUN([MOZ_DOING_LTO],
|
||||
[
|
||||
cat > conftest.c <<EOF
|
||||
int foo = 1;
|
||||
|
|
|
@ -37,7 +37,7 @@ dnl
|
|||
dnl ***** END LICENSE BLOCK *****
|
||||
|
||||
dnl MOZ_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
AC_DEFUN(MOZ_CHECK_HEADER,
|
||||
AC_DEFUN([MOZ_CHECK_HEADER],
|
||||
[ dnl Do the transliteration at runtime so arg 1 can be a shell variable.
|
||||
ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
|
||||
AC_MSG_CHECKING([for $1])
|
||||
|
@ -55,7 +55,7 @@ AC_DEFUN(MOZ_CHECK_HEADER,
|
|||
])
|
||||
|
||||
dnl MOZ_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
AC_DEFUN(MOZ_CHECK_HEADERS,
|
||||
AC_DEFUN([MOZ_CHECK_HEADERS],
|
||||
[ for ac_hdr in $1
|
||||
do
|
||||
MOZ_CHECK_HEADER($ac_hdr,
|
||||
|
|
|
@ -49,7 +49,7 @@ dnl
|
|||
dnl for example:
|
||||
dnl MOZ_N_BYTE_TYPE([JS_INT32_T], [4], [int long 'long long' short])
|
||||
dnl
|
||||
AC_DEFUN(MOZ_N_BYTE_TYPE,
|
||||
AC_DEFUN([MOZ_N_BYTE_TYPE],
|
||||
[
|
||||
dnl The simplest approach would simply be to run a program that says
|
||||
dnl printf ("%d\n", sizeof ($type));
|
||||
|
@ -83,7 +83,7 @@ dnl found.
|
|||
dnl
|
||||
dnl for example:
|
||||
dnl MOZ_SIZE_OF_TYPE([JS_BYTES_PER_WORD], [void*], [4 8])
|
||||
AC_DEFUN(MOZ_SIZE_OF_TYPE,
|
||||
AC_DEFUN([MOZ_SIZE_OF_TYPE],
|
||||
[
|
||||
AC_CACHE_CHECK([for the size of $2], moz_cv_size_of_$1, [
|
||||
moz_cv_size_of_$1=
|
||||
|
@ -113,7 +113,7 @@ dnl found.
|
|||
dnl
|
||||
dnl for example:
|
||||
dnl MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
|
||||
AC_DEFUN(MOZ_ALIGN_OF_TYPE,
|
||||
AC_DEFUN([MOZ_ALIGN_OF_TYPE],
|
||||
[
|
||||
AC_CACHE_CHECK([for the alignment of $2], moz_cv_align_of_$1, [
|
||||
moz_cv_align_of_$1=
|
||||
|
|
|
@ -36,14 +36,14 @@ dnl the terms of any one of the MPL, the GPL or the LGPL.
|
|||
dnl
|
||||
dnl ***** END LICENSE BLOCK *****
|
||||
|
||||
AC_DEFUN(MOZ_PROG_CHECKMSYS,
|
||||
AC_DEFUN([MOZ_PROG_CHECKMSYS],
|
||||
[AC_REQUIRE([AC_INIT_BINSH])dnl
|
||||
if test `uname -s | grep -c MINGW 2>/dev/null` != "0"; then
|
||||
msyshost=1
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(MOZ_PATH_PROG,
|
||||
AC_DEFUN([MOZ_PATH_PROG],
|
||||
[ AC_PATH_PROG($1,$2,$3,$4)
|
||||
if test "$msyshost"; then
|
||||
case "[$]$1" in
|
||||
|
@ -59,7 +59,7 @@ AC_DEFUN(MOZ_PATH_PROG,
|
|||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(MOZ_PATH_PROGS,
|
||||
AC_DEFUN([MOZ_PATH_PROGS],
|
||||
[ AC_PATH_PROGS($1,$2,$3,$4)
|
||||
if test "$msyshost"; then
|
||||
case "[$]$1" in
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
dnl AM_PATH_NSS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for NSS, and define NSS_CFLAGS and NSS_LIBS
|
||||
AC_DEFUN(AM_PATH_NSS,
|
||||
AC_DEFUN([AM_PATH_NSS],
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(nss-prefix,
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
if test -z "$CC" ; then
|
||||
CC=gcc-4.2
|
||||
fi
|
||||
|
||||
if test -z "$CXX" ; then
|
||||
CXX=g++-4.2
|
||||
fi
|
||||
|
||||
# We do 32 bit builds for leopard
|
||||
CC="$CC -arch i386"
|
||||
CXX="$CXX -arch i386"
|
||||
|
||||
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
|
|
@ -65,15 +65,20 @@ public class ASMozStub extends android.app.Service {
|
|||
Timer timer = null;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final Class[] mStartForegroundSignature = new Class[] {
|
||||
private static final Class<?>[] mSetForegroundSignature = new Class[] {
|
||||
boolean.class};
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final Class<?>[] mStartForegroundSignature = new Class[] {
|
||||
int.class, Notification.class};
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final Class[] mStopForegroundSignature = new Class[] {
|
||||
private static final Class<?>[] mStopForegroundSignature = new Class[] {
|
||||
boolean.class};
|
||||
|
||||
private NotificationManager mNM;
|
||||
private Method mSetForeground;
|
||||
private Method mStartForeground;
|
||||
private Method mStopForeground;
|
||||
private Object[] mSetForegroundArgs = new Object[1];
|
||||
private Object[] mStartForegroundArgs = new Object[2];
|
||||
private Object[] mStopForegroundArgs = new Object[1];
|
||||
|
||||
|
@ -97,6 +102,13 @@ public class ASMozStub extends android.app.Service {
|
|||
mStartForeground = mStopForeground = null;
|
||||
}
|
||||
|
||||
try {
|
||||
mSetForeground = getClass().getMethod("setForeground", mSetForegroundSignature);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
mSetForeground = null;
|
||||
}
|
||||
|
||||
doToast("Listener Service created...");
|
||||
}
|
||||
|
||||
|
@ -183,7 +195,18 @@ public class ASMozStub extends android.app.Service {
|
|||
}
|
||||
|
||||
// Fall back on the old API.
|
||||
setForeground(true);
|
||||
if (mSetForeground != null) {
|
||||
try {
|
||||
mSetForegroundArgs[0] = Boolean.TRUE;
|
||||
mSetForeground.invoke(this, mSetForegroundArgs);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
mNM.notify(id, notification);
|
||||
}
|
||||
|
||||
|
@ -210,6 +233,17 @@ public class ASMozStub extends android.app.Service {
|
|||
// Fall back on the old API. Note to cancel BEFORE changing the
|
||||
// foreground state, since we could be killed at that point.
|
||||
mNM.cancel(id);
|
||||
setForeground(false);
|
||||
if (mSetForeground != null) {
|
||||
try {
|
||||
mSetForegroundArgs[0] = Boolean.FALSE;
|
||||
mSetForeground.invoke(this, mSetForegroundArgs);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ public class DoCommand {
|
|||
String ffxProvider = "org.mozilla.ffxcp";
|
||||
String fenProvider = "org.mozilla.fencp";
|
||||
|
||||
private final String prgVersion = "SUTAgentAndroid Version 1.01";
|
||||
private final String prgVersion = "SUTAgentAndroid Version 1.02";
|
||||
|
||||
public enum Command
|
||||
{
|
||||
|
|
|
@ -87,6 +87,9 @@ public class WatcherService extends Service
|
|||
public static final int NOTIFICATION_ID = 1964;
|
||||
boolean bInstalling = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final Class<?>[] mSetForegroundSignature = new Class[] {
|
||||
boolean.class};
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final Class[] mStartForegroundSignature = new Class[] {
|
||||
int.class, Notification.class};
|
||||
|
@ -95,13 +98,16 @@ public class WatcherService extends Service
|
|||
boolean.class};
|
||||
|
||||
private NotificationManager mNM;
|
||||
private Method mSetForeground;
|
||||
private Method mStartForeground;
|
||||
private Method mStopForeground;
|
||||
private Object[] mSetForegroundArgs = new Object[1];
|
||||
private Object[] mStartForegroundArgs = new Object[2];
|
||||
private Object[] mStopForegroundArgs = new Object[1];
|
||||
|
||||
|
||||
private IWatcherService.Stub stub = new IWatcherService.Stub() {
|
||||
@Override
|
||||
public int UpdateApplication(String sAppName, String sFileName, String sOutFile, int bReboot) throws RemoteException
|
||||
{
|
||||
return UpdtApp(sAppName, sFileName, sOutFile, bReboot);
|
||||
|
@ -279,6 +285,12 @@ public class WatcherService extends Service
|
|||
// Running on an older platform.
|
||||
mStartForeground = mStopForeground = null;
|
||||
}
|
||||
try {
|
||||
mSetForeground = getClass().getMethod("setForeground", mSetForegroundSignature);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
mSetForeground = null;
|
||||
}
|
||||
Notification notification = new Notification();
|
||||
startForegroundCompat(R.string.foreground_service_started, notification);
|
||||
}
|
||||
|
@ -308,7 +320,18 @@ public class WatcherService extends Service
|
|||
}
|
||||
|
||||
// Fall back on the old API.
|
||||
setForeground(true);
|
||||
if (mSetForeground != null) {
|
||||
try {
|
||||
mSetForegroundArgs[0] = Boolean.TRUE;
|
||||
mSetForeground.invoke(this, mSetForegroundArgs);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
mNM.notify(id, notification);
|
||||
}
|
||||
|
||||
|
@ -335,7 +358,18 @@ public class WatcherService extends Service
|
|||
// Fall back on the old API. Note to cancel BEFORE changing the
|
||||
// foreground state, since we could be killed at that point.
|
||||
mNM.cancel(id);
|
||||
setForeground(false);
|
||||
if (mSetForeground != null) {
|
||||
try {
|
||||
mSetForegroundArgs[0] = Boolean.FALSE;
|
||||
mSetForeground.invoke(this, mSetForegroundArgs);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doToast(String sMsg)
|
||||
|
@ -840,6 +874,7 @@ public class WatcherService extends Service
|
|||
runner.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
bInstalling = true;
|
||||
UpdtApp(msPkgName, msPkgFileName, msOutFile, mbReboot);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- makefile -*-
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
@ -21,6 +22,7 @@
|
|||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# 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"),
|
||||
|
@ -49,7 +51,15 @@ ifdef USE_ELF_HACK
|
|||
DIRS = elfhack
|
||||
endif
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
ifeq (,$(filter WINNT OS2,$(OS_ARCH)))
|
||||
DIRS += test
|
||||
endif # WIN
|
||||
endif # ENABLE_TESTS
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs:: $(srcdir)/run-mozilla.sh
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
# EOF
|
||||
|
|
|
@ -75,7 +75,9 @@ CSRCS := \
|
|||
|
||||
libs:: $(CSRCS:.c=.$(OBJ_SUFFIX))
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
WRAP_MALLOC_CFLAGS=
|
||||
WRAP_MALLOC_LIB=
|
||||
|
||||
test$(DLL_SUFFIX): test.$(OBJ_SUFFIX) elfhack $(CSRCS:.c=.$(OBJ_SUFFIX))
|
||||
$(MKSHLIB) $(LDFLAGS) $<
|
||||
@echo ===
|
||||
|
@ -92,6 +94,13 @@ test$(DLL_SUFFIX): test.$(OBJ_SUFFIX) elfhack $(CSRCS:.c=.$(OBJ_SUFFIX))
|
|||
|
||||
.PRECIOUS: test$(DLL_SUFFIX)
|
||||
|
||||
CSRCS += test.c
|
||||
|
||||
GARBAGE += test$(DLL_SUFFIX) test$(DLL_SUFFIX).bak
|
||||
|
||||
libs:: test$(DLL_SUFFIX)
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
dummy: dummy.$(OBJ_SUFFIX) test$(DLL_SUFFIX)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
|
@ -99,9 +108,9 @@ libs:: dummy
|
|||
# Will either crash or return exit code 1 if elfhack is broken
|
||||
LD_LIBRARY_PATH=$(CURDIR) $(CURDIR)/dummy
|
||||
|
||||
CSRCS += test.c dummy.c
|
||||
CSRCS += dummy.c
|
||||
|
||||
GARBAGE += dummy test$(DLL_SUFFIX) test$(DLL_SUFFIX).bak
|
||||
GARBAGE += dummy
|
||||
endif
|
||||
|
||||
inject:
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# -*- makefile -*-
|
||||
#
|
||||
# ***** 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 mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# 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@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
##################################################
|
||||
## Gather a list of tests, generate timestamp deps
|
||||
##################################################
|
||||
TS=.ts
|
||||
ifneq (,$(findstring check,$(MAKECMDGOALS)))
|
||||
allsrc = $(wildcard $(srcdir)/*)
|
||||
tests2run = $(notdir $(filter %.tpl,$(allsrc)))
|
||||
check_targets += $(addprefix $(TS)/,$(tests2run))
|
||||
endif
|
||||
|
||||
check:: $(TS) $(check_targets)
|
||||
|
||||
#############################################
|
||||
# Only invoke tests when sources have changed
|
||||
#############################################
|
||||
$(TS)/%: $(srcdir)/%
|
||||
$(PERL) $(srcdir)/runtest $<
|
||||
@touch $@
|
||||
|
||||
#####################################################
|
||||
## Extra dep needed to synchronize parallel execution
|
||||
#####################################################
|
||||
$(TS): $(TS)/.done
|
||||
$(TS)/.done:
|
||||
$(MKDIR) -p $(dir $@)
|
||||
touch $@
|
||||
|
||||
GARBAGE_DIRS += $(TS)
|
||||
|
||||
# EOF
|
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env perl
|
||||
###########################################################################
|
||||
## Intent:
|
||||
## Test::Harness is a testing wrapper that will process output
|
||||
## from Test.pm module tests. Sumarize results, report stats
|
||||
## and exit with overall status for the testing suites.
|
||||
##
|
||||
## Run testing suite:
|
||||
## % make clean test
|
||||
## % perl runtest
|
||||
##
|
||||
## Run Individual tests
|
||||
## % perl tUtils0
|
||||
###########################################################################
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
use Test::Harness;
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(1.0);
|
||||
use FindBin;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
unless(GetOptions(\%argv,
|
||||
qw(debug|d)
|
||||
))
|
||||
{
|
||||
print "Usage: $0\n";
|
||||
print " --debug Enable debug mode\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (2 > $Test::Harness::VERSION)
|
||||
{
|
||||
print "Unit tests will not be run, Test::Harness is too old\n"
|
||||
if ($argv{debug});
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
my @tests;
|
||||
|
||||
########################################
|
||||
## Gather a list of tests if none passed
|
||||
########################################
|
||||
unless (@tests = @ARGV)
|
||||
{
|
||||
local *D;
|
||||
opendir(D, '.');
|
||||
while($_ = readdir(D)) {
|
||||
next unless /.t\S+$/;
|
||||
next if (/\.ts$/);
|
||||
push(@tests, $_);
|
||||
}
|
||||
closedir(D);
|
||||
}
|
||||
|
||||
###############################################
|
||||
## Glob a list of tests when directories passed
|
||||
###############################################
|
||||
my @tmp;
|
||||
foreach (@tests)
|
||||
{
|
||||
local *D;
|
||||
if (-d $_ && (my $dir = $_))
|
||||
{
|
||||
opendir(D, $_) || die "opendir(D) failed: $!";
|
||||
my @tests = grep(/\.t[^\.\s]+/o, readdir(D));
|
||||
closedir(D);
|
||||
push(@tmp, map{ join('/', $dir, $_); } @tests);
|
||||
} else {
|
||||
push(@tmp, $_);
|
||||
}
|
||||
}
|
||||
@tests = @tmp;
|
||||
|
||||
print "$0: @ARGV\n" if ($argv{debug});
|
||||
runtests(@tests);
|
||||
|
||||
# EOF
|
|
@ -0,0 +1,151 @@
|
|||
#!/usr/bin/env perl
|
||||
###########################################################################
|
||||
## Intent: Unit test to verify uniq.pl
|
||||
###########################################################################
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
use Cwd;
|
||||
use Getopt::Long; # GetOptions
|
||||
|
||||
use Test;
|
||||
sub BEGIN { plan tests => 12 }
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(1.0);
|
||||
|
||||
##------------------##
|
||||
##---] INCLUDES [---##
|
||||
##------------------##
|
||||
use FindBin;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
|
||||
|
||||
###########################################################################
|
||||
## Intent: Run the arch command for output
|
||||
##
|
||||
## Returns:
|
||||
## 0 on success
|
||||
## $? command shell exit status
|
||||
###########################################################################
|
||||
sub uniq_pl
|
||||
{
|
||||
my $cmd = "perl $FindBin::RealBin/../uniq.pl @_";
|
||||
print "Running: $cmd\n" if ($argv{debug});
|
||||
my @tmp = `$cmd 2>&1`;
|
||||
my @output = map{ split(/\s+/o); } @tmp;
|
||||
wantarray ? @output : "@output";
|
||||
} # uniq_pl
|
||||
|
||||
###########################################################################
|
||||
## Intent:
|
||||
##
|
||||
## Returns:
|
||||
## 0 on success
|
||||
###########################################################################
|
||||
sub check_uniq
|
||||
{
|
||||
print STDERR "Running test: check_uniq\n" if ($argv{debug});
|
||||
|
||||
# TODO: improve test, uniq.pl regexpr handling not quite right
|
||||
|
||||
my @todo =
|
||||
(
|
||||
[ '', qw(a a/b a/b/c) ] => [ qw(a a/b a/b/c) ],
|
||||
[ '', qw(a/b a a/b/c) ] => [ qw(a/b a a/b/c) ],
|
||||
[ '', qw(a/b/c a/b a) ] => [ qw(a/b/c a/b a) ],
|
||||
|
||||
[ '', qw(a a/b a/b/c a/b a) ] => [ qw(a a/b a/b/c) ], # dup removal
|
||||
|
||||
[ '-s', qw(a a/b a/b/c) ] => [ qw(a a/b a/b/c) ],
|
||||
[ '-s', qw(a/b a a/b/c) ] => [ qw(a a/b a/b/c) ],
|
||||
[ '-s', qw(a/b/c a/b a) ] => [ qw(a a/b a/b/c) ],
|
||||
|
||||
[ '-r', qw(a a/b a/b/c) ] => [ qw(a) ],
|
||||
[ '-r', qw(a/b a a/b/c) ] => [ qw(a/b a) ],
|
||||
[ '-r', qw(a/b/c a/b a) ] => [ qw(a/b/c a/b a) ],
|
||||
|
||||
[ '-r', qw(. .. a/b ../a aa/bb) ] => [ qw(. .. a/b aa/bb) ],
|
||||
[ '-r', qw(.. a/b ../a . aa/bb) ] => [ qw(.. a/b . aa/bb) ],
|
||||
);
|
||||
|
||||
my $ct=1;
|
||||
while (@todo)
|
||||
{
|
||||
my ($a, $b) = splice(@todo, 0, 2);
|
||||
my @args = @{ $a };
|
||||
my @exp = @{ $b };
|
||||
|
||||
my @out = uniq_pl(@args);
|
||||
# compareExp(\@out, \@exp, 'Failed on line ' . __LINE__ . ", dataset $ct");
|
||||
if (0 && 7 == $ct)
|
||||
{
|
||||
print STDERR "\n";
|
||||
print STDERR map{ "args> $_\n" }@args;
|
||||
print STDERR "\n";
|
||||
print STDERR map{ "exp> $_\n" }@exp;
|
||||
print STDERR "\n";
|
||||
print STDERR map{ "out> $_\n" }@out;
|
||||
}
|
||||
|
||||
ok("@out", "@exp", 'Failed on line ' . __LINE__ . ", dataset $ct");
|
||||
$ct++;
|
||||
}
|
||||
|
||||
} # check_uniq
|
||||
|
||||
###########################################################################
|
||||
## Intent: Smoke tests for the unittests module
|
||||
###########################################################################
|
||||
sub smoke
|
||||
{
|
||||
print STDERR "Running test: smoke()\n" if ($argv{debug});
|
||||
} # smoke()
|
||||
|
||||
###########################################################################
|
||||
## Intent: Intitialize global test objects and consts
|
||||
###########################################################################
|
||||
sub init
|
||||
{
|
||||
print "Running: init()\n" if ($argv{debug});
|
||||
# testplan(24, 0);
|
||||
} # init()
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
unless(GetOptions(\%argv,
|
||||
qw(
|
||||
debug|d
|
||||
manual
|
||||
test=s@
|
||||
verbose
|
||||
)))
|
||||
{
|
||||
print "USAGE: $0\n";
|
||||
print " --debug Enable script debug mode\n";
|
||||
print " --fail Force a testing failure condition\n";
|
||||
print " --manual Also run disabled tests\n";
|
||||
print " --smoke Run smoke tests then exit\n";
|
||||
print " --test Run a list of tests by function name\n";
|
||||
print " --verbose Enable script verbose mode\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
init();
|
||||
testbyname(@{ $argv{test} }) if ($argv{test});
|
||||
smoke();
|
||||
|
||||
check_uniq();
|
||||
ok(1, 0, 'Forced failure by command line arg --fail') if ($argv{fail});
|
||||
|
||||
# EOF
|
|
@ -22,6 +22,7 @@
|
|||
#
|
||||
# Contributor(s):
|
||||
# Christopher Seawood <cls@seawood.org>
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# 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"),
|
||||
|
@ -37,27 +38,88 @@
|
|||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
use Getopt::Std;
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
getopts('rs');
|
||||
$regexp = 1 if (defined($opt_r));
|
||||
$sort = 1 if (defined($opt_s));
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(1.1);
|
||||
|
||||
undef @out;
|
||||
if ($sort) {
|
||||
@in = sort @ARGV;
|
||||
} else {
|
||||
@in = @ARGV;
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
my $modver = $Getopt::Long::VERSION || 0;
|
||||
my $isOldGetopt = ($modver eq '2.25') ? 1 : 0;
|
||||
|
||||
###########################################################################
|
||||
## Intent: Script init function
|
||||
###########################################################################
|
||||
sub init
|
||||
{
|
||||
if ($isOldGetopt)
|
||||
{
|
||||
# mozilla.build/mingw perl in need of an upgrade
|
||||
# emulate Getopt::Long switch|short:init
|
||||
foreach (qw(debug regex sort))
|
||||
{
|
||||
if (defined($argv{$_}))
|
||||
{
|
||||
$argv{$_} ||= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} # init
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
my @args = ($isOldGetopt)
|
||||
? qw(debug|d regex|r sort|s)
|
||||
: qw(debug|d:1 regex|r:1 sort|s:1)
|
||||
;
|
||||
|
||||
unless(GetOptions(\%argv, @args))
|
||||
{
|
||||
print "Usage: $0\n";
|
||||
print " --sort Sort list elements early\n";
|
||||
print " --regex Exclude subdirs by pattern\n";
|
||||
}
|
||||
foreach $d (@in) {
|
||||
if ($regexp) {
|
||||
$found = 0;
|
||||
foreach $dir (@out) {
|
||||
$found++, last if ($d =~ m/^$dir\// || $d eq $dir);
|
||||
|
||||
init();
|
||||
my $debug = $argv{debug} || 0;
|
||||
|
||||
my %seen;
|
||||
my @out;
|
||||
my @in = ($argv{sort}) ? sort @ARGV : @ARGV;
|
||||
|
||||
foreach my $d (@in)
|
||||
{
|
||||
next if ($seen{$d}++);
|
||||
|
||||
print " arg is $d\n" if ($debug);
|
||||
|
||||
if ($argv{regex})
|
||||
{
|
||||
my $found = 0;
|
||||
foreach my $dir (@out)
|
||||
{
|
||||
my $dirM = quotemeta($dir);
|
||||
$found++, last if ($d eq $dir || $d =~ m!^${dirM}\/!);
|
||||
}
|
||||
print "Adding $d\n" if ($debug && !$found);
|
||||
push @out, $d if (!$found);
|
||||
} else {
|
||||
push @out, $d if (!grep(/^$d$/, @out));
|
||||
print "Adding: $d\n" if ($debug);
|
||||
push(@out, $d);
|
||||
}
|
||||
}
|
||||
|
||||
print "@out\n"
|
||||
|
||||
# EOF
|
||||
|
|
|
@ -531,7 +531,6 @@ MOZ_TREE_FREETYPE = @MOZ_TREE_FREETYPE@
|
|||
MOZ_ENABLE_CAIRO_FT = @MOZ_ENABLE_CAIRO_FT@
|
||||
MOZ_ENABLE_GTK2 = @MOZ_ENABLE_GTK2@
|
||||
MOZ_ENABLE_QT = @MOZ_ENABLE_QT@
|
||||
MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
|
||||
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
|
||||
MOZ_ENABLE_DWRITE_FONT = @MOZ_ENABLE_DWRITE_FONT@
|
||||
MOZ_ENABLE_D2D_SURFACE = @MOZ_ENABLE_D2D_SURFACE@
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
#
|
||||
|
||||
# Define an include-at-most-once flag
|
||||
#ifdef INCLUDED_CONFIG_MK
|
||||
#$(error Don't include config.mk twice!)
|
||||
#endif
|
||||
ifdef INCLUDED_CONFIG_MK
|
||||
$(error Don't include config.mk twice!)
|
||||
endif
|
||||
INCLUDED_CONFIG_MK = 1
|
||||
|
||||
EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
|
||||
|
|
|
@ -1532,6 +1532,7 @@ $(XPIDL_GEN_DIR)/.done:
|
|||
|
||||
XPIDL_DEPS = \
|
||||
$(topsrcdir)/xpcom/idl-parser/header.py \
|
||||
$(topsrcdir)/xpcom/idl-parser/typelib.py \
|
||||
$(topsrcdir)/xpcom/idl-parser/xpidl.py \
|
||||
$(NULL)
|
||||
|
||||
|
@ -1547,9 +1548,13 @@ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
|
|||
ifndef NO_GEN_XPT
|
||||
# generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
|
||||
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
|
||||
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
|
||||
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$(@F).pp $(_VPATH_SRCS)
|
||||
$(PYTHON_PATH) \
|
||||
-I$(topsrcdir)/other-licenses/ply \
|
||||
-I$(topsrcdir)/xpcom/idl-parser \
|
||||
-I$(topsrcdir)/xpcom/typelib/xpt/tools \
|
||||
$(topsrcdir)/xpcom/idl-parser/typelib.py --cachedir=$(topsrcdir)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
|
||||
|
||||
# no need to link together if XPIDLSRCS contains only XPIDL_MODULE
|
||||
ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
|
||||
|
|
|
@ -565,14 +565,6 @@ pcfs/pc_dir.h
|
|||
Pgenerr.h
|
||||
PGenErr.h
|
||||
Ph.h
|
||||
photon/Pg.h
|
||||
photon/PhProto.h
|
||||
photon/PhRender.h
|
||||
photon/PpProto.h
|
||||
photon/PtProgress.h
|
||||
photon/PtServer.h
|
||||
photon/PtWebClient.h
|
||||
photon/PxImage.h
|
||||
pk11func.h
|
||||
pk11pub.h
|
||||
pkcs11t.h
|
||||
|
|
151
configure.in
151
configure.in
|
@ -303,11 +303,39 @@ case "$target" in
|
|||
fi
|
||||
|
||||
if test -z "$android_toolchain" ; then
|
||||
android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
|
||||
AC_MSG_CHECKING([for android toolchain directory])
|
||||
|
||||
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
|
||||
|
||||
android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
|
||||
|
||||
# With newer NDK, the toolchain path has changed.
|
||||
if ! test -d "$android_toolchain" ; then
|
||||
android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
|
||||
fi
|
||||
|
||||
if test -d "$android_toolchain" ; then
|
||||
AC_MSG_RESULT([$android_toolchain])
|
||||
else
|
||||
AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$android_platform" ; then
|
||||
android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
|
||||
AC_MSG_CHECKING([for android platform directory])
|
||||
|
||||
android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
|
||||
|
||||
# With newer NDK, the platform path has changed.
|
||||
if ! test -d "$android_platform" ; then
|
||||
android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
|
||||
fi
|
||||
|
||||
if test -d "$android_platform" ; then
|
||||
AC_MSG_RESULT([$android_platform])
|
||||
else
|
||||
AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl set up compilers
|
||||
|
@ -343,7 +371,7 @@ case "$target" in
|
|||
CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
|
||||
CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
|
||||
CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
|
||||
LIBS="$LIBS $STLPORT_LIBS -static-libstdc++"
|
||||
LIBS="$LIBS $STLPORT_LIBS"
|
||||
|
||||
dnl Add -llog by default, since we use it all over the place.
|
||||
dnl Add --allow-shlib-undefined, because libGLESv2 links to an
|
||||
|
@ -366,8 +394,8 @@ case "$target" in
|
|||
fi
|
||||
|
||||
ANDROID_NDK="${android_ndk}"
|
||||
ANDROID_TOOLCHAIN="{android_toolchain}"
|
||||
ANDROID_PLATFORM="{android_platform}"
|
||||
ANDROID_TOOLCHAIN="${android_toolchain}"
|
||||
ANDROID_PLATFORM="${android_platform}"
|
||||
ANDROID_SDK="${android_sdk}"
|
||||
ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
|
||||
ANDROID_VERSION="${android_version}"
|
||||
|
@ -1360,8 +1388,6 @@ OSF1)
|
|||
OS_2)
|
||||
HOST_OS_ARCH=OS2
|
||||
;;
|
||||
QNX)
|
||||
;;
|
||||
SCO_SV)
|
||||
HOST_OS_ARCH=SCOOS
|
||||
;;
|
||||
|
@ -1450,14 +1476,6 @@ OS_2)
|
|||
OS_TARGET=OS2
|
||||
OS_RELEASE=`uname -v`
|
||||
;;
|
||||
QNX)
|
||||
if test "$OS_TARGET" != "NTO"; then
|
||||
changequote(,)
|
||||
OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
|
||||
changequote([,])
|
||||
fi
|
||||
OS_TEST=x86
|
||||
;;
|
||||
SCO_SV)
|
||||
OS_ARCH=SCOOS
|
||||
OS_RELEASE=5.0
|
||||
|
@ -2499,37 +2517,6 @@ ia64*-hpux*)
|
|||
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
|
||||
;;
|
||||
|
||||
*-nto*)
|
||||
AC_DEFINE(NTO)
|
||||
AC_DEFINE(_QNX_SOURCE)
|
||||
AC_DEFINE(_i386)
|
||||
OS_TARGET=NTO
|
||||
WARNINGS_AS_ERRORS=''
|
||||
MOZ_OPTIMIZE_FLAGS="-O"
|
||||
MOZ_DEBUG_FLAGS="-gstabs"
|
||||
USE_PTHREADS=1
|
||||
_PEDANTIC=
|
||||
LIBS="$LIBS -lsocket -lstdc++"
|
||||
_DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
|
||||
_DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
|
||||
if test "$with_x" != "yes"
|
||||
then
|
||||
_PLATFORM_DEFAULT_TOOLKIT="photon"
|
||||
TK_CFLAGS='-I/usr/include/photon'
|
||||
TK_LIBS='-lph'
|
||||
fi
|
||||
case "${target_cpu}" in
|
||||
ppc*)
|
||||
AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
|
||||
;;
|
||||
esac
|
||||
case "${host_cpu}" in
|
||||
i*86)
|
||||
USE_ELF_DYNSTR_GC=1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-openbsd*)
|
||||
if test "$SO_VERSION"; then
|
||||
DLL_SUFFIX=".so.$SO_VERSION"
|
||||
|
@ -2636,20 +2623,6 @@ alpha*-*-osf*)
|
|||
AC_DEFINE(NEED_USLEEP_PROTOTYPE)
|
||||
;;
|
||||
|
||||
*-qnx*)
|
||||
DIRENT_INO=d_stat.st_ino
|
||||
dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
|
||||
AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
|
||||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||
dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
|
||||
AC_DEFINE(STDC_HEADERS)
|
||||
if test "$no_x" = "yes"; then
|
||||
_PLATFORM_DEFAULT_TOOLKIT='photon'
|
||||
TK_CFLAGS='-I/usr/nto/include/photon'
|
||||
TK_LIBS='-lphoton -lphrender'
|
||||
fi
|
||||
;;
|
||||
|
||||
*-sco*)
|
||||
AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
|
||||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||
|
@ -4963,7 +4936,6 @@ MOZ_ARG_HEADER(Toolkit Options)
|
|||
Select default toolkit
|
||||
Platform specific defaults:
|
||||
Mac OS X - cairo-cocoa
|
||||
Neutrino/QNX - photon
|
||||
OS/2 - cairo-os2
|
||||
Win32 - cairo-windows
|
||||
Gtk2 with DirectFB - cairo-gtk2-dfb
|
||||
|
@ -4972,8 +4944,7 @@ MOZ_ARG_HEADER(Toolkit Options)
|
|||
[ _DEFAULT_TOOLKIT=$enableval ],
|
||||
[ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
|
||||
|
||||
if test "$_DEFAULT_TOOLKIT" = "photon" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
|
||||
if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
|
||||
|
@ -4994,10 +4965,6 @@ dnl = Enable the toolkit as needed =
|
|||
dnl ========================================================
|
||||
|
||||
case "$MOZ_WIDGET_TOOLKIT" in
|
||||
photon)
|
||||
MOZ_ENABLE_PHOTON=1
|
||||
AC_DEFINE(MOZ_WIDGET_PHOTON)
|
||||
;;
|
||||
|
||||
cairo-windows)
|
||||
MOZ_WIDGET_TOOLKIT=windows
|
||||
|
@ -5252,7 +5219,6 @@ AC_SUBST(TK_CFLAGS)
|
|||
AC_SUBST(TK_LIBS)
|
||||
|
||||
AC_SUBST(MOZ_ENABLE_GTK2)
|
||||
AC_SUBST(MOZ_ENABLE_PHOTON)
|
||||
AC_SUBST(MOZ_ENABLE_QT)
|
||||
AC_SUBST(MOZ_ENABLE_QTNETWORK)
|
||||
AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
|
||||
|
@ -7267,6 +7233,38 @@ if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
|
|||
export MOZ_DEBUG_SYMBOLS
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Identical Code Folding
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(icf,
|
||||
[ --disable-icf Disable Identical Code Folding],
|
||||
MOZ_DISABLE_ICF=1,
|
||||
MOZ_DISABLE_ICF= )
|
||||
|
||||
if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$MOZ_DISABLE_ICF"; then
|
||||
AC_CACHE_CHECK([whether the linker supports Identical Code Folding],
|
||||
LD_SUPPORTS_ICF,
|
||||
[echo 'int foo() {return 42;}' \
|
||||
'int bar() {return 42;}' \
|
||||
'int main() {return foo() - bar();}' > conftest.${ac_ext}
|
||||
# If the linker supports ICF, foo and bar symbols will have
|
||||
# the same address
|
||||
if AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS -Wl,--icf=safe -ffunction-sections conftest.${ac_ext} $LIBS 1>&2]) &&
|
||||
test -s conftest${ac_exeext} &&
|
||||
objdump -t conftest${ac_exeext} | awk '{a[[$6]] = $1} END {if (a[["foo"]] && (a[["foo"]] != a[["bar"]])) { exit 1 }}'; then
|
||||
LD_SUPPORTS_ICF=yes
|
||||
else
|
||||
LD_SUPPORTS_ICF=no
|
||||
fi
|
||||
rm -rf conftest*])
|
||||
if test "$LD_SUPPORTS_ICF" = yes; then
|
||||
LDFLAGS="$LDFLAGS -Wl,--icf=safe"
|
||||
CFLAGS="$CFLAGS -ffunction-sections"
|
||||
CXXFLAGS="$CXXFLAGS -ffunction-sections"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Automatically remove dead symbols
|
||||
dnl ========================================================
|
||||
|
@ -7294,8 +7292,16 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
|
|||
rm -rf conftest*])
|
||||
if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
|
||||
DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
|
||||
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
|
||||
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
|
||||
case "$CFLAGS" in
|
||||
*-ffunction-sections*)
|
||||
CFLAGS="$CFLAGS -fdata-sections"
|
||||
CXXFLAGS="$CXXFLAGS -fdata-sections"
|
||||
;;
|
||||
*)
|
||||
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
|
||||
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -7461,6 +7467,7 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
WIN32_NEW_STYLE_JEMALLOC=1
|
||||
AC_DEFINE(WIN32_NEW_STYLE_JEMALLOC)
|
||||
WIN32_CRT_SRC_DIR=
|
||||
if test -z "$MOZ_DEBUG"; then
|
||||
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
|
||||
else
|
||||
|
@ -7470,7 +7477,7 @@ else
|
|||
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
|
||||
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
|
||||
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
|
||||
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
|
||||
MOZ_MEMORY_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
|
||||
else
|
||||
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
|
||||
fi
|
||||
|
@ -7859,7 +7866,7 @@ dnl done during packaging with omnijar.
|
|||
if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
|
||||
MOZ_OMNIJAR=1
|
||||
AC_DEFINE(MOZ_OMNIJAR)
|
||||
if test "$OS_ARCH" = "WINNT"; then
|
||||
if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
|
||||
MOZ_CHROME_FILE_FORMAT=flat
|
||||
else
|
||||
MOZ_CHROME_FILE_FORMAT=symlink
|
||||
|
|
|
@ -108,8 +108,6 @@ XPIDLSRCS = \
|
|||
nsIDOMFormData.idl \
|
||||
nsIDOMParser.idl \
|
||||
nsIDOMSerializer.idl \
|
||||
nsISelection2.idl \
|
||||
nsISelection3.idl \
|
||||
nsISelectionController.idl \
|
||||
nsISelectionDisplay.idl \
|
||||
nsISelectionListener.idl \
|
||||
|
|
|
@ -1692,6 +1692,10 @@ protected:
|
|||
// True if we're an SVG document being used as an image.
|
||||
PRPackedBool mIsBeingUsedAsImage;
|
||||
|
||||
// True is this document is synthetic : stand alone image, video, audio
|
||||
// file, etc.
|
||||
PRPackedBool mIsSyntheticDocument;
|
||||
|
||||
// The document's script global object, the object from which the
|
||||
// document can get its script context and scope. This is the
|
||||
// *inner* window object.
|
||||
|
|
|
@ -49,7 +49,7 @@ interface nsIDOMRange;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
[scriptable, uuid(B2C7ED59-8634-4352-9E37-5484C8B6E4E1)]
|
||||
[scriptable, uuid(5ac0cd5d-3c08-4c4c-8e70-230c433f5d5c)]
|
||||
interface nsISelection : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -165,4 +165,25 @@ interface nsISelection : nsISupports
|
|||
* Returns the whole selection into a plain text string.
|
||||
*/
|
||||
wstring toString();
|
||||
|
||||
/**
|
||||
* Modifies the selection. Note that the parameters are case-insensitive.
|
||||
*
|
||||
* @param alter can be one of { "move", "extend" }
|
||||
* - "move" collapses the selection to the end of the selection and
|
||||
* applies the movement direction/granularity to the collapsed
|
||||
* selection.
|
||||
* - "extend" leaves the start of the selection unchanged, and applies
|
||||
* movement direction/granularity to the end of the selection.
|
||||
* @param direction can be one of { "forward", "backward", "left", "right" }
|
||||
* @param granularity can be one of { "character", "word",
|
||||
* "line", "lineboundary" }
|
||||
*
|
||||
* @returns NS_ERROR_NOT_IMPLEMENTED if the granularity is "sentence",
|
||||
* "sentenceboundary", "paragraph", "paragraphboundary", or
|
||||
* "documentboundary". Returns NS_ERROR_INVALID_ARG if alter, direction,
|
||||
* or granularity has an unrecognized value.
|
||||
*/
|
||||
void modify(in DOMString alter, in DOMString direction,
|
||||
in DOMString granularity);
|
||||
};
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 Selection code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
* Alexander Surkov <surkov.alexander@gmail.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsISelection.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMRange;
|
||||
|
||||
%{C++
|
||||
#include "nsCOMArray.h"
|
||||
%}
|
||||
|
||||
[ptr] native RangeArray(nsCOMArray<nsIDOMRange>);
|
||||
|
||||
[scriptable, uuid(5d21d5fe-3691-4716-a334-4691eea54d29)]
|
||||
interface nsISelection2 : nsISelection
|
||||
{
|
||||
/**
|
||||
* Returns the type of the selection (see nsISelectionController for
|
||||
* available constants).
|
||||
*/
|
||||
readonly attribute short type;
|
||||
|
||||
/**
|
||||
* Return array of ranges intersecting with the given DOM interval.
|
||||
*/
|
||||
void GetRangesForInterval(
|
||||
in nsIDOMNode beginNode, in PRInt32 beginOffset,
|
||||
in nsIDOMNode endNode, in PRInt32 endOffset,
|
||||
in boolean allowAdjacent,
|
||||
out PRUint32 resultCount,
|
||||
[retval, array, size_is(resultCount)] out nsIDOMRange results);
|
||||
|
||||
[noscript] void GetRangesForIntervalCOMArray(
|
||||
in nsIDOMNode beginNode, in PRInt32 beginOffset,
|
||||
in nsIDOMNode endNode, in PRInt32 endOffset,
|
||||
in boolean allowAdjacent,
|
||||
in RangeArray results);
|
||||
|
||||
/**
|
||||
* Scrolls a region of the selection, so that it is visible in
|
||||
* the scrolled view.
|
||||
*
|
||||
* @param aRegion - the region inside the selection to scroll into view
|
||||
* (see selection region constants defined in
|
||||
* nsISelectionController).
|
||||
* @param aIsSynchronous - when true, scrolls the selection into view
|
||||
* before returning. If false, posts a request which
|
||||
* is processed at some point after the method returns.
|
||||
* @param aVPercent - how to align the frame vertically. A value of 0
|
||||
* means the frame's upper edge is aligned with the top edge
|
||||
* of the visible area. A value of 100 means the frame's
|
||||
* bottom edge is aligned with the bottom edge of
|
||||
* the visible area. For values in between, the point
|
||||
* "aVPercent" down the frame is placed at the point
|
||||
* "aVPercent" down the visible area. A value of 50 centers
|
||||
* the frame vertically. A value of -1 means move
|
||||
* the frame the minimum amount necessary in order for
|
||||
* the entire frame to be visible vertically (if possible).
|
||||
* @param aHPercent - how to align the frame horizontally. A value of 0
|
||||
* means the frame's left edge is aligned with the left
|
||||
* edge of the visible area. A value of 100 means the
|
||||
* frame's right edge is aligned with the right edge of
|
||||
* the visible area. For values in between, the point
|
||||
* "aHPercent" across the frame is placed at the point
|
||||
* "aHPercent" across the visible area. A value of 50
|
||||
* centers the frame horizontally . A value of -1 means
|
||||
* move the frame the minimum amount necessary in order
|
||||
* for the entire frame to be visible horizontally
|
||||
* (if possible).
|
||||
*/
|
||||
void scrollIntoView(in short aRegion, in boolean aIsSynchronous,
|
||||
in short aVPercent, in short aHPercent);
|
||||
};
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 Selection 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):
|
||||
* Justin Lebar <justin.lebar@gmail.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(94ac0cb4-95b4-11df-8e13-0026b9792740)]
|
||||
interface nsISelection3 : nsISupports
|
||||
{
|
||||
/**
|
||||
* Modifies the selection. Note that the parameters are case-insensitive.
|
||||
*
|
||||
* @param alter can be one of { "move", "extend" }
|
||||
* - "move" collapses the selection to the end of the selection and
|
||||
* applies the movement direction/granularity to the collapsed
|
||||
* selection.
|
||||
* - "extend" leaves the start of the selection unchanged, and applies
|
||||
* movement direction/granularity to the end of the selection.
|
||||
* @param direction can be one of { "forward", "backward", "left", "right" }
|
||||
* @param granularity can be one of { "character", "word",
|
||||
* "line", "lineboundary" }
|
||||
*
|
||||
* @returns NS_ERROR_NOT_IMPLEMENTED if the granularity is "sentence",
|
||||
* "sentenceboundary", "paragraph", "paragraphboundary", or
|
||||
* "documentboundary". Returns NS_ERROR_INVALID_ARG if alter, direction,
|
||||
* or granularity has an unrecognized value.
|
||||
*/
|
||||
void modify(in DOMString alter, in DOMString direction,
|
||||
in DOMString granularity);
|
||||
|
||||
};
|
|
@ -38,8 +38,10 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsISelectionListener.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
#include "nsISelection.idl"
|
||||
|
||||
interface nsIDOMRange;
|
||||
interface nsIDOMNode;
|
||||
interface nsISelectionListener;
|
||||
interface nsIContent;
|
||||
|
||||
|
@ -50,17 +52,19 @@ class nsIPresShell;
|
|||
struct nsTextRangeStyle;
|
||||
struct nsPoint;
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMArray.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsFrameSelection(nsFrameSelection);
|
||||
[ptr] native nsIFrame(nsIFrame);
|
||||
[ptr] native nsIPresShell(nsIPresShell);
|
||||
[ptr] native RangeArray(nsCOMArray<nsIDOMRange>);
|
||||
[ref] native constTextRangeStyleRef(const nsTextRangeStyle);
|
||||
[ref] native nsPointRef(nsPoint);
|
||||
native nsDirection(nsDirection);
|
||||
|
||||
[scriptable, uuid(98552206-ad7a-4d2d-8ce3-b6fa2389298b)]
|
||||
interface nsISelectionPrivate : nsISupports
|
||||
[scriptable, uuid(1820a940-6203-4e27-bc94-fa81131722a4)]
|
||||
interface nsISelectionPrivate : nsISelection
|
||||
{
|
||||
const short ENDOFPRECEDINGLINE=0;
|
||||
const short STARTOFNEXTLINE=1;
|
||||
|
@ -136,5 +140,62 @@ interface nsISelectionPrivate : nsISupports
|
|||
*/
|
||||
[noscript, notxpcom] nsDirection getSelectionDirection();
|
||||
[noscript, notxpcom] void setSelectionDirection(in nsDirection aDirection);
|
||||
|
||||
/**
|
||||
* Returns the type of the selection (see nsISelectionController for
|
||||
* available constants).
|
||||
*/
|
||||
readonly attribute short type;
|
||||
|
||||
/**
|
||||
* Return array of ranges intersecting with the given DOM interval.
|
||||
*/
|
||||
void GetRangesForInterval(
|
||||
in nsIDOMNode beginNode, in PRInt32 beginOffset,
|
||||
in nsIDOMNode endNode, in PRInt32 endOffset,
|
||||
in PRBool allowAdjacent,
|
||||
out PRUint32 resultCount,
|
||||
[retval, array, size_is(resultCount)] out nsIDOMRange results);
|
||||
|
||||
[noscript] void GetRangesForIntervalCOMArray(
|
||||
in nsIDOMNode beginNode, in PRInt32 beginOffset,
|
||||
in nsIDOMNode endNode, in PRInt32 endOffset,
|
||||
in PRBool allowAdjacent,
|
||||
in RangeArray results);
|
||||
|
||||
/**
|
||||
* Scrolls a region of the selection, so that it is visible in
|
||||
* the scrolled view.
|
||||
*
|
||||
* @param aRegion - the region inside the selection to scroll into view
|
||||
* (see selection region constants defined in
|
||||
* nsISelectionController).
|
||||
* @param aIsSynchronous - when true, scrolls the selection into view
|
||||
* before returning. If false, posts a request which
|
||||
* is processed at some point after the method returns.
|
||||
* @param aVPercent - how to align the frame vertically. A value of 0
|
||||
* means the frame's upper edge is aligned with the top edge
|
||||
* of the visible area. A value of 100 means the frame's
|
||||
* bottom edge is aligned with the bottom edge of
|
||||
* the visible area. For values in between, the point
|
||||
* "aVPercent" down the frame is placed at the point
|
||||
* "aVPercent" down the visible area. A value of 50 centers
|
||||
* the frame vertically. A value of -1 means move
|
||||
* the frame the minimum amount necessary in order for
|
||||
* the entire frame to be visible vertically (if possible).
|
||||
* @param aHPercent - how to align the frame horizontally. A value of 0
|
||||
* means the frame's left edge is aligned with the left
|
||||
* edge of the visible area. A value of 100 means the
|
||||
* frame's right edge is aligned with the right edge of
|
||||
* the visible area. For values in between, the point
|
||||
* "aHPercent" across the frame is placed at the point
|
||||
* "aHPercent" across the visible area. A value of 50
|
||||
* centers the frame horizontally . A value of -1 means
|
||||
* move the frame the minimum amount necessary in order
|
||||
* for the entire frame to be visible horizontally
|
||||
* (if possible).
|
||||
*/
|
||||
void scrollIntoView(in short aRegion, in boolean aIsSynchronous,
|
||||
in short aVPercent, in short aHPercent);
|
||||
};
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче