Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Merging backout.
Browse files Browse the repository at this point in the history
  • Loading branch information
mounirlamouri committed Oct 1, 2010
2 parents 0afc4df + 7bef7e7 commit d5f1840
Show file tree
Hide file tree
Showing 3,376 changed files with 167,679 additions and 69,841 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ endif
ifeq ($(OS_ARCH),Darwin)
# need to pass arch flags for universal builds
ifdef UNIVERSAL_BINARY
MAKE_SYM_STORE_ARGS := -c -a "ppc i386" --vcs-info
MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
MAKE_SYM_STORE_PATH := $(DIST)/universal
else
MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
Expand Down
14 changes: 12 additions & 2 deletions accessible/public/nsIAccessibilityService.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ class nsIAccessibilityService : public nsIAccessibleRetrieval
virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
nsIPresShell* aPresShell) = 0;

/**
* Return root document accessible that is or contains a document accessible
* for the given presshell.
*
* @param aPresShell [in] the presshell
* @param aCanCreate [in] points whether the root document accessible
* should be returned from the cache or can be created
*/
virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
PRBool aCanCreate) = 0;

/**
* Creates accessible for the given DOM node or frame.
*/
Expand Down Expand Up @@ -170,8 +181,7 @@ class nsIAccessibilityService : public nsIAccessibleRetrieval
* @param aEvent [in] accessible event type
* @param aTarget [in] target of accessible event
*/
virtual nsresult FireAccessibleEvent(PRUint32 aEvent,
nsIAccessible *aTarget) = 0;
virtual void FireAccessibleEvent(PRUint32 aEvent, nsAccessible* aTarget) = 0;
};

NS_DEFINE_STATIC_IID_ACCESSOR(nsIAccessibilityService,
Expand Down
1 change: 1 addition & 0 deletions accessible/src/base/nsAccessibilityAtomList.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ ACCESSIBILITY_ATOM(object, "object")
ACCESSIBILITY_ATOM(ol, "ol")
ACCESSIBILITY_ATOM(optgroup, "optgroup")
ACCESSIBILITY_ATOM(option, "option")
ACCESSIBILITY_ATOM(output, "output")
ACCESSIBILITY_ATOM(panel, "panel") // XUL
ACCESSIBILITY_ATOM(q, "q")
ACCESSIBILITY_ATOM(select, "select")
Expand Down
39 changes: 34 additions & 5 deletions accessible/src/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,41 @@ nsAccessibilityService::NotifyOfAnchorJumpTo(nsIContent *aTarget)
}

// nsIAccessibilityService
nsresult
void
nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
nsIAccessible *aTarget)
nsAccessible* aTarget)
{
nsRefPtr<nsAccessible> accessible(do_QueryObject(aTarget));
nsEventShell::FireEvent(aEvent, accessible);
return NS_OK;
nsEventShell::FireEvent(aEvent, aTarget);
}

////////////////////////////////////////////////////////////////////////////////
// nsIAccessibilityService

nsAccessible*
nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
PRBool aCanCreate)
{
nsIDocument* documentNode = aPresShell->GetDocument();
if (documentNode) {
nsCOMPtr<nsISupports> container = documentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
if (treeItem) {
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
if (treeItem != rootTreeItem) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(rootTreeItem));
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
documentNode = presShell->GetDocument();
}

return aCanCreate ?
GetDocAccessible(documentNode) : GetDocAccessibleFromCache(documentNode);
}
}
return nsnull;
}

already_AddRefed<nsAccessible>
nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
Expand Down Expand Up @@ -1648,6 +1671,12 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
return accessible;
}

if (tag == nsAccessibilityAtoms::output) {
nsAccessible* accessible = new nsHTMLOutputAccessible(aContent, aWeakShell);
NS_IF_ADDREF(accessible);
return accessible;
}

return nsnull;
}

Expand Down
4 changes: 3 additions & 1 deletion accessible/src/base/nsAccessibilityService.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class nsAccessibilityService : public nsAccDocManager,
// nsIAccessibilityService
virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
nsIPresShell* aPresShell);
virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
PRBool aCanCreate);

virtual already_AddRefed<nsAccessible>
CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
Expand Down Expand Up @@ -117,7 +119,7 @@ class nsAccessibilityService : public nsAccDocManager,

virtual void PresShellDestroyed(nsIPresShell* aPresShell);

virtual nsresult FireAccessibleEvent(PRUint32 aEvent, nsIAccessible *aTarget);
virtual void FireAccessibleEvent(PRUint32 aEvent, nsAccessible* aTarget);

// nsAccessibiltiyService

Expand Down
11 changes: 10 additions & 1 deletion accessible/src/base/nsAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2158,9 +2158,18 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,

case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
{
return nsRelUtils::
nsresult rv = nsRelUtils::
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
nsAccessibilityAtoms::aria_controls);
NS_ENSURE_SUCCESS(rv,rv);

if (rv != NS_OK_NO_RELATION_TARGET)
return NS_OK; // XXX bug 381599, avoid performance problems

return nsRelUtils::
AddTargetFromNeighbour(aRelationType, aRelation, mContent,
nsAccessibilityAtoms::_for,
nsAccessibilityAtoms::output);
}

case nsIAccessibleRelation::RELATION_FLOWS_TO:
Expand Down
30 changes: 17 additions & 13 deletions accessible/src/base/nsDocAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ nsIAtom *nsDocAccessible::gLastFocusedFrameType = nsnull;
nsDocAccessible::
nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
nsIWeakReference *aShell) :
nsHyperTextAccessibleWrap(aRootContent, aShell), mWnd(nsnull),
nsHyperTextAccessibleWrap(aRootContent, aShell),
mDocument(aDocument), mScrollPositionChangedTicks(0), mIsLoaded(PR_FALSE)
{
// XXX aaronl should we use an algorithm for the initial cache size?
Expand All @@ -103,17 +103,6 @@ nsDocAccessible::
if (!mDocument)
return;

// Initialize mWnd
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (widget) {
mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
}
}

// nsAccDocManager creates document accessible when scrollable frame is
// available already, it should be safe time to add scroll listener.
AddScrollListener();
Expand Down Expand Up @@ -473,7 +462,8 @@ NS_IMETHODIMP nsDocAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAStr

NS_IMETHODIMP nsDocAccessible::GetWindowHandle(void **aWindow)
{
*aWindow = mWnd;
NS_ENSURE_ARG_POINTER(aWindow);
*aWindow = GetNativeWindow();
return NS_OK;
}

Expand Down Expand Up @@ -1335,6 +1325,20 @@ nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
////////////////////////////////////////////////////////////////////////////////
// Public members

void*
nsDocAccessible::GetNativeWindow() const
{
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (widget)
return widget->GetNativeData(NS_NATIVE_WINDOW);
}
return nsnull;
}

nsAccessible*
nsDocAccessible::GetCachedAccessibleInSubtree(void* aUniqueID)
{
Expand Down
6 changes: 5 additions & 1 deletion accessible/src/base/nsDocAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
*/
void MarkAsLoaded() { mIsLoaded = PR_TRUE; }

/**
* Return a native window handler or pointer depending on platform.
*/
virtual void* GetNativeWindow() const;

/**
* Return the parent document.
*/
Expand Down Expand Up @@ -363,7 +368,6 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
*/
nsAccessibleHashtable mAccessibleCache;

void *mWnd;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsITimer> mScrollWatchTimer;
PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events
Expand Down
52 changes: 52 additions & 0 deletions accessible/src/html/nsHTMLTextAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "nsHTMLTextAccessible.h"

#include "nsDocAccessible.h"
#include "nsAccUtils.h"
#include "nsRelUtils.h"
#include "nsTextEquivUtils.h"

#include "nsIFrame.h"
Expand Down Expand Up @@ -195,6 +197,56 @@ nsHTMLLabelAccessible::NativeRole()
return nsIAccessibleRole::ROLE_LABEL;
}

////////////////////////////////////////////////////////////////////////////////
// nsHTMLOuputAccessible
////////////////////////////////////////////////////////////////////////////////

nsHTMLOutputAccessible::
nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
nsHyperTextAccessibleWrap(aContent, aShell)
{
}

NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLOutputAccessible, nsHyperTextAccessible)

NS_IMETHODIMP
nsHTMLOutputAccessible::GetRelationByType(PRUint32 aRelationType,
nsIAccessibleRelation** aRelation)
{
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType, aRelation);
NS_ENSURE_SUCCESS(rv, rv);

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

PRUint32
nsHTMLOutputAccessible::NativeRole()
{
return nsIAccessibleRole::ROLE_SECTION;
}

nsresult
nsHTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);

nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::live,
NS_LITERAL_STRING("polite"));

return NS_OK;
}


////////////////////////////////////////////////////////////////////////////////
// nsHTMLLIAccessible
////////////////////////////////////////////////////////////////////////////////
Expand Down
19 changes: 19 additions & 0 deletions accessible/src/html/nsHTMLTextAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
virtual PRUint32 NativeRole();
};

/**
* Used for HTML output element.
*/
class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap
{
public:
nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell);

NS_DECL_ISUPPORTS_INHERITED

// nsIAccessible
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
nsIAccessibleRelation** aRelation);

// nsAccessible
virtual PRUint32 NativeRole();
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
};

/**
* Used for bullet of HTML list item element (for example, HTML li).
*/
Expand Down
8 changes: 6 additions & 2 deletions accessible/src/mac/mozAccessible.mm
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,13 @@ - (NSWindow*)window
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;

nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);

// Get a pointer to the native window (NSWindow) we reside in.
NSWindow *nativeWindow = nil;
accWrap->GetNativeWindow ((void**)&nativeWindow);

nsDocAccessible* docAcc = accWrap->GetDocAccessible();
if (docAcc)
nativeWindow = static_cast<NSWindow*>(docAcc->GetNativeWindow());

NSAssert1(nativeWindow, @"Could not get native window for %@", self);
return nativeWindow;

Expand Down
5 changes: 1 addition & 4 deletions accessible/src/mac/nsAccessibleWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ class nsAccessibleWrap : public nsAccessible
// should be instantied with. used on runtime to determine the
// right type for this accessible's associated native object.
virtual objc_class* GetNativeType ();

// returns a pointer to the native window for this accessible tree.
void GetNativeWindow (void **aOutNativeWindow);


virtual void Shutdown ();
virtual void InvalidateChildren();

Expand Down
11 changes: 0 additions & 11 deletions accessible/src/mac/nsAccessibleWrap.mm
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@
return NS_ERROR_FAILURE;
}

// get the native NSWindow we reside in.
void
nsAccessibleWrap::GetNativeWindow (void **aOutNativeWindow)
{
*aOutNativeWindow = nsnull;

nsDocAccessible *docAcc = GetDocAccessible();
if (docAcc)
docAcc->GetWindowHandle (aOutNativeWindow);
}

// overridden in subclasses to create the right kind of object. by default we create a generic
// 'mozAccessible' node.
objc_class*
Expand Down
Loading

0 comments on commit d5f1840

Please sign in to comment.