Merging mozilla-central

This commit is contained in:
Shawn Wilsher 2010-04-28 15:36:43 -07:00
commit 44b885ab10
1148 changed files with 72536 additions and 69924 deletions

View File

@ -195,7 +195,9 @@ ifdef MOZ_CRASHREPORTER
echo packing symbols
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
cd $(DIST)/crashreporter-symbols && \
zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
zip -r9D "../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
cd $(DIST)/crashreporter-symbols && \
zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" . -i "*.sym"
else
ifdef WINCE
ifdef SYMBOLSTORE_PATH
@ -215,7 +217,7 @@ endif # MOZ_CRASHREPORTER
uploadsymbols:
ifdef MOZ_CRASHREPORTER
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh "$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip"
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
endif
# defined in package-name.mk

View File

@ -52,7 +52,6 @@ GRE_MODULE = 1
XPIDLSRCS = \
nsIAccessibleTypes.idl \
nsIAccessibilityService.idl \
nsIAccessibleRetrieval.idl \
nsIAccessible.idl \
nsIAccessibleApplication.idl \
@ -74,5 +73,9 @@ XPIDLSRCS = \
nsIXBLAccessible.idl \
$(NULL)
EXPORTS = \
nsIAccessibilityService.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,177 @@
/* -*- 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 the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Eric Vaughan <evaughan@netscape.com> (original author)
* 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 ***** */
#ifndef _nsIAccessibilityService_h_
#define _nsIAccessibilityService_h_
#include "nsISupports.h"
#include "nsIAccessibleRetrieval.h"
class nsIDocument;
class nsIFrame;
class nsObjectFrame;
class nsIContent;
#define NS_IACCESSIBILITYSERVICE_IID \
{0x33fa2a8d, 0x72e5, 0x4b8b, \
{0xbb, 0x17, 0x6b, 0x22, 0x79, 0x05, 0x5c, 0x6c} }
class nsIAccessibilityService : public nsIAccessibleRetrieval
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IACCESSIBILITYSERVICE_IID)
/**
* Creates accessible for the given DOM node or frame.
*/
virtual nsresult CreateOuterDocAccessible(nsIDOMNode *aNode,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTML4ButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHyperTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLBRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLLIAccessible(nsIFrame *aFrame,
nsIFrame *aBulletFrame,
const nsAString& aBulletText,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLCheckboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLComboboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLGenericAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLGroupboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLHRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLImageAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLLabelAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLListboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLMediaAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLRadioButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLSelectOptionAccessible(nsIDOMNode *aNode,
nsIAccessible *aAccParent,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTableAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTableCellAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTextFieldAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLCaptionAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
/**
* Adds/remove ATK root accessible for gtk+ native window to/from children
* of the application accessible.
*/
virtual nsresult AddNativeRootAccessible(void *aAtkAccessible,
nsIAccessible **aAccessible) = 0;
virtual nsresult
RemoveNativeRootAccessible(nsIAccessible *aRootAccessible) = 0;
/**
* Used to describe sort of changes leading to accessible tree invalidation.
*/
enum {
NODE_APPEND = 0x01,
NODE_REMOVE = 0x02,
NODE_SIGNIFICANT_CHANGE = 0x03,
FRAME_SHOW = 0x04,
FRAME_HIDE = 0x05,
FRAME_SIGNIFICANT_CHANGE = 0x06
};
/**
* Invalidate the accessible tree when DOM tree or frame tree is changed.
*
* @param aPresShell [in] the presShell where changes occured
* @param aContent [in] the affected DOM content
* @param aChangeType [in] the change type (see constants declared above)
*/
virtual nsresult InvalidateSubtreeFor(nsIPresShell *aPresShell,
nsIContent *aContent,
PRUint32 aChangeType) = 0;
/**
* Notify accessibility that anchor jump has been accomplished to the given
* target. Used by layout.
*/
virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget) = 0;
/**
* Fire accessible event of the given type for the given target.
*
* @param aEvent [in] accessible event type
* @param aTarget [in] target of accessible event
*/
virtual nsresult FireAccessibleEvent(PRUint32 aEvent,
nsIAccessible *aTarget) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIAccessibilityService,
NS_IACCESSIBILITYSERVICE_IID)
// for component registration
// {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
#define NS_ACCESSIBILITY_SERVICE_CID \
{ 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } }
extern nsresult
NS_GetAccessibilityService(nsIAccessibilityService** aResult);
#endif

View File

@ -1,125 +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 the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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"
#include "nsIAccessibleRetrieval.idl"
interface nsIDocument;
interface nsIFrame;
interface nsObjectFrame;
interface nsIContent;
[uuid(4df7499d-d96e-48f8-a936-8a22ec0d4915)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
nsIAccessible createHTML4ButtonAccessible(in nsIFrame aFrame);
nsIAccessible createHyperTextAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLBRAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLButtonAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLLIAccessible(in nsIFrame aFrame, in nsIFrame aBulletFrame, in AString aBulletText);
nsIAccessible createHTMLCheckboxAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLGenericAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLGroupboxAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLHRAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLImageAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLLabelAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLMediaAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLObjectFrameAccessible(in nsObjectFrame aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell);
nsIAccessible createHTMLTableAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTextAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLCaptionAccessible(in nsIFrame aFrame);
// For gtk+ native window accessible
nsIAccessible addNativeRootAccessible(in voidPtr aAtkAccessible);
void removeNativeRootAccessible(in nsIAccessible aRootAccessible);
/**
* Used to describe sort of changes leading to accessible tree invalidation.
*/
const unsigned long NODE_APPEND = 0x01;
const unsigned long NODE_REMOVE = 0x02;
const unsigned long NODE_SIGNIFICANT_CHANGE = 0x03;
const unsigned long FRAME_SHOW = 0x04;
const unsigned long FRAME_HIDE = 0x05;
const unsigned long FRAME_SIGNIFICANT_CHANGE = 0x06;
/**
* Invalidate the accessible tree when DOM tree or frame tree is changed.
*
* @param aPresShell [in] the presShell where changes occured
* @param aContent [in] the affected DOM content
* @param aChangeType [in] the change type (see constants declared above)
*/
void invalidateSubtreeFor(in nsIPresShell aPresShell, in nsIContent aContent,
in PRUint32 aChangeType);
/**
* Notify accessibility that anchor jump has been accomplished to the given
* target. Used by layout.
*/
void notifyOfAnchorJumpTo(in nsIContent aTarget);
/**
* Fire accessible event of the given type for the given target.
*
* @param aEvent [in] accessible event type
* @param aTarget [in] target of accessible event
*/
void fireAccessibleEvent(in unsigned long aEvent, in nsIAccessible aTarget);
};
%{ C++
// for component registration
// {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
#define NS_ACCESSIBILITY_SERVICE_CID \
{ 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } }
extern nsresult
NS_GetAccessibilityService(nsIAccessibilityService** aResult);
%}

View File

@ -58,7 +58,7 @@ interface nsIDOMWindow;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(427597a3-1737-4743-bf43-2311a1ed5fbd)]
[scriptable, uuid(471909e7-0ea4-4ce0-bf31-a1372b2b285c)]
interface nsIAccessibleDocument : nsISupports
{
/**
@ -84,7 +84,7 @@ interface nsIAccessibleDocument : nsISupports
/**
* The nsIDOMDocument interface associated with this document.
*/
readonly attribute nsIDOMDocument document;
readonly attribute nsIDOMDocument DOMDocument;
/**
* The nsIDOMWindow that the document resides in.

View File

@ -40,6 +40,8 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsRootAccessible.h"
#include "nsDocAccessibleWrap.h"
@ -48,6 +50,7 @@
#include "nsAutoPtr.h"
#include "prprf.h"
#include "nsRoleMap.h"
#include "nsRelUtils.h"
#include "nsStateMap.h"
#include "nsMaiInterfaceComponent.h"
@ -1155,7 +1158,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
if (rootAccWrap && rootAccWrap->mActivated) {
atk_focus_tracker_notify(atkObj);
// Fire state change event for focus
nsCOMPtr<nsIAccessibleEvent> stateChangeEvent =
nsRefPtr<nsAccEvent> stateChangeEvent =
new nsAccStateChangeEvent(accessible,
nsIAccessibleStates::STATE_FOCUSED,
PR_FALSE, PR_TRUE);
@ -1383,7 +1386,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
}
nsresult
nsAccessibleWrap::FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
nsAccessibleWrap::FireAtkStateChangeEvent(nsAccEvent *aEvent,
AtkObject *aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
@ -1425,7 +1428,7 @@ nsAccessibleWrap::FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
}
nsresult
nsAccessibleWrap::FireAtkTextChangedEvent(nsIAccessibleEvent *aEvent,
nsAccessibleWrap::FireAtkTextChangedEvent(nsAccEvent *aEvent,
AtkObject *aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_REMOVED/INSERTED\n"));
@ -1443,8 +1446,7 @@ nsAccessibleWrap::FireAtkTextChangedEvent(nsIAccessibleEvent *aEvent,
PRBool isInserted;
event->IsInserted(&isInserted);
PRBool isFromUserInput;
aEvent->GetIsFromUserInput(&isFromUserInput);
PRBool isFromUserInput = aEvent->IsFromUserInput();
char *signal_name = g_strconcat(isInserted ? "text_changed::insert" : "text_changed::delete",
isFromUserInput ? "" : kNonUserInputEvent, NULL);
@ -1455,7 +1457,7 @@ nsAccessibleWrap::FireAtkTextChangedEvent(nsIAccessibleEvent *aEvent,
}
nsresult
nsAccessibleWrap::FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
nsAccessibleWrap::FireAtkShowHideEvent(nsAccEvent *aEvent,
AtkObject *aObject, PRBool aIsAdded)
{
if (aIsAdded)
@ -1467,8 +1469,7 @@ nsAccessibleWrap::FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
AtkObject *parentObject = getParentCB(aObject);
NS_ENSURE_STATE(parentObject);
PRBool isFromUserInput;
aEvent->GetIsFromUserInput(&isFromUserInput);
PRBool isFromUserInput = aEvent->IsFromUserInput();
char *signal_name = g_strconcat(aIsAdded ? "children_changed::add" : "children_changed::remove",
isFromUserInput ? "" : kNonUserInputEvent, NULL);
g_signal_emit_by_name(parentObject, signal_name, indexInParent, aObject, NULL);

View File

@ -120,14 +120,10 @@ public:
protected:
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject);
nsresult FireAtkTextChangedEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject);
nsresult FireAtkPropChangedEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject);
nsresult FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject, PRBool aIsAdded);
nsresult FireAtkStateChangeEvent(nsAccEvent *aEvent, AtkObject *aObject);
nsresult FireAtkTextChangedEvent(nsAccEvent *aEvent, AtkObject *aObject);
nsresult FireAtkShowHideEvent(nsAccEvent *aEvent, AtkObject *aObject,
PRBool aIsAdded);
AtkObject *mAtkObject;

View File

@ -40,9 +40,12 @@
#include "nsMaiInterfaceAction.h"
#include "nsAccUtils.h"
#include "nsRoleMap.h"
#include "nsString.h"
#include "nsIDOMDOMStringList.h"
void
actionInterfaceInitCB(AtkActionIface *aIface)
{

View File

@ -39,7 +39,11 @@
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceComponent.h"
#include "nsAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"

View File

@ -40,6 +40,8 @@
#include "nsMaiInterfaceTable.h"
#include "nsAccUtils.h"
#include "nsArrayUtils.h"
void

View File

@ -74,7 +74,8 @@ CPPSRCS = \
$(NULL)
EXPORTS = \
nsRootAccessible.h \
a11yGeneric.h \
nsAccessible.h \
nsAccessNode.h \
$(NULL)

View File

@ -0,0 +1,198 @@
/* -*- 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 Corporation.
* Portions created by the Initial Developer are Copyright (C) 2010
* 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 _a11yGeneric_H_
#define _a11yGeneric_H_
#include "nsThreadUtils.h"
// What we want is: NS_INTERFACE_MAP_ENTRY(self) for static IID accessors,
// but some of our classes have an ambiguous base class of nsISupports which
// prevents this from working (the default macro converts it to nsISupports,
// then addrefs it, then returns it). Therefore, we expand the macro here and
// change it so that it works. Yuck.
#define NS_INTERFACE_MAP_STATIC_AMBIGUOUS(_class) \
if (aIID.Equals(NS_GET_IID(_class))) { \
NS_ADDREF(this); \
*aInstancePtr = this; \
return NS_OK; \
} else
#define NS_OK_DEFUNCT_OBJECT \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x22)
#define NS_ENSURE_A11Y_SUCCESS(res, ret) \
PR_BEGIN_MACRO \
nsresult __rv = res; /* Don't evaluate |res| more than once */ \
if (NS_FAILED(__rv)) { \
NS_ENSURE_SUCCESS_BODY(res, ret) \
return ret; \
} \
if (__rv == NS_OK_DEFUNCT_OBJECT) \
return ret; \
PR_END_MACRO
////////////////////////////////////////////////////////////////////////////////
// nsRunnable helpers
////////////////////////////////////////////////////////////////////////////////
/**
* Use NS_DECL_RUNNABLEMETHOD_ macros to declare a runnable class for the given
* method of the given class. There are three macros:
* NS_DECL_RUNNABLEMETHOD(Class, Method)
* NS_DECL_RUNNABLEMETHOD_ARG1(Class, Method, Arg1Type)
* NS_DECL_RUNNABLEMETHOD_ARG2(Class, Method, Arg1Type, Arg2Type)
* Note Arg1Type and Arg2Type must be types which keeps the objects alive.
*
* Use NS_DISPATCH_RUNNABLEMETHOD_ macros to create an instance of declared
* runnable class and dispatch it to main thread. Availabe macros are:
* NS_DISPATCH_RUNNABLEMETHOD(Method, Object)
* NS_DISPATCH_RUNNABLEMETHOD_ARG1(Method, Object, Arg1)
* NS_DISPATCH_RUNNABLEMETHOD_ARG2(Method, Object, Arg1, Arg2)
*/
#define NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
void Revoke() \
{ \
NS_IF_RELEASE(mObj); \
} \
\
protected: \
virtual ~nsRunnableMethod_##Method() \
{ \
NS_IF_RELEASE(mObj); \
} \
\
private: \
ClassType *mObj; \
#define NS_DECL_RUNNABLEMETHOD(ClassType, Method) \
class nsRunnableMethod_##Method : public nsRunnable \
{ \
public: \
nsRunnableMethod_##Method(ClassType *aObj) : mObj(aObj) \
{ \
NS_IF_ADDREF(mObj); \
} \
\
NS_IMETHODIMP Run() \
{ \
if (!mObj) \
return NS_OK; \
(mObj-> Method)(); \
return NS_OK; \
} \
\
NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
\
};
#define NS_DECL_RUNNABLEMETHOD_ARG1(ClassType, Method, Arg1Type) \
class nsRunnableMethod_##Method : public nsRunnable \
{ \
public: \
nsRunnableMethod_##Method(ClassType *aObj, Arg1Type aArg1) : \
mObj(aObj), mArg1(aArg1) \
{ \
NS_IF_ADDREF(mObj); \
} \
\
NS_IMETHODIMP Run() \
{ \
if (!mObj) \
return NS_OK; \
(mObj-> Method)(mArg1); \
return NS_OK; \
} \
\
NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
Arg1Type mArg1; \
};
#define NS_DECL_RUNNABLEMETHOD_ARG2(ClassType, Method, Arg1Type, Arg2Type) \
class nsRunnableMethod_##Method : public nsRunnable \
{ \
public: \
\
nsRunnableMethod_##Method(ClassType *aObj, \
Arg1Type aArg1, Arg2Type aArg2) : \
mObj(aObj), mArg1(aArg1), mArg2(aArg2) \
{ \
NS_IF_ADDREF(mObj); \
} \
\
NS_IMETHODIMP Run() \
{ \
if (!mObj) \
return NS_OK; \
(mObj-> Method)(mArg1, mArg2); \
return NS_OK; \
} \
\
NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
Arg1Type mArg1; \
Arg2Type mArg2; \
};
#define NS_DISPATCH_RUNNABLEMETHOD(Method, Obj) \
{ \
nsCOMPtr<nsIRunnable> runnable = \
new nsRunnableMethod_##Method(Obj); \
if (runnable) \
NS_DispatchToMainThread(runnable); \
}
#define NS_DISPATCH_RUNNABLEMETHOD_ARG1(Method, Obj, Arg1) \
{ \
nsCOMPtr<nsIRunnable> runnable = \
new nsRunnableMethod_##Method(Obj, Arg1); \
if (runnable) \
NS_DispatchToMainThread(runnable); \
}
#define NS_DISPATCH_RUNNABLEMETHOD_ARG2(Method, Obj, Arg1, Arg2) \
{ \
nsCOMPtr<nsIRunnable> runnable = \
new nsRunnableMethod_##Method(Obj, Arg1, Arg2); \
if (runnable) \
NS_DispatchToMainThread(runnable); \
}
#endif

View File

@ -38,6 +38,9 @@
#include "nsARIAGridAccessible.h"
#include "nsAccUtils.h"
#include "nsIMutableArray.h"
#include "nsComponentManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
@ -765,7 +768,7 @@ nsresult
nsARIAGridAccessible::SetARIASelected(nsIAccessible *aAccessible,
PRBool aIsSelected, PRBool aNotify)
{
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessible);
nsRefPtr<nsAccessible> acc = do_QueryObject(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ENSURE_STATE(node);
@ -1097,7 +1100,7 @@ nsARIAGridCellAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(row);
nsRefPtr<nsAccessible> acc = do_QueryObject(row);
nsCOMPtr<nsIDOMNode> rowNode;
acc->GetDOMNode(getter_AddRefs(rowNode));
NS_ENSURE_STATE(rowNode);

View File

@ -42,15 +42,11 @@
#include "nsRefPtrHashtable.h"
#include "nsCycleCollectionParticipant.h"
class nsAccessNode;
class nsAccessible;
class nsIAccessNode;
typedef nsRefPtrHashtable<nsVoidPtrHashKey, nsAccessNode>
nsAccessNodeHashtable;
typedef nsRefPtrHashtable<nsVoidPtrHashKey, nsAccessible>
nsAccessibleHashtable;
////////////////////////////////////////////////////////////////////////////////
// Accessible cache utils
////////////////////////////////////////////////////////////////////////////////
/**
* Shutdown and removes the accessible from cache.

View File

@ -38,8 +38,14 @@
#include "nsAccEvent.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsDocAccessible.h"
#include "nsIAccessibleText.h"
#ifdef MOZ_XUL
#include "nsXULTreeAccessible.h"
#endif
#include "nsIDOMDocument.h"
#include "nsIEventStateManager.h"
@ -47,9 +53,7 @@
#include "nsIServiceManager.h"
#ifdef MOZ_XUL
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsXULTreeAccessible.h"
#endif
#include "nsIAccessibleText.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
@ -193,15 +197,10 @@ nsAccEvent::GetAccessibleByNode()
if (!mNode)
return nsnull;
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (!accService)
return nsnull;
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mNode));
nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleFor(DOMNode, getter_AddRefs(accessible));
GetAccService()->GetAccessibleFor(DOMNode, getter_AddRefs(accessible));
#ifdef MOZ_XUL
// hack for xul tree table. We need a better way for firing delayed event
@ -219,8 +218,7 @@ nsAccEvent::GetAccessibleByNode()
PRInt32 treeIndex = -1;
multiSelect->GetCurrentIndex(&treeIndex);
if (treeIndex >= 0) {
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(accessible);
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
if (treeAcc)
accessible = treeAcc->GetTreeItemAccessible(treeIndex);
}

View File

@ -42,13 +42,14 @@
#include "nsIAccessibleStates.h"
#include "nsIAccessibleTypes.h"
#include "nsAccessibilityService.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccessible.h"
#include "nsAccTreeWalker.h"
#include "nsARIAMap.h"
#include "nsDocAccessible.h"
#include "nsHyperTextAccessible.h"
#include "nsHTMLTableAccessible.h"
#include "nsDocAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccTreeWalker.h"
#include "nsAccessible.h"
#include "nsARIAMap.h"
#include "nsXULTreeGridAccessible.h"
#include "nsIDOMXULContainerElement.h"
@ -528,7 +529,7 @@ nsAccUtils::GetMultiSelectableContainer(nsIDOMNode *aNode)
PRBool
nsAccUtils::IsARIASelected(nsIAccessible *aAccessible)
{
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessible);
nsRefPtr<nsAccessible> acc = do_QueryObject(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ASSERTION(node, "No DOM node!");
@ -686,11 +687,11 @@ nsAccUtils::GetScreenCoordsForParent(nsIAccessNode *aAccessNode)
if (accessible) {
nsCOMPtr<nsIAccessible> parentAccessible;
accessible->GetParent(getter_AddRefs(parentAccessible));
parent = nsAccUtils::QueryAccessNode(parentAccessible);
parent = do_QueryObject(parentAccessible);
} else {
nsCOMPtr<nsIAccessNode> parentAccessNode;
aAccessNode->GetParentNode(getter_AddRefs(parentAccessNode));
parent = nsAccUtils::QueryAccessNode(parentAccessNode);
parent = do_QueryObject(parentAccessNode);
}
if (!parent)
@ -785,68 +786,6 @@ nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
return PR_FALSE;
}
already_AddRefed<nsAccessible>
nsAccUtils::QueryAccessible(nsIAccessible *aAccessible)
{
nsAccessible* acc = nsnull;
if (aAccessible)
CallQueryInterface(aAccessible, &acc);
return acc;
}
already_AddRefed<nsAccessible>
nsAccUtils::QueryAccessible(nsIAccessNode *aAccessNode)
{
nsAccessible* acc = nsnull;
if (aAccessNode)
CallQueryInterface(aAccessNode, &acc);
return acc;
}
already_AddRefed<nsHTMLTableAccessible>
nsAccUtils::QueryAccessibleTable(nsIAccessibleTable *aAccessibleTable)
{
nsHTMLTableAccessible* accessible = nsnull;
if (aAccessibleTable)
CallQueryInterface(aAccessibleTable, &accessible);
return accessible;
}
already_AddRefed<nsDocAccessible>
nsAccUtils::QueryAccessibleDocument(nsIAccessible *aAccessible)
{
nsDocAccessible* accessible = nsnull;
if (aAccessible)
CallQueryInterface(aAccessible, &accessible);
return accessible;
}
already_AddRefed<nsDocAccessible>
nsAccUtils::QueryAccessibleDocument(nsIAccessibleDocument *aAccessibleDocument)
{
nsDocAccessible* accessible = nsnull;
if (aAccessibleDocument)
CallQueryInterface(aAccessibleDocument, &accessible);
return accessible;
}
#ifdef MOZ_XUL
already_AddRefed<nsXULTreeAccessible>
nsAccUtils::QueryAccessibleTree(nsIAccessible *aAccessible)
{
nsXULTreeAccessible* accessible = nsnull;
if (aAccessible)
CallQueryInterface(aAccessible, &accessible);
return accessible;
}
#endif
#ifdef DEBUG_A11Y
PRBool
@ -889,7 +828,7 @@ nsAccUtils::TextLength(nsIAccessible *aAccessible)
if (!IsText(aAccessible))
return 1;
nsRefPtr<nsAccessNode> accNode = nsAccUtils::QueryAccessNode(aAccessible);
nsRefPtr<nsAccessNode> accNode = do_QueryObject(aAccessible);
nsIFrame *frame = accNode->GetFrame();
if (frame && frame->GetType() == nsAccessibilityAtoms::textFrame) {
@ -908,7 +847,7 @@ nsAccUtils::TextLength(nsIAccessible *aAccessible)
// text. They don't have their own frame.
// XXX In the future, list bullets may have frame and anon content, so
// we should be able to remove this at that point
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(aAccessible));
nsRefPtr<nsAccessible> acc(do_QueryObject(aAccessible));
nsAutoString text;
acc->AppendTextTo(text, 0, PR_UINT32_MAX); // Get all the text

View File

@ -350,83 +350,6 @@ public:
return object;
}
/**
* Query nsAccessNode from the given nsIAccessible.
*/
static already_AddRefed<nsAccessNode>
QueryAccessNode(nsIAccessible *aAccessible)
{
nsAccessNode* accessNode = nsnull;
if (aAccessible)
CallQueryInterface(aAccessible, &accessNode);
return accessNode;
}
/**
* Query nsAccessNode from the given nsIAccessNode.
*/
static already_AddRefed<nsAccessNode>
QueryAccessNode(nsIAccessNode *aAccessNode)
{
nsAccessNode* accessNode = nsnull;
if (aAccessNode)
CallQueryInterface(aAccessNode, &accessNode);
return accessNode;
}
/**
* Query nsAccessNode from the given nsIAccessNode.
*/
static already_AddRefed<nsAccessNode>
QueryAccessNode(nsIAccessibleDocument *aAccessibleDocument)
{
nsAccessNode* accessNode = nsnull;
if (aAccessibleDocument)
CallQueryInterface(aAccessibleDocument, &accessNode);
return accessNode;
}
/**
* Query nsAccessible from the given nsIAccessible.
*/
static already_AddRefed<nsAccessible>
QueryAccessible(nsIAccessible *aAccessible);
/**
* Query nsAccessible from the given nsIAccessNode.
*/
static already_AddRefed<nsAccessible>
QueryAccessible(nsIAccessNode *aAccessNode);
/**
* Query nsHTMLTableAccessible from the given nsIAccessibleTable.
*/
static already_AddRefed<nsHTMLTableAccessible>
QueryAccessibleTable(nsIAccessibleTable *aAccessibleTable);
/**
* Query nsDocAccessible from the given nsIAccessible.
*/
static already_AddRefed<nsDocAccessible>
QueryAccessibleDocument(nsIAccessible *aAccessible);
/**
* Query nsDocAccessible from the given nsIAccessibleDocument.
*/
static already_AddRefed<nsDocAccessible>
QueryAccessibleDocument(nsIAccessibleDocument *aAccessibleDocument);
#ifdef MOZ_XUL
/**
* Query nsXULTreeAccessible from the given nsIAccessible.
*/
static already_AddRefed<nsXULTreeAccessible>
QueryAccessibleTree(nsIAccessible *aAccessible);
#endif
#ifdef DEBUG_A11Y
/**
* Detect whether the given accessible object implements nsIAccessibleText,

View File

@ -37,8 +37,14 @@
* ***** END LICENSE BLOCK ***** */
#include "nsDocAccessible.h"
#include "nsIAccessible.h"
#include "nsAccCache.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsHashtable.h"
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
@ -46,7 +52,6 @@
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
@ -166,8 +171,7 @@ nsAccessNode::Init()
void* uniqueID;
GetUniqueID(&uniqueID);
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(docAccessible);
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(docAccessible);
NS_ASSERTION(docAcc, "No nsDocAccessible for document accessible!");
if (!docAcc->CacheAccessNode(uniqueID, this))
@ -506,11 +510,10 @@ nsAccessNode::MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode)
GetAccService()->GetCachedAccessNode(aNode, mWeakShell);
if (!accessNode) {
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleInWeakShell(aNode, mWeakShell,
getter_AddRefs(accessible));
nsRefPtr<nsAccessible> accessible =
GetAccService()->GetAccessibleInWeakShell(aNode, mWeakShell);
accessNode = do_QueryInterface(accessible);
accessNode = accessible;
}
if (accessNode) {

View File

@ -43,58 +43,35 @@
#ifndef _nsAccessNode_H_
#define _nsAccessNode_H_
#include "nsAccCache.h"
#include "nsAccessibilityAtoms.h"
#include "nsCoreUtils.h"
#include "nsAccUtils.h"
#include "nsIAccessibleTypes.h"
#include "nsIAccessNode.h"
#include "nsIAccessibleTypes.h"
#include "a11yGeneric.h"
#include "nsIContent.h"
#include "nsIDOMNode.h"
#include "nsINameSpaceManager.h"
#include "nsIStringBundle.h"
#include "nsRefPtrHashtable.h"
#include "nsWeakReference.h"
#include "nsAccessibilityService.h"
class nsAccessNode;
class nsApplicationAccessible;
class nsDocAccessible;
class nsIAccessibleDocument;
class nsRootAccessible;
class nsIPresShell;
class nsPresContext;
class nsIAccessibleDocument;
class nsIFrame;
class nsIDOMNodeList;
class nsRootAccessible;
class nsApplicationAccessible;
class nsIDocShellTreeItem;
typedef nsRefPtrHashtable<nsVoidPtrHashKey, nsAccessNode>
nsAccessNodeHashtable;
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
// What we want is: NS_INTERFACE_MAP_ENTRY(self) for static IID accessors,
// but some of our classes have an ambiguous base class of nsISupports which
// prevents this from working (the default macro converts it to nsISupports,
// then addrefs it, then returns it). Therefore, we expand the macro here and
// change it so that it works. Yuck.
#define NS_INTERFACE_MAP_STATIC_AMBIGUOUS(_class) \
if (aIID.Equals(NS_GET_IID(_class))) { \
NS_ADDREF(this); \
*aInstancePtr = this; \
return NS_OK; \
} else
#define NS_OK_DEFUNCT_OBJECT \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x22)
#define NS_ENSURE_A11Y_SUCCESS(res, ret) \
PR_BEGIN_MACRO \
nsresult __rv = res; /* Don't evaluate |res| more than once */ \
if (NS_FAILED(__rv)) { \
NS_ENSURE_SUCCESS_BODY(res, ret) \
return ret; \
} \
if (__rv == NS_OK_DEFUNCT_OBJECT) \
return ret; \
PR_END_MACRO
#define NS_ACCESSNODE_IMPL_CID \
{ /* 2b07e3d7-00b3-4379-aa0b-ea22e2c8ffda */ \
0x2b07e3d7, \

View File

@ -246,45 +246,56 @@ nsAccessibilityService::ProcessDocLoadEvent(nsIWebProgress *aWebProgress,
nsCOMPtr<nsIAccessible> accessible;
GetAccessibleFor(docNode, getter_AddRefs(accessible));
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(accessible);
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(accessible);
NS_ENSURE_TRUE(docAcc,);
docAcc->FireDocLoadEvents(aEventType);
}
// nsIAccessibilityService
NS_IMETHODIMP
void
nsAccessibilityService::NotifyOfAnchorJumpTo(nsIContent *aTarget)
{
nsIDocument *document = aTarget->GetCurrentDoc();
nsCOMPtr<nsIDOMNode> documentNode(do_QueryInterface(document));
if (!documentNode)
return;
nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(aTarget));
nsCOMPtr<nsIAccessible> targetAcc;
GetAccessibleFor(targetNode, getter_AddRefs(targetAcc));
// Getting the targetAcc above will have ensured accessible doc creation.
// XXX Bug 561683
nsRefPtr<nsDocAccessible> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(documentNode);
if (!accessibleDoc)
return;
// If the jump target is not accessible then fire an event for nearest
// accessible in parent chain.
if (!targetAcc) {
nsIDocument *document = aTarget->GetCurrentDoc();
nsCOMPtr<nsIDOMNode> documentNode(do_QueryInterface(document));
if (documentNode) {
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(documentNode);
if (accessibleDoc)
accessibleDoc->GetAccessibleInParentChain(targetNode, PR_TRUE,
getter_AddRefs(targetAcc));
}
nsCOMPtr<nsIAccessNode> accNode = do_QueryInterface(targetAcc);
accNode->GetDOMNode(getter_AddRefs(targetNode));
}
if (targetAcc)
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SCROLLING_START,
targetAcc);
NS_ASSERTION(targetNode,
"No accessible in parent chain!? Expect at least a document accessible.");
if (!targetNode)
return;
return NS_OK;
// XXX note in rare cases the node could go away before we flush the queue,
// for example if the node becomes inaccessible, or is removed from the DOM.
accessibleDoc->FireDelayedAccessibleEvent(
nsIAccessibleEvent::EVENT_SCROLLING_START,
targetNode);
}
// nsIAccessibilityService
NS_IMETHODIMP
nsresult
nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
nsIAccessible *aTarget)
{
@ -382,7 +393,7 @@ nsAccessibilityService::GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **a
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibilityService
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateOuterDocAccessible(nsIDOMNode* aDOMNode,
nsIAccessible **aOuterDocAccessible)
{
@ -464,7 +475,7 @@ nsAccessibilityService::CreateDocOrRootAccessible(nsIPresShell *aShell,
/**
* HTML widget creation
*/
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTML4ButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -481,7 +492,7 @@ nsAccessibilityService::CreateHTML4ButtonAccessible(nsIFrame *aFrame, nsIAccessi
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -569,7 +580,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame *aFrame,
return accessible.forget();
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLLIAccessible(nsIFrame *aFrame,
nsIFrame *aBulletFrame,
const nsAString& aBulletText,
@ -589,7 +600,7 @@ nsAccessibilityService::CreateHTMLLIAccessible(nsIFrame *aFrame,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHyperTextAccessible(nsIFrame *aFrame, nsIAccessible **aAccessible)
{
nsCOMPtr<nsIDOMNode> node;
@ -608,7 +619,7 @@ nsAccessibilityService::CreateHyperTextAccessible(nsIFrame *aFrame, nsIAccessibl
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -625,7 +636,7 @@ nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIFrame *aFrame, nsIAccess
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aPresShell, nsIAccessible **_retval)
{
*_retval = new nsHTMLComboboxAccessible(aDOMNode, aPresShell);
@ -636,7 +647,7 @@ nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWe
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLImageAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible)
{
@ -680,13 +691,13 @@ nsAccessibilityService::CreateHTMLImageAccessible(nsIFrame *aFrame,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLGenericAccessible(nsIFrame *aFrame, nsIAccessible **aAccessible)
{
return CreateHyperTextAccessible(aFrame, aAccessible);
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -703,7 +714,7 @@ nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIFrame *aFrame, nsIAccess
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aPresShell, nsIAccessible **_retval)
{
*_retval = new nsHTMLSelectListAccessible(aDOMNode, aPresShell);
@ -714,7 +725,7 @@ nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWea
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLMediaAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible)
{
@ -744,7 +755,7 @@ nsAccessibilityService::CreateHTMLMediaAccessible(nsIFrame *aFrame,
* 3) An image or imagemap, where the image frame points back to
* the object element DOMNode
*/
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsIAccessible **aAccessible)
{
@ -793,7 +804,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -810,7 +821,7 @@ nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIFrame *aFrame, nsIAcc
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode,
nsIAccessible *aParent,
nsIWeakReference* aPresShell,
@ -824,7 +835,7 @@ nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLTableAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -841,7 +852,7 @@ nsAccessibilityService::CreateHTMLTableAccessible(nsIFrame *aFrame, nsIAccessibl
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible)
{
@ -859,7 +870,7 @@ nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLTextAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
*_retval = nsnull;
@ -879,7 +890,7 @@ nsAccessibilityService::CreateHTMLTextAccessible(nsIFrame *aFrame, nsIAccessible
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -896,7 +907,7 @@ nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIFrame *aFrame, nsIAcces
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLLabelAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -913,7 +924,7 @@ nsAccessibilityService::CreateHTMLLabelAccessible(nsIFrame *aFrame, nsIAccessibl
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLHRAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -930,7 +941,7 @@ nsAccessibilityService::CreateHTMLHRAccessible(nsIFrame *aFrame, nsIAccessible *
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLBRAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -947,7 +958,7 @@ nsAccessibilityService::CreateHTMLBRAccessible(nsIFrame *aFrame, nsIAccessible *
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsAccessibilityService::CreateHTMLCaptionAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> node;
@ -1233,25 +1244,15 @@ nsAccessibilityService::GetAccessibleInShell(nsIDOMNode *aNode,
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService public
nsresult
already_AddRefed<nsAccessible>
nsAccessibilityService::GetAccessibleInWeakShell(nsIDOMNode *aNode,
nsIWeakReference *aWeakShell,
nsIAccessible **aAccessible)
nsIWeakReference *aWeakShell)
{
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nsnull;
NS_ENSURE_ARG(aNode);
NS_ENSURE_ARG(aWeakShell);
if (!aNode || !aWeakShell)
return nsnull;
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(aWeakShell));
nsRefPtr<nsAccessible> accessible =
GetAccessible(aNode, presShell, aWeakShell);
if (accessible)
CallQueryInterface(accessible.get(), aAccessible);
return NS_OK;
return GetAccessible(aNode, presShell, aWeakShell);
}
////////////////////////////////////////////////////////////////////////////////
@ -1496,9 +1497,8 @@ nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
if (tableFrame->GetType() == nsAccessibilityAtoms::tableOuterFrame) {
nsCOMPtr<nsIDOMNode> tableNode(do_QueryInterface(tableContent));
nsCOMPtr<nsIAccessible> tableAccessible;
GetAccessibleInWeakShell(tableNode, aWeakShell,
getter_AddRefs(tableAccessible));
nsRefPtr<nsAccessible> tableAccessible =
GetAccessibleInWeakShell(tableNode, aWeakShell);
if (tableAccessible) {
if (!roleMapEntry) {
@ -2037,7 +2037,9 @@ nsAccessibilityService::CreateAccessibleByType(nsIDOMNode *aNode,
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibilityService (DON'T put methods here)
NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessible, nsIAccessible **aRootAccessible)
nsresult
nsAccessibilityService::AddNativeRootAccessible(void *aAtkAccessible,
nsIAccessible **aRootAccessible)
{
#ifdef MOZ_ACCESSIBILITY_ATK
nsNativeRootAccessibleWrap* rootAccWrap =
@ -2058,7 +2060,8 @@ NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessi
#endif
}
NS_IMETHODIMP nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible * aRootAccessible)
nsresult
nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible *aRootAccessible)
{
#ifdef MOZ_ACCESSIBILITY_ATK
void* atkAccessible;
@ -2077,7 +2080,7 @@ NS_IMETHODIMP nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible *
}
// Called from layout when the frame tree owned by a node changes significantly
NS_IMETHODIMP
nsresult
nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell,
nsIContent *aChangeContent,
PRUint32 aChangeType)
@ -2094,8 +2097,7 @@ nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell,
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(aShell->GetDocument());
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(accessibleDoc);
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(accessibleDoc);
if (docAcc)
docAcc->InvalidateCacheSubtree(aChangeContent, aChangeType);

View File

@ -41,6 +41,7 @@
#include "nsIAccessibilityService.h"
#include "a11yGeneric.h"
#include "nsCoreUtils.h"
#include "nsCOMArray.h"
@ -71,10 +72,77 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLERETRIEVAL
NS_DECL_NSIACCESSIBILITYSERVICE
NS_DECL_NSIOBSERVER
NS_DECL_NSIWEBPROGRESSLISTENER
// nsIAccessibilityService
virtual nsresult CreateOuterDocAccessible(nsIDOMNode *aNode,
nsIAccessible **aAccessible);
virtual nsresult CreateHTML4ButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHyperTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLBRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLLIAccessible(nsIFrame *aFrame,
nsIFrame *aBulletFrame,
const nsAString& aBulletText,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLCheckboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLComboboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLGenericAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLGroupboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLHRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLImageAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLLabelAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLListboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLMediaAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLRadioButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLSelectOptionAccessible(nsIDOMNode *aNode,
nsIAccessible *aAccParent,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTableAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTableCellAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTextFieldAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLCaptionAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult AddNativeRootAccessible(void *aAtkAccessible,
nsIAccessible **aAccessible);
virtual nsresult RemoveNativeRootAccessible(nsIAccessible *aRootAccessible);
virtual nsresult InvalidateSubtreeFor(nsIPresShell *aPresShell,
nsIContent *aContent,
PRUint32 aChangeType);
virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget);
virtual nsresult FireAccessibleEvent(PRUint32 aEvent, nsIAccessible *aTarget);
// nsAccessibiltiyService
/**
* Return presentation shell for the given node.
*
@ -106,11 +174,9 @@ public:
*
* @param aNode [in] the given node.
* @param aPresShell [in] the presentation shell of the given node.
* @param aAccessible [out] the nsIAccessible for the given node.
*/
nsresult GetAccessibleInWeakShell(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
already_AddRefed<nsAccessible>
GetAccessibleInWeakShell(nsIDOMNode *aNode, nsIWeakReference *aPresShell);
/**
* Return an access node for the DOM node in the given presentation shell if

View File

@ -41,9 +41,15 @@
#include "nsIXBLAccessible.h"
#include "nsAccTreeWalker.h"
#include "nsAccessibleRelation.h"
#include "nsAccUtils.h"
#include "nsARIAMap.h"
#include "nsDocAccessible.h"
#include "nsEventShell.h"
#include "nsAccessibilityService.h"
#include "nsAccTreeWalker.h"
#include "nsRelUtils.h"
#include "nsTextEquivUtils.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
@ -95,50 +101,6 @@
#include "nsIDOMCharacterData.h"
#endif
/**
* nsAccessibleDOMStringList implementation
*/
nsAccessibleDOMStringList::nsAccessibleDOMStringList()
{
}
nsAccessibleDOMStringList::~nsAccessibleDOMStringList()
{
}
NS_IMPL_ISUPPORTS1(nsAccessibleDOMStringList, nsIDOMDOMStringList)
NS_IMETHODIMP
nsAccessibleDOMStringList::Item(PRUint32 aIndex, nsAString& aResult)
{
if (aIndex >= mNames.Length()) {
SetDOMStringToNull(aResult);
} else {
aResult = mNames.ElementAt(aIndex);
}
return NS_OK;
}
NS_IMETHODIMP
nsAccessibleDOMStringList::GetLength(PRUint32 *aLength)
{
*aLength = mNames.Length();
return NS_OK;
}
NS_IMETHODIMP
nsAccessibleDOMStringList::Contains(const nsAString& aString, PRBool *aResult)
{
*aResult = mNames.Contains(aString);
return NS_OK;
}
/*
* Class nsAccessible
*/
////////////////////////////////////////////////////////////////////////////////
// nsAccessible. nsISupports
@ -824,12 +786,8 @@ NS_IMETHODIMP nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
focusedChild = this;
}
else if (gLastFocusedNode) {
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
accService->GetAccessibleFor(gLastFocusedNode,
getter_AddRefs(focusedChild));
GetAccService()->GetAccessibleFor(gLastFocusedNode,
getter_AddRefs(focusedChild));
if (focusedChild) {
nsCOMPtr<nsIAccessible> focusedParentAccessible;
focusedChild->GetParent(getter_AddRefs(focusedParentAccessible));
@ -891,17 +849,17 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, PRBool aDeepestChild,
}
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
nsCOMPtr<nsIDOMNode> relevantNode;
accService->GetRelevantContentNodeFor(node, getter_AddRefs(relevantNode));
GetAccService()->GetRelevantContentNodeFor(node,
getter_AddRefs(relevantNode));
if (!relevantNode) {
NS_IF_ADDREF(*aChild = fallbackAnswer);
return NS_OK;
}
nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleFor(relevantNode, getter_AddRefs(accessible));
GetAccService()->GetAccessibleFor(relevantNode, getter_AddRefs(accessible));
if (!accessible) {
// No accessible for the node with the point, so find the first
// accessible in the DOM parent chain
@ -2894,7 +2852,7 @@ nsAccessible::GetParent()
docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE,
getter_AddRefs(parent));
nsRefPtr<nsAccessible> parentAcc = nsAccUtils::QueryAccessible(parent);
nsRefPtr<nsAccessible> parentAcc = do_QueryObject(parent);
#ifdef DEBUG
NS_ASSERTION(!parentAcc->IsDefunct(), "Defunct parent!");
@ -3061,16 +3019,15 @@ nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
return child;
}
already_AddRefed<nsIAccessible>
already_AddRefed<nsAccessible>
nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode)
{
nsCOMPtr<nsIAccessible> accessible;
nsCOMPtr<nsIDOMTreeWalker> walker;
nsCOMPtr<nsIDOMNode> currentNode(aStartNode);
while (currentNode) {
GetAccService()->GetAccessibleInWeakShell(currentNode, mWeakShell,
getter_AddRefs(accessible));
nsRefPtr<nsAccessible> accessible =
GetAccService()->GetAccessibleInWeakShell(currentNode, mWeakShell);
if (accessible)
return accessible.forget();

View File

@ -41,33 +41,29 @@
#include "nsAccessNodeWrap.h"
#include "nsARIAMap.h"
#include "nsEventShell.h"
#include "nsRelUtils.h"
#include "nsTextEquivUtils.h"
#include "nsIAccessible.h"
#include "nsIAccessibleHyperLink.h"
#include "nsIAccessibleSelectable.h"
#include "nsIAccessibleValue.h"
#include "nsIAccessibleRole.h"
#include "nsIAccessibleStates.h"
#include "nsIAccessibleEvent.h"
#include "nsIDOMNodeList.h"
#include "nsINameSpaceManager.h"
#include "nsWeakReference.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsTArray.h"
#include "nsIDOMDOMStringList.h"
class nsAccessible;
class nsAccEvent;
struct nsRoleMapEntry;
struct nsRect;
class nsIContent;
class nsIFrame;
class nsIDOMNode;
class nsIAtom;
class nsIView;
typedef nsRefPtrHashtable<nsVoidPtrHashKey, nsAccessible>
nsAccessibleHashtable;
// see nsAccessible::GetAttrValue
#define NS_OK_NO_ARIA_VALUE \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x21)
@ -80,29 +76,8 @@ NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x23)
#define NS_OK_NAME_FROM_TOOLTIP \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x25)
// Saves a data member -- if child count equals this value we haven't
// cached children or child count yet
enum { eChildCountUninitialized = -1 };
class nsAccessibleDOMStringList : public nsIDOMDOMStringList
{
public:
nsAccessibleDOMStringList();
virtual ~nsAccessibleDOMStringList();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOMSTRINGLIST
PRBool Add(const nsAString& aName) {
return mNames.AppendElement(aName) != nsnull;
}
private:
nsTArray<nsString> mNames;
};
#define NS_ACCESSIBLE_IMPL_CID \
#define NS_ACCESSIBLE_IMPL_IID \
{ /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */ \
0x133c8bf4, \
0x4913, \
@ -127,7 +102,7 @@ public:
NS_DECL_NSIACCESSIBLEHYPERLINK
NS_DECL_NSIACCESSIBLESELECTABLE
NS_DECL_NSIACCESSIBLEVALUE
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_CID)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_IID)
//////////////////////////////////////////////////////////////////////////////
// nsAccessNode
@ -361,7 +336,7 @@ protected:
* @param aStartNode [in] the DOM node to start from
* @return the resulting accessible
*/
already_AddRefed<nsIAccessible>
already_AddRefed<nsAccessible>
GetFirstAvailableAccessible(nsIDOMNode *aStartNode);
// Hyperlink helpers
@ -441,7 +416,7 @@ protected:
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessible,
NS_ACCESSIBLE_IMPL_CID)
NS_ACCESSIBLE_IMPL_IID)
#endif

View File

@ -43,8 +43,12 @@
#include "nsApplicationAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsIComponentManager.h"
#include "nsIDOMDocument.h"
#include "nsIDOMWindow.h"
#include "nsIWindowMediator.h"
#include "nsServiceManagerUtils.h"
nsApplicationAccessible::nsApplicationAccessible() :
@ -58,6 +62,18 @@ nsApplicationAccessible::nsApplicationAccessible() :
NS_IMPL_ISUPPORTS_INHERITED1(nsApplicationAccessible, nsAccessible,
nsIAccessibleApplication)
////////////////////////////////////////////////////////////////////////////////
// nsIAccessNode
NS_IMETHODIMP
nsApplicationAccessible::GetRootDocument(nsIAccessibleDocument **aRootDocument)
{
NS_ENSURE_ARG_POINTER(aRootDocument);
*aRootDocument = nsnull;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
@ -246,8 +262,42 @@ nsApplicationAccessible::InvalidateChildren()
void
nsApplicationAccessible::CacheChildren()
{
// Nothing to do. Children are keeped up to dated by Add/RemoveRootAccessible
// method calls.
// CacheChildren is called only once for application accessible when its
// children are requested because empty InvalidateChldren() prevents its
// repeated calls.
// Basically children are kept updated by Add/RemoveRootAccessible method
// calls. However if there are open windows before accessibility was started
// then we need to make sure root accessibles for open windows are created so
// that all root accessibles are stored in application accessible children
// array.
nsCOMPtr<nsIWindowMediator> windowMediator =
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
nsresult rv = windowMediator->GetEnumerator(nsnull,
getter_AddRefs(windowEnumerator));
if (NS_FAILED(rv))
return;
PRBool hasMore = PR_FALSE;
windowEnumerator->HasMoreElements(&hasMore);
while (hasMore) {
nsCOMPtr<nsISupports> window;
windowEnumerator->GetNext(getter_AddRefs(window));
nsCOMPtr<nsIDOMWindow> DOMWindow = do_QueryInterface(window);
if (DOMWindow) {
nsCOMPtr<nsIDOMDocument> DOMDocument;
DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
if (DOMDocument) {
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleFor(DOMDocument,
getter_AddRefs(accessible));
}
}
windowEnumerator->HasMoreElements(&hasMore);
}
}
nsAccessible*

View File

@ -68,6 +68,9 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessNode
NS_IMETHOD GetRootDocument(nsIAccessibleDocument **aRootDocument);
// nsIAccessible
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetDescription(nsAString& aValue);

View File

@ -38,18 +38,18 @@
* ***** END LICENSE BLOCK ***** */
#include "nsBaseWidgetAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessibleDocument.h"
#include "nsAccessibleWrap.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsHyperTextAccessibleWrap.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsGUIEvent.h"
#include "nsHyperTextAccessibleWrap.h"
#include "nsILink.h"
#include "nsIFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
////////////////////////////////////////////////////////////////////////////////
@ -107,7 +107,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsAccessibleWrap)
NS_IMETHODIMP
nsLinkableAccessible::TakeFocus()
{
nsCOMPtr<nsIAccessible> actionAcc = GetActionAccessible();
nsRefPtr<nsAccessible> actionAcc = GetActionAccessible();
if (actionAcc)
return actionAcc->TakeFocus();
@ -122,7 +122,7 @@ nsLinkableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
if (mIsLink) {
*aState |= nsIAccessibleStates::STATE_LINKED;
nsCOMPtr<nsIAccessible> actionAcc = GetActionAccessible();
nsRefPtr<nsAccessible> actionAcc = GetActionAccessible();
if (nsAccUtils::State(actionAcc) & nsIAccessibleStates::STATE_TRAVERSED)
*aState |= nsIAccessibleStates::STATE_TRAVERSED;
}
@ -140,7 +140,7 @@ nsLinkableAccessible::GetValue(nsAString& aValue)
return NS_OK;
if (mIsLink) {
nsCOMPtr<nsIAccessible> actionAcc = GetActionAccessible();
nsRefPtr<nsAccessible> actionAcc = GetActionAccessible();
if (actionAcc)
return actionAcc->GetValue(aValue);
}
@ -184,7 +184,7 @@ nsLinkableAccessible::DoAction(PRUint8 aIndex)
if (aIndex != eAction_Jump)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIAccessible> actionAcc = GetActionAccessible();
nsRefPtr<nsAccessible> actionAcc = GetActionAccessible();
if (actionAcc)
return actionAcc->DoAction(aIndex);
@ -196,7 +196,7 @@ nsLinkableAccessible::GetKeyboardShortcut(nsAString& aKeyboardShortcut)
{
aKeyboardShortcut.Truncate();
nsCOMPtr<nsIAccessible> actionAcc = GetActionAccessible();
nsRefPtr<nsAccessible> actionAcc = GetActionAccessible();
if (actionAcc)
return actionAcc->GetKeyboardShortcut(aKeyboardShortcut);
@ -210,10 +210,10 @@ NS_IMETHODIMP
nsLinkableAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI)
{
if (mIsLink) {
nsCOMPtr<nsIAccessible> actionAcc = GetActionAccessible();
nsRefPtr<nsAccessible> actionAcc = GetActionAccessible();
if (actionAcc) {
nsCOMPtr<nsIAccessibleHyperLink> hyperLinkAcc =
do_QueryInterface(actionAcc);
nsAccUtils::QueryObject<nsIAccessibleHyperLink>(actionAcc);
NS_ASSERTION(hyperLinkAcc,
"nsIAccessibleHyperLink isn't implemented.");
@ -262,9 +262,8 @@ nsLinkableAccessible::CacheActionContent()
nsCOMPtr<nsIDOMNode> walkUpNode(do_QueryInterface(walkUpContent));
nsCOMPtr<nsIAccessible> walkUpAcc;
GetAccService()->GetAccessibleInWeakShell(walkUpNode, mWeakShell,
getter_AddRefs(walkUpAcc));
nsRefPtr<nsAccessible> walkUpAcc =
GetAccService()->GetAccessibleInWeakShell(walkUpNode, mWeakShell);
if (nsAccUtils::Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK &&
nsAccUtils::State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED) {
@ -281,7 +280,7 @@ nsLinkableAccessible::CacheActionContent()
}
}
already_AddRefed<nsIAccessible>
already_AddRefed<nsAccessible>
nsLinkableAccessible::GetActionAccessible()
{
// Return accessible for the action content if it's different from node of
@ -292,10 +291,7 @@ nsLinkableAccessible::GetActionAccessible()
if (!actionNode || mDOMNode == actionNode)
return nsnull;
nsIAccessible *accessible = nsnull;
GetAccService()->GetAccessibleInWeakShell(actionNode, mWeakShell,
&accessible);
return accessible;
return GetAccService()->GetAccessibleInWeakShell(actionNode, mWeakShell);
}
//---------------------

View File

@ -110,7 +110,7 @@ protected:
/**
* Return an accessible for cached action node.
*/
already_AddRefed<nsIAccessible> GetActionAccessible();
already_AddRefed<nsAccessible> GetActionAccessible();
/**
* Cache action node.

View File

@ -35,10 +35,13 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsCaretAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleEvent.h"
#include "nsCaret.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLAnchorElement.h"

View File

@ -74,6 +74,10 @@
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
////////////////////////////////////////////////////////////////////////////////
// nsCoreUtils
////////////////////////////////////////////////////////////////////////////////
PRBool
nsCoreUtils::HasClickListener(nsIContent *aContent)
{
@ -1150,3 +1154,37 @@ nsCoreUtils::GeneratePopupTree(nsIDOMNode *aNode, PRBool aIsAnon)
}
}
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibleDOMStringList
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS1(nsAccessibleDOMStringList, nsIDOMDOMStringList)
NS_IMETHODIMP
nsAccessibleDOMStringList::Item(PRUint32 aIndex, nsAString& aResult)
{
if (aIndex >= mNames.Length())
SetDOMStringToNull(aResult);
else
aResult = mNames.ElementAt(aIndex);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibleDOMStringList::GetLength(PRUint32 *aLength)
{
*aLength = mNames.Length();
return NS_OK;
}
NS_IMETHODIMP
nsAccessibleDOMStringList::Contains(const nsAString& aString, PRBool *aResult)
{
*aResult = mNames.Contains(aString);
return NS_OK;
}

View File

@ -49,10 +49,15 @@
#include "nsIFrame.h"
#include "nsIDocShellTreeItem.h"
#include "nsIArray.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMDOMStringList.h"
#include "nsIMutableArray.h"
#include "nsPoint.h"
#include "nsTArray.h"
/**
* Core utils.
*/
class nsCoreUtils
{
public:
@ -468,132 +473,26 @@ public:
static void GeneratePopupTree(nsIDOMNode *aNode, PRBool aIsAnon = PR_FALSE);
};
////////////////////////////////////////////////////////////////////////////////
// nsRunnable helpers
////////////////////////////////////////////////////////////////////////////////
/**
* Use NS_DECL_RUNNABLEMETHOD_ macros to declare a runnable class for the given
* method of the given class. There are three macros:
* NS_DECL_RUNNABLEMETHOD(Class, Method)
* NS_DECL_RUNNABLEMETHOD_ARG1(Class, Method, Arg1Type)
* NS_DECL_RUNNABLEMETHOD_ARG2(Class, Method, Arg1Type, Arg2Type)
* Note Arg1Type and Arg2Type must be types which keeps the objects alive.
*
* Use NS_DISPATCH_RUNNABLEMETHOD_ macros to create an instance of declared
* runnable class and dispatch it to main thread. Availabe macros are:
* NS_DISPATCH_RUNNABLEMETHOD(Method, Object)
* NS_DISPATCH_RUNNABLEMETHOD_ARG1(Method, Object, Arg1)
* NS_DISPATCH_RUNNABLEMETHOD_ARG2(Method, Object, Arg1, Arg2)
* nsIDOMDOMStringList implementation.
*/
class nsAccessibleDOMStringList : public nsIDOMDOMStringList
{
public:
nsAccessibleDOMStringList() {};
virtual ~nsAccessibleDOMStringList() {};
#define NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
void Revoke() \
{ \
NS_IF_RELEASE(mObj); \
} \
\
protected: \
virtual ~nsRunnableMethod_##Method() \
{ \
NS_IF_RELEASE(mObj); \
} \
\
private: \
ClassType *mObj; \
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOMSTRINGLIST
PRBool Add(const nsAString& aName) {
return mNames.AppendElement(aName) != nsnull;
}
#define NS_DECL_RUNNABLEMETHOD(ClassType, Method) \
class nsRunnableMethod_##Method : public nsRunnable \
{ \
public: \
nsRunnableMethod_##Method(ClassType *aObj) : mObj(aObj) \
{ \
NS_IF_ADDREF(mObj); \
} \
\
NS_IMETHODIMP Run() \
{ \
if (!mObj) \
return NS_OK; \
(mObj-> Method)(); \
return NS_OK; \
} \
\
NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
\
private:
nsTArray<nsString> mNames;
};
#define NS_DECL_RUNNABLEMETHOD_ARG1(ClassType, Method, Arg1Type) \
class nsRunnableMethod_##Method : public nsRunnable \
{ \
public: \
nsRunnableMethod_##Method(ClassType *aObj, Arg1Type aArg1) : \
mObj(aObj), mArg1(aArg1) \
{ \
NS_IF_ADDREF(mObj); \
} \
\
NS_IMETHODIMP Run() \
{ \
if (!mObj) \
return NS_OK; \
(mObj-> Method)(mArg1); \
return NS_OK; \
} \
\
NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
Arg1Type mArg1; \
};
#define NS_DECL_RUNNABLEMETHOD_ARG2(ClassType, Method, Arg1Type, Arg2Type) \
class nsRunnableMethod_##Method : public nsRunnable \
{ \
public: \
\
nsRunnableMethod_##Method(ClassType *aObj, \
Arg1Type aArg1, Arg2Type aArg2) : \
mObj(aObj), mArg1(aArg1), mArg2(aArg2) \
{ \
NS_IF_ADDREF(mObj); \
} \
\
NS_IMETHODIMP Run() \
{ \
if (!mObj) \
return NS_OK; \
(mObj-> Method)(mArg1, mArg2); \
return NS_OK; \
} \
\
NS_DECL_RUNNABLEMETHOD_HELPER(ClassType, Method) \
Arg1Type mArg1; \
Arg2Type mArg2; \
};
#define NS_DISPATCH_RUNNABLEMETHOD(Method, Obj) \
{ \
nsCOMPtr<nsIRunnable> runnable = \
new nsRunnableMethod_##Method(Obj); \
if (runnable) \
NS_DispatchToMainThread(runnable); \
}
#define NS_DISPATCH_RUNNABLEMETHOD_ARG1(Method, Obj, Arg1) \
{ \
nsCOMPtr<nsIRunnable> runnable = \
new nsRunnableMethod_##Method(Obj, Arg1); \
if (runnable) \
NS_DispatchToMainThread(runnable); \
}
#define NS_DISPATCH_RUNNABLEMETHOD_ARG2(Method, Obj, Arg1, Arg2) \
{ \
nsCOMPtr<nsIRunnable> runnable = \
new nsRunnableMethod_##Method(Obj, Arg1, Arg2); \
if (runnable) \
NS_DispatchToMainThread(runnable); \
}
#endif

View File

@ -36,9 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsRootAccessible.h"
#include "nsAccCache.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsRootAccessible.h"
#include "nsTextEquivUtils.h"
#include "nsIMutableArray.h"
#include "nsICommandManager.h"
#include "nsIDocShell.h"
@ -474,17 +479,16 @@ NS_IMETHODIMP nsDocAccessible::GetWindow(nsIDOMWindow **aDOMWin)
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::GetDocument(nsIDOMDocument **aDOMDoc)
NS_IMETHODIMP
nsDocAccessible::GetDOMDocument(nsIDOMDocument **aDOMDocument)
{
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(mDocument));
*aDOMDoc = domDoc;
NS_ENSURE_ARG_POINTER(aDOMDocument);
*aDOMDocument = nsnull;
if (domDoc) {
NS_ADDREF(*aDOMDoc);
return NS_OK;
}
if (mDocument)
CallQueryInterface(mDocument, aDOMDocument);
return NS_ERROR_FAILURE;
return NS_OK;
}
// nsIAccessibleHyperText method
@ -667,8 +671,7 @@ void nsDocAccessible::ShutdownChildDocuments(nsIDocShellTreeItem *aStart)
nsCOMPtr<nsIAccessibleDocument> docAccessible =
GetDocAccessibleFor(treeItemChild);
if (docAccessible) {
nsRefPtr<nsAccessNode> docAccNode =
nsAccUtils::QueryAccessNode(docAccessible);
nsRefPtr<nsAccessNode> docAccNode = do_QueryObject(docAccessible);
docAccNode->Shutdown();
}
}
@ -1667,8 +1670,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
if (isAsync) {
// For asynch show, delayed invalidatation of parent's children
nsRefPtr<nsAccessible> containerAcc =
nsAccUtils::QueryAccessible(containerAccessible);
nsRefPtr<nsAccessible> containerAcc = do_QueryObject(containerAccessible);
if (containerAcc)
containerAcc->InvalidateChildren();
@ -1703,8 +1705,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
if (accessible) {
if (eventType == nsIAccessibleEvent::EVENT_INTERNAL_LOAD) {
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(accessible);
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(accessible);
NS_ASSERTION(docAcc, "No doc accessible for doc load event");
if (docAcc)
@ -1935,8 +1936,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
containerAccessible = this;
}
nsRefPtr<nsAccessible> containerAcc =
nsAccUtils::QueryAccessible(containerAccessible);
nsRefPtr<nsAccessible> containerAcc = do_QueryObject(containerAccessible);
containerAcc->InvalidateChildren();
return;
}
@ -2028,8 +2028,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
if (!isAsynch) {
// DOM already updated with new objects -- invalidate parent's children now
// For asynch we must wait until layout updates before we invalidate the children
nsRefPtr<nsAccessible> containerAcc =
nsAccUtils::QueryAccessible(containerAccessible);
nsRefPtr<nsAccessible> containerAcc = do_QueryObject(containerAccessible);
if (containerAcc)
containerAcc->InvalidateChildren();
@ -2124,8 +2123,10 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
currentNode = relevantNode;
}
if (aCanCreate) {
GetAccService()->GetAccessibleInWeakShell(currentNode, mWeakShell,
aAccessible);
nsRefPtr<nsAccessible> acc =
GetAccService()->GetAccessibleInWeakShell(currentNode, mWeakShell);
if (acc)
CallQueryInterface(acc, aAccessible);
}
else { // Only return cached accessibles, don't create anything
nsAccessNode* accessNode = GetCachedAccessNode(currentNode);

View File

@ -40,7 +40,9 @@
#define _nsDocAccessible_H_
#include "nsHyperTextAccessibleWrap.h"
#include "nsEventShell.h"
#include "nsIAccessibleDocument.h"
#include "nsIDocument.h"
#include "nsIDocumentObserver.h"
#include "nsIEditor.h"

View File

@ -38,6 +38,8 @@
#include "nsEventShell.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsDocAccessible.h"
////////////////////////////////////////////////////////////////////////////////

View File

@ -41,8 +41,9 @@
#include "nsAccEvent.h"
#include "a11yGeneric.h"
#include "nsAutoPtr.h"
#include "nsCoreUtils.h"
class nsIPersistentProperties;

View File

@ -37,8 +37,10 @@
* ***** END LICENSE BLOCK ***** */
#include "nsOuterDocAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessibleDocument.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsIDocument.h"
#include "nsIServiceManager.h"
#include "nsIContent.h"
@ -121,7 +123,7 @@ nsOuterDocAccessible::CacheChildren()
nsCOMPtr<nsIAccessible> innerAccessible;
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
accService->GetAccessibleFor(innerNode, getter_AddRefs(innerAccessible));
nsRefPtr<nsAccessible> innerAcc(nsAccUtils::QueryAccessible(innerAccessible));
nsRefPtr<nsAccessible> innerAcc(do_QueryObject(innerAccessible));
if (!innerAcc)
return;

View File

@ -38,6 +38,7 @@
#include "nsRelUtils.h"
#include "nsAccessibilityService.h"
#include "nsAccessNode.h"
#include "nsIDOMDocument.h"

View File

@ -35,9 +35,11 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsRelUtils.h"
#include "nsHTMLSelectAccessible.h"
#include "nsIDocShell.h"
@ -622,7 +624,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aTargetNode));
nsCOMPtr<nsIAccessibleDocument> accDoc = GetDocAccessibleFor(doc);
if (accDoc) {
nsRefPtr<nsAccessNode> docAccNode = nsAccUtils::QueryAccessNode(accDoc);
nsRefPtr<nsAccessNode> docAccNode = do_QueryObject(accDoc);
docAccNode->Shutdown();
}
@ -649,14 +651,13 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
if (eventType.EqualsLiteral("popuphiding"))
return HandlePopupHidingEvent(aTargetNode, accessible);
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
nsRefPtr<nsAccessible> acc(do_QueryObject(accessible));
if (!acc)
return NS_OK;
#ifdef MOZ_XUL
if (isTree) {
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(accessible);
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
NS_ASSERTION(treeAcc,
"Accessible for xul:tree isn't nsXULTreeAccessible.");
@ -720,8 +721,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
PRInt32 treeIndex = -1;
multiSelect->GetCurrentIndex(&treeIndex);
if (treeIndex >= 0) {
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(accessible);
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
if (treeAcc) {
treeItemAccessible = treeAcc->GetTreeItemAccessible(treeIndex);
if (treeItemAccessible)
@ -832,8 +832,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
return NS_OK; // Tree with nothing selected
}
#endif
nsRefPtr<nsAccessNode> menuAccessNode =
nsAccUtils::QueryAccessNode(accessible);
nsRefPtr<nsAccessNode> menuAccessNode = do_QueryObject(accessible);
nsIFrame* menuFrame = menuAccessNode->GetFrame();
NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE);
@ -1125,7 +1124,7 @@ nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
PR_FALSE, PR_TRUE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(comboboxAcc));
nsRefPtr<nsAccessible> acc(do_QueryObject(comboboxAcc));
nsEventShell::FireEvent(event);
return NS_OK;
}

View File

@ -38,7 +38,8 @@
#include "nsTextAttrs.h"
#include "nsAccessNode.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsHyperTextAccessibleWrap.h"
#include "gfxFont.h"

View File

@ -45,7 +45,6 @@ class nsHyperTextAccessible;
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIContent.h"
#include "nsIFrame.h"

View File

@ -39,7 +39,9 @@
#include "nsTextEquivUtils.h"
#include "nsAccessibilityService.h"
#include "nsAccessible.h"
#include "nsAccUtils.h"
#include "nsIDOMXULLabeledControlEl.h"
@ -334,7 +336,7 @@ nsTextEquivUtils::AppendFromValue(nsIAccessible *aAccessible,
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
}
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessible);
nsRefPtr<nsAccessible> acc = do_QueryObject(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ENSURE_STATE(node);

View File

@ -36,9 +36,13 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessibilityAtoms.h"
#include "nsHTMLFormControlAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccUtils.h"
#include "nsRelUtils.h"
#include "nsTextEquivUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIDOMHTMLInputElement.h"

View File

@ -36,12 +36,13 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLImageAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccUtils.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsHTMLImageAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsIDocument.h"
#include "nsIImageLoadingContent.h"
#include "nsILink.h"

View File

@ -39,6 +39,8 @@
#include "nsHTMLImageMapAccessible.h"
#include "nsAccUtils.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIServiceManager.h"
#include "nsIDOMElement.h"

View File

@ -39,6 +39,8 @@
#include "nsHTMLLinkAccessible.h"
#include "nsCoreUtils.h"
#include "nsILink.h"
////////////////////////////////////////////////////////////////////////////////

View File

@ -36,10 +36,15 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsHTMLSelectAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsEventShell.h"
#include "nsIAccessibleEvent.h"
#include "nsTextEquivUtils.h"
#include "nsCOMPtr.h"
#include "nsIFrame.h"
#include "nsIComboboxControlFrame.h"
#include "nsIDocument.h"
@ -115,19 +120,20 @@ nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIMutableArray *a
nsPresContext *aContext)
{
PRBool isSelected = PR_FALSE;
nsCOMPtr<nsIAccessible> tempAccess;
nsRefPtr<nsAccessible> tempAcc;
if (mOption) {
mOption->GetSelected(&isSelected);
if (isSelected) {
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
GetAccService()->GetAccessibleInWeakShell(optionNode, mWeakShell,
getter_AddRefs(tempAccess));
tempAcc = GetAccService()->GetAccessibleInWeakShell(optionNode,
mWeakShell);
}
}
if (tempAccess)
aSelectedAccessibles->AppendElement(static_cast<nsISupports*>(tempAccess), PR_FALSE);
if (tempAcc)
aSelectedAccessibles->AppendElement(static_cast<nsIAccessible*>(tempAcc),
PR_FALSE);
}
PRBool
@ -144,7 +150,11 @@ nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
if (isSelected) {
if (mSelCount == aIndex) {
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
GetAccService()->GetAccessibleInWeakShell(optionNode, mWeakShell, aAccessible);
nsRefPtr<nsAccessible> acc =
GetAccService()->GetAccessibleInWeakShell(optionNode, mWeakShell);
if (acc)
CallQueryInterface(acc, aAccessible);
return PR_TRUE;
}
mSelCount++;
@ -392,13 +402,9 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
// Get an accessible for option or optgroup and cache it.
nsCOMPtr<nsIDOMNode> childNode(do_QueryInterface(childContent));
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleInWeakShell(childNode, mWeakShell,
getter_AddRefs(accessible));
if (accessible) {
nsRefPtr<nsAccessible> acc =
nsAccUtils::QueryObject<nsAccessible>(accessible);
nsRefPtr<nsAccessible> acc =
GetAccService()->GetAccessibleInWeakShell(childNode, mWeakShell);
if (acc) {
mChildren.AppendElement(acc);
acc->SetParent(this);
}
@ -415,32 +421,31 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
// nsHTMLSelectOptionAccessible
////////////////////////////////////////////////////////////////////////////////
/** Default Constructor */
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsHyperTextAccessibleWrap(aDOMNode, aShell)
nsHTMLSelectOptionAccessible::
nsHTMLSelectOptionAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsHyperTextAccessibleWrap(aDOMNode, aShell)
{
nsCOMPtr<nsIDOMNode> parentNode;
aDOMNode->GetParentNode(getter_AddRefs(parentNode));
nsCOMPtr<nsIAccessible> parentAccessible;
if (parentNode) {
// If the parent node is a Combobox, then the option's accessible parent
// is nsHTMLComboboxListAccessible, not the nsHTMLComboboxAccessible that
// GetParent would normally return. This is because the
// nsHTMLComboboxListAccessible is inserted into the accessible hierarchy
// where there is no DOM node for it.
GetAccService()->GetAccessibleInWeakShell(parentNode, mWeakShell,
getter_AddRefs(parentAccessible));
if (parentAccessible) {
if (nsAccUtils::RoleInternal(parentAccessible) ==
nsIAccessibleRole::ROLE_COMBOBOX) {
nsCOMPtr<nsIAccessible> comboAccessible(parentAccessible);
comboAccessible->GetLastChild(getter_AddRefs(parentAccessible));
}
}
if (!parentNode)
return;
// If the parent node is a Combobox, then the option's accessible parent
// is nsHTMLComboboxListAccessible, not the nsHTMLComboboxAccessible that
// GetParent would normally return. This is because the
// nsHTMLComboboxListAccessible is inserted into the accessible hierarchy
// where there is no DOM node for it.
nsRefPtr<nsAccessible> parentAcc =
GetAccService()->GetAccessibleInWeakShell(parentNode, mWeakShell);
if (!parentAcc)
return;
if (nsAccUtils::RoleInternal(parentAcc) == nsIAccessibleRole::ROLE_COMBOBOX) {
PRInt32 childCount = parentAcc->GetChildCount();
parentAcc = parentAcc->GetChildAt(childCount - 1);
}
nsRefPtr<nsAccessible> parentAcc =
nsAccUtils::QueryObject<nsAccessible>(parentAccessible);
SetParent(parentAcc);
}
@ -1004,26 +1009,25 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetDescription(nsAString& aDescription)
return NS_OK;
}
// Use description of currently focused option
nsCOMPtr<nsIAccessible> optionAccessible = GetFocusedOptionAccessible();
return optionAccessible ? optionAccessible->GetDescription(aDescription) : NS_OK;
nsRefPtr<nsAccessible> optionAcc = GetFocusedOptionAccessible();
return optionAcc ? optionAcc->GetDescription(aDescription) : NS_OK;
}
already_AddRefed<nsIAccessible>
already_AddRefed<nsAccessible>
nsHTMLComboboxAccessible::GetFocusedOptionAccessible()
{
if (!mWeakShell) {
return nsnull; // Shut down
}
if (IsDefunct())
return nsnull;
nsCOMPtr<nsIDOMNode> focusedOptionNode;
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mDOMNode, getter_AddRefs(focusedOptionNode));
nsHTMLSelectOptionAccessible::
GetFocusedOptionNode(mDOMNode, getter_AddRefs(focusedOptionNode));
if (!focusedOptionNode) {
return nsnull;
}
nsIAccessible *optionAccessible;
GetAccService()->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell,
&optionAccessible);
return optionAccessible;
return GetAccService()->GetAccessibleInWeakShell(focusedOptionNode,
mWeakShell);
}
/**
@ -1033,10 +1037,9 @@ nsHTMLComboboxAccessible::GetFocusedOptionAccessible()
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetValue(nsAString& aValue)
{
// Use label of currently focused option
nsCOMPtr<nsIAccessible> optionAccessible = GetFocusedOptionAccessible();
NS_ENSURE_TRUE(optionAccessible, NS_ERROR_FAILURE);
return optionAccessible->GetName(aValue);
// Use accessible name of currently focused option.
nsRefPtr<nsAccessible> optionAcc = GetFocusedOptionAccessible();
return optionAcc ? optionAcc->GetName(aValue) : NS_OK;
}
/** Just one action ( click ). */

View File

@ -240,7 +240,11 @@ protected:
virtual void CacheChildren();
// nsHTMLComboboxAccessible
already_AddRefed<nsIAccessible> GetFocusedOptionAccessible();
/**
* Return focused option accessible.
*/
already_AddRefed<nsAccessible> GetFocusedOptionAccessible();
private:
nsRefPtr<nsHTMLComboboxListAccessible> mListAccessible;

View File

@ -39,7 +39,11 @@
#include "nsHTMLTableAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsDocAccessible.h"
#include "nsRelUtils.h"
#include "nsTextEquivUtils.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
@ -48,8 +52,6 @@
#include "nsISelection2.h"
#include "nsISelectionPrivate.h"
#include "nsINameSpaceManager.h"
#include "nsIAccessibilityService.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLTableElement.h"
@ -57,7 +59,6 @@
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsITableLayout.h"
#include "nsITableCellLayout.h"
#include "nsFrameSelection.h"
@ -334,16 +335,16 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
nsCOMPtr<nsIDOMNode> headerCellNode;
for (PRUint32 idx = 0; idx < count; idx++) {
headerCellNode = do_QueryElementAt(headerCellElms, idx, &rv);
nsCOMPtr<nsIAccessible> headerCell;
GetAccService()->GetAccessibleInWeakShell(headerCellNode, mWeakShell,
getter_AddRefs(headerCell));
nsRefPtr<nsAccessible> headerCell =
GetAccService()->GetAccessibleInWeakShell(headerCellNode, mWeakShell);
if (headerCell &&
(aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells &&
nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_ROWHEADER ||
aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells &&
nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_COLUMNHEADER))
headerCells->AppendElement(headerCell, PR_FALSE);
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell.get()),
PR_FALSE);
}
}
@ -737,10 +738,9 @@ nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells)
if (NS_SUCCEEDED(rv) && startRowIndex == rowIndex &&
startColIndex == columnIndex && isSelected) {
nsCOMPtr<nsIAccessible> cell;
GetAccService()->GetAccessibleInWeakShell(cellElement, mWeakShell,
getter_AddRefs(cell));
selCells->AppendElement(cell, PR_FALSE);
nsRefPtr<nsAccessible> cell =
GetAccService()->GetAccessibleInWeakShell(cellElement, mWeakShell);
selCells->AppendElement(static_cast<nsIAccessible*>(cell.get()), PR_FALSE);
}
}
}
@ -911,8 +911,12 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
nsresult rv = GetCellAt(aRow, aColumn, *getter_AddRefs(cellElement));
NS_ENSURE_SUCCESS(rv, rv);
return GetAccService()->GetAccessibleInWeakShell(cellElement, mWeakShell,
aTableCellAccessible);
nsRefPtr<nsAccessible> cellAcc =
GetAccService()->GetAccessibleInWeakShell(cellElement, mWeakShell);
if (cellAcc)
CallQueryInterface(cellAcc, aTableCellAccessible);
return NS_OK;
}
NS_IMETHODIMP
@ -1499,7 +1503,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
nsCOMPtr<nsIAccessibleDocument> docAccessible = GetDocAccessible();
NS_ENSURE_TRUE(docAccessible, NS_ERROR_FAILURE);
nsRefPtr<nsAccessNode> docAccessNode = nsAccUtils::QueryAccessNode(docAccessible);
nsRefPtr<nsAccessNode> docAccessNode = do_QueryObject(docAccessible);
nsIFrame *docFrame = docAccessNode->GetFrame();
NS_ENSURE_TRUE(docFrame , NS_ERROR_FAILURE);

View File

@ -40,6 +40,7 @@
#include "nsHTMLTextAccessible.h"
#include "nsDocAccessible.h"
#include "nsTextEquivUtils.h"
#include "nsIFrame.h"
#include "nsPresContext.h"

View File

@ -38,8 +38,10 @@
* ***** END LICENSE BLOCK ***** */
#include "nsHyperTextAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsTextAttrs.h"
#include "nsIClipboard.h"
@ -583,7 +585,7 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
// Get accessible for this findNode, or if that node isn't accessible, use the
// accessible for the next DOM node which has one (based on forward depth first search)
nsCOMPtr<nsIAccessible> descendantAccessible;
nsRefPtr<nsAccessible> descendantAcc;
if (findNode) {
nsCOMPtr<nsIContent> findContent = do_QueryInterface(findNode);
if (findContent->IsHTML() &&
@ -596,14 +598,11 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
*aHyperTextOffset = 0;
return NS_OK;
}
descendantAccessible = GetFirstAvailableAccessible(findNode);
descendantAcc = GetFirstAvailableAccessible(findNode);
}
// From the descendant, go up and get the immediate child of this hypertext
nsRefPtr<nsAccessible> childAccAtOffset;
nsRefPtr<nsAccessible> descendantAcc =
nsAccUtils::QueryObject<nsAccessible>(descendantAccessible);
while (descendantAcc) {
nsRefPtr<nsAccessible> parentAcc = descendantAcc->GetParent();
if (parentAcc == this) {
@ -782,8 +781,7 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
nsresult rv;
PRInt32 contentOffset = aFromOffset;
if (nsAccUtils::IsText(aFromAccessible)) {
nsRefPtr<nsAccessNode> accessNode =
nsAccUtils::QueryAccessNode(aFromAccessible);
nsRefPtr<nsAccessNode> accessNode = do_QueryObject(aFromAccessible);
nsIFrame *frame = accessNode->GetFrame();
NS_ENSURE_TRUE(frame, -1);
@ -977,8 +975,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
if (aBoundaryType == BOUNDARY_LINE_START && aOffset > 0 && aOffset == textLength) {
// Asking for start of line, while on last character
if (startAcc) {
nsRefPtr<nsAccessNode> startAccessNode =
nsAccUtils::QueryAccessNode(startAcc);
nsRefPtr<nsAccessNode> startAccessNode = do_QueryObject(startAcc);
startFrame = startAccessNode->GetFrame();
}
}

View File

@ -48,6 +48,7 @@ LIBXUL_LIBRARY = 1
CMMSRCS = nsAccessNodeWrap.mm \
nsDocAccessibleWrap.mm \
nsRootAccessibleWrap.mm \
nsAccessibleWrap.mm \
mozAccessible.mm \

View File

@ -43,14 +43,15 @@
#ifndef _nsAccessibleWrap_H_
#define _nsAccessibleWrap_H_
#include "nsAccessible.h"
#include "nsAccUtils.h"
#include "nsCOMPtr.h"
#include "nsRect.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "nsAccessible.h"
struct AccessibleWrapper;
struct objc_class;
@ -99,23 +100,10 @@ class nsAccessibleWrap : public nsAccessible
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
PRBool AncestorIsFlat() {
// we don't create a native object if we're child of a "flat" accessible; for example, on OS X buttons
// shouldn't have any children, because that makes the OS confused.
//
// to maintain a scripting environment where the XPCOM accessible hierarchy look the same
// on all platforms, we still let the C++ objects be created though.
nsAccessible* parent(GetParent());
while (parent) {
if (nsAccUtils::MustPrune(parent))
return PR_TRUE;
parent = parent->GetParent();
}
// no parent was flat
return PR_FALSE;
}
/**
* Return true if the parent doesn't have children to expose to AT.
*/
PRBool AncestorIsFlat();
// Wrapper around our native object.
AccessibleWrapper *mNativeWrapper;

View File

@ -309,3 +309,28 @@ nsAccessibleWrap::GetUnignoredParent()
return outValue;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibleWrap protected
PRBool
nsAccessibleWrap::AncestorIsFlat()
{
// We don't create a native object if we're child of a "flat" accessible;
// for example, on OS X buttons shouldn't have any children, because that
// makes the OS confused.
//
// To maintain a scripting environment where the XPCOM accessible hierarchy
// look the same on all platforms, we still let the C++ objects be created
// though.
nsAccessible* parent(GetParent());
while (parent) {
if (nsAccUtils::MustPrune(parent))
return PR_TRUE;
parent = parent->GetParent();
}
// no parent was flat
return PR_FALSE;
}

View File

@ -41,7 +41,18 @@
#include "nsDocAccessible.h"
typedef nsDocAccessible nsDocAccessibleWrap;
class nsDocAccessibleWrap: public nsDocAccessible
{
public:
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
virtual ~nsDocAccessibleWrap();
// nsIAccessNode
/**
* Creates the native accessible connected to this one.
*/
virtual nsresult Init ();
};
#endif

View File

@ -0,0 +1,66 @@
/* -*- 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) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Steven Michaud <smichaud@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsDocAccessibleWrap.h"
#import "mozAccessibleWrapper.h"
nsDocAccessibleWrap::
nsDocAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsDocAccessible(aDOMNode, aShell)
{
}
nsDocAccessibleWrap::~nsDocAccessibleWrap()
{
}
nsresult
nsDocAccessibleWrap::Init ()
{
nsresult rv = nsDocAccessible::Init();
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(!mNativeWrapper, "nsDocAccessibleWrap::Init() called more than once!");
if (!mNativeWrapper) {
// Create our native object using the class type specified in GetNativeType().
mNativeWrapper = new AccessibleWrapper (this, GetNativeType());
}
return NS_OK;
}

View File

@ -51,6 +51,7 @@
#include "nsAccessibleWrap.h"
#include "nsCOMPtr.h"
#include "nsIPersistentProperties2.h"
#include "nsString.h"
#define GET_NSIACCESSIBLETEXT \

View File

@ -37,12 +37,18 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAccessNodeWrap.h"
#include "AccessibleApplication.h"
#include "ISimpleDOMNode_i.c"
#include "nsAccessibilityAtoms.h"
#include "nsIAccessible.h"
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsCoreUtils.h"
#include "nsRootAccessible.h"
#include "nsAttrName.h"
#include "nsIDocument.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIDOMViewCSS.h"
@ -51,10 +57,7 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsPIDOMWindow.h"
#include "nsRootAccessible.h"
#include "nsIServiceManager.h"
#include "AccessibleApplication.h"
#include "nsApplicationAccessibleWrap.h"
/// the accessible library and cached methods
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
@ -410,14 +413,11 @@ ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
return NULL;
ISimpleDOMNode *iNode = NULL;
nsCOMPtr<nsIAccessible> nsAcc;
GetAccService()->GetAccessibleInWeakShell(node, mWeakShell,
getter_AddRefs(nsAcc));
if (nsAcc) {
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(nsAcc));
NS_ASSERTION(accessNode, "nsIAccessible impl does not inherit from nsIAccessNode");
IAccessible *msaaAccessible;
nsAcc->GetNativeInterface((void**)&msaaAccessible); // addrefs
nsRefPtr<nsAccessible> acc =
GetAccService()->GetAccessibleInWeakShell(node, mWeakShell);
if (acc) {
IAccessible *msaaAccessible = nsnull;
acc->GetNativeInterface((void**)&msaaAccessible); // addrefs
msaaAccessible->QueryInterface(IID_ISimpleDOMNode, (void**)&iNode); // addrefs
msaaAccessible->Release(); // Release IAccessible
}

View File

@ -37,7 +37,11 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsRelUtils.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleSelectable.h"
@ -1751,7 +1755,7 @@ PRInt32 nsAccessibleWrap::GetChildIDFor(nsIAccessible* aAccessible)
HWND
nsAccessibleWrap::GetHWNDFor(nsIAccessible *aAccessible)
{
nsRefPtr<nsAccessNode> accessNode = nsAccUtils::QueryAccessNode(aAccessible);
nsRefPtr<nsAccessNode> accessNode = do_QueryObject(aAccessible);
if (!accessNode)
return 0;

View File

@ -44,6 +44,8 @@
#define _nsDocAccessibleWrap_H_
#include "ISimpleDOMDocument.h"
#include "nsAccUtils.h"
#include "nsDocAccessible.h"
#include "nsIDocShellTreeItem.h"

View File

@ -40,6 +40,8 @@
#include "nsHyperTextAccessibleWrap.h"
#include "nsEventShell.h"
NS_IMPL_ISUPPORTS_INHERITED0(nsHyperTextAccessibleWrap,
nsHyperTextAccessible)

View File

@ -40,6 +40,7 @@
#include "nsTextAccessibleWrap.h"
#include "ISimpleDOMText_i.c"
#include "nsCoreUtils.h"
#include "nsDocAccessible.h"
#include "nsIFontMetrics.h"

View File

@ -38,6 +38,10 @@
#include "nsXFormsAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsTextEquivUtils.h"
#include "nscore.h"
#include "nsServiceManagerUtils.h"
#include "nsIDOMElement.h"
@ -105,10 +109,6 @@ nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName,
void
nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
{
nsIAccessibilityService *accService = GetAccService();
if (!accService)
return;
nsCOMPtr<nsIDOMNode> container(aContainerNode);
if (!container)
container = mDOMNode;
@ -131,7 +131,8 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
if (!child)
continue;
accService->GetAttachedAccessibleFor(child, getter_AddRefs(accessible));
GetAccService()->GetAttachedAccessibleFor(child,
getter_AddRefs(accessible));
if (!accessible)
continue;
@ -337,9 +338,6 @@ nsXFormsSelectableAccessible::GetSelectedChildren(nsIArray **aAccessibles)
do_CreateInstance(NS_ARRAY_CONTRACTID);
NS_ENSURE_TRUE(accessibles, NS_ERROR_OUT_OF_MEMORY);
nsIAccessibilityService* accService = GetAccService();
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
nsresult rv;
if (mIsSelect1Element) {
@ -352,7 +350,7 @@ nsXFormsSelectableAccessible::GetSelectedChildren(nsIArray **aAccessibles)
return NS_OK;
nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleFor(item, getter_AddRefs(accessible));
GetAccService()->GetAccessibleFor(item, getter_AddRefs(accessible));
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
accessibles->AppendElement(accessible, PR_FALSE);
@ -379,7 +377,7 @@ nsXFormsSelectableAccessible::GetSelectedChildren(nsIArray **aAccessibles)
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleFor(item, getter_AddRefs(accessible));
GetAccService()->GetAccessibleFor(item, getter_AddRefs(accessible));
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
accessibles->AppendElement(accessible, PR_FALSE);
@ -467,9 +465,6 @@ nsXFormsSelectableAccessible::RefSelection(PRInt32 aIndex,
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nsnull;
nsIAccessibilityService* accService = GetAccService();
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
nsresult rv;
if (mIsSelect1Element) {
if (aIndex != 0)
@ -481,7 +476,7 @@ nsXFormsSelectableAccessible::RefSelection(PRInt32 aIndex,
NS_ENSURE_SUCCESS(rv, rv);
if (item)
return accService->GetAccessibleFor(item, aAccessible);
return GetAccService()->GetAccessibleFor(item, aAccessible);
return NS_OK;
}
@ -502,7 +497,7 @@ nsXFormsSelectableAccessible::RefSelection(PRInt32 aIndex,
items->Item(aIndex, getter_AddRefs(item));
nsCOMPtr<nsIAccessible> accessible;
return accService->GetAccessibleFor(item, getter_AddRefs(accessible));
return GetAccService()->GetAccessibleFor(item, getter_AddRefs(accessible));
}
NS_IMETHODIMP

View File

@ -38,6 +38,8 @@
#include "nsXFormsFormControlsAccessible.h"
#include "nsTextEquivUtils.h"
// nsXFormsLabelAccessible
nsXFormsLabelAccessible::

View File

@ -38,7 +38,9 @@
#include "nsXULColorPickerAccessible.h"
#include "nsAccUtils.h"
#include "nsAccTreeWalker.h"
#include "nsCoreUtils.h"
#include "nsIDOMElement.h"

View File

@ -40,9 +40,10 @@
#include "nsXULComboboxAccessible.h"
#include "nsAccessibilityService.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULComboboxAccessible
@ -144,9 +145,8 @@ nsXULComboboxAccessible::GetDescription(nsAString& aDescription)
menuListElm->GetSelectedItem(getter_AddRefs(focusedOptionItem));
nsCOMPtr<nsIDOMNode> focusedOptionNode(do_QueryInterface(focusedOptionItem));
if (focusedOptionNode) {
nsCOMPtr<nsIAccessible> focusedOption;
GetAccService()->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell,
getter_AddRefs(focusedOption));
nsRefPtr<nsAccessible> focusedOption =
GetAccService()->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell);
NS_ENSURE_TRUE(focusedOption, NS_ERROR_FAILURE);
return focusedOption->GetDescription(aDescription);

View File

@ -37,11 +37,16 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsXULFormControlAccessible.h"
#include "nsHTMLFormControlAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccUtils.h"
#include "nsAccTreeWalker.h"
#include "nsCoreUtils.h"
#include "nsRelUtils.h"
// NOTE: alphabetically ordered
#include "nsHTMLFormControlAccessible.h"
#include "nsXULMenuAccessible.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSEditableElement.h"

View File

@ -40,10 +40,12 @@
#include "nsXULListboxAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULColumnsAccessible
@ -362,9 +364,8 @@ nsXULListboxAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
nsCOMPtr<nsIDOMNode> itemNode(do_QueryInterface(item));
nsCOMPtr<nsIAccessible> accessibleRow;
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell,
getter_AddRefs(accessibleRow));
nsRefPtr<nsAccessible> accessibleRow =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
NS_ENSURE_STATE(accessibleRow);
nsresult rv = accessibleRow->GetChildAt(aColumn, aAccessibleCell);
@ -629,19 +630,15 @@ nsXULListboxAccessible::GetSelectedCells(nsIArray **aCells)
for (; index < selectedItemsCount; index++) {
nsCOMPtr<nsIDOMNode> itemNode;
selectedItems->Item(index, getter_AddRefs(itemNode));
nsCOMPtr<nsIAccessible> item;
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell,
getter_AddRefs(item));
nsRefPtr<nsAccessible> item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item) {
nsCOMPtr<nsIAccessible> cell, nextCell;
item->GetFirstChild(getter_AddRefs(cell));
while (cell) {
PRInt32 cellCount = item->GetChildCount();
for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
nsAccessible *cell = mChildren[cellIdx];
if (nsAccUtils::Role(cell) == nsIAccessibleRole::ROLE_CELL)
selCells->AppendElement(cell, PR_FALSE);
cell->GetNextSibling(getter_AddRefs(nextCell));
nextCell.swap(cell);
selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
}
}
}
@ -877,7 +874,7 @@ nsXULListitemAccessible::
/** Inherit the ISupports impl from nsAccessible, we handle nsIAccessibleSelectable */
NS_IMPL_ISUPPORTS_INHERITED0(nsXULListitemAccessible, nsAccessible)
already_AddRefed<nsIAccessible>
already_AddRefed<nsAccessible>
nsXULListitemAccessible::GetListAccessible()
{
if (IsDefunct())
@ -895,9 +892,7 @@ nsXULListitemAccessible::GetListAccessible()
if (!listNode)
return nsnull;
nsIAccessible *listAcc = nsnull;
GetAccService()->GetAccessibleInWeakShell(listNode, mWeakShell, &listAcc);
return listAcc;
return GetAccService()->GetAccessibleInWeakShell(listNode, mWeakShell);
}
////////////////////////////////////////////////////////////////////////////////
@ -928,7 +923,7 @@ nsXULListitemAccessible::GetNameInternal(nsAString& aName)
nsresult
nsXULListitemAccessible::GetRoleInternal(PRUint32 *aRole)
{
nsCOMPtr<nsIAccessible> listAcc = GetListAccessible();
nsRefPtr<nsAccessible> listAcc = GetListAccessible();
NS_ENSURE_STATE(listAcc);
if (nsAccUtils::Role(listAcc) == nsIAccessibleRole::ROLE_TABLE) {

View File

@ -134,7 +134,10 @@ public:
virtual PRBool GetAllowsAnonChildAccessibles();
protected:
already_AddRefed<nsIAccessible> GetListAccessible();
/**
* Return listbox accessible for the listitem.
*/
already_AddRefed<nsAccessible> GetListAccessible();
private:
PRBool mIsCheckbox;

View File

@ -37,6 +37,11 @@
* ***** END LICENSE BLOCK ***** */
#include "nsXULMenuAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsXULFormControlAccessible.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIMutableArray.h"
@ -50,7 +55,6 @@
#include "nsIPresShell.h"
#include "nsIContent.h"
#include "nsGUIEvent.h"
#include "nsXULFormControlAccessible.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
@ -127,7 +131,6 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **aChildre
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect =
do_QueryInterface(mSelectControl);
nsCOMPtr<nsIAccessible> selectedAccessible;
if (xulMultiSelect) {
PRInt32 length = 0;
xulMultiSelect->GetSelectedCount(&length);
@ -135,10 +138,11 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **aChildre
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(selectedItem));
nsCOMPtr<nsIDOMNode> selectedNode(do_QueryInterface(selectedItem));
GetAccService()->GetAccessibleInWeakShell(selectedNode, mWeakShell,
getter_AddRefs(selectedAccessible));
if (selectedAccessible)
selectedAccessibles->AppendElement(selectedAccessible, PR_FALSE);
nsRefPtr<nsAccessible> selectedAcc =
GetAccService()->GetAccessibleInWeakShell(selectedNode, mWeakShell);
if (selectedAcc)
selectedAccessibles->AppendElement(static_cast<nsIAccessible*>(selectedAcc),
PR_FALSE);
}
}
else { // Single select?
@ -146,10 +150,11 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **aChildre
mSelectControl->GetSelectedItem(getter_AddRefs(selectedItem));
nsCOMPtr<nsIDOMNode> selectedNode(do_QueryInterface(selectedItem));
if(selectedNode) {
GetAccService()->GetAccessibleInWeakShell(selectedNode, mWeakShell,
getter_AddRefs(selectedAccessible));
if (selectedAccessible)
selectedAccessibles->AppendElement(selectedAccessible, PR_FALSE);
nsRefPtr<nsAccessible> selectedAcc =
GetAccService()->GetAccessibleInWeakShell(selectedNode, mWeakShell);
if (selectedAcc)
selectedAccessibles->AppendElement(static_cast<nsIAccessible*>(selectedAcc.get()),
PR_FALSE);
}
}
@ -179,11 +184,16 @@ NS_IMETHODIMP nsXULSelectableAccessible::RefSelection(PRInt32 aIndex, nsIAccessi
if (aIndex == 0)
mSelectControl->GetSelectedItem(getter_AddRefs(selectedItem));
if (selectedItem)
GetAccService()->GetAccessibleInWeakShell(selectedItem, mWeakShell,
aAccessible);
if (!selectedItem)
return NS_ERROR_FAILURE;
return (*aAccessible) ? NS_OK : NS_ERROR_FAILURE;
nsRefPtr<nsAccessible> selectedAcc =
GetAccService()->GetAccessibleInWeakShell(selectedItem, mWeakShell);
if (!selectedAcc)
return NS_ERROR_FAILURE;
CallQueryInterface(selectedAcc, aAccessible);
return NS_OK;
}
NS_IMETHODIMP nsXULSelectableAccessible::GetSelectionCount(PRInt32 *aSelectionCount)

View File

@ -38,8 +38,11 @@
#include "nsXULSliderAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIFrame.h"
// nsXULSliderAccessible

View File

@ -36,8 +36,12 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsXULTabAccessible.h"
#include "nsAccUtils.h"
#include "nsRelUtils.h"
// NOTE: alphabetically ordered
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIDOMDocument.h"

View File

@ -37,14 +37,19 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
// NOTE: groups are alphabetically ordered
#include "nsXULTextAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsCoreUtils.h"
#include "nsAccUtils.h"
#include "nsBaseWidgetAccessible.h"
#include "nsCoreUtils.h"
#include "nsRelUtils.h"
#include "nsTextEquivUtils.h"
#include "nsIDOMXULDescriptionElement.h"
#include "nsINameSpaceManager.h"
#include "nsString.h"
#include "nsXULTextAccessible.h"
#include "nsNetUtil.h"
/**

View File

@ -38,7 +38,11 @@
#include "nsXULTreeAccessible.h"
#include "nsAccCache.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsDocAccessible.h"
#include "nsRelUtils.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
@ -549,8 +553,7 @@ nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
// Remove accessible from document cache and tree cache.
nsCOMPtr<nsIAccessibleDocument> docAccessible = GetDocAccessible();
if (docAccessible) {
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(docAccessible);
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(docAccessible);
docAcc->RemoveAccessNodeFromCache(accessible);
}
@ -579,8 +582,7 @@ nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
// Remove accessible from document cache and tree cache.
nsCOMPtr<nsIAccessibleDocument> docAccessible = GetDocAccessible();
if (docAccessible) {
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(docAccessible);
nsRefPtr<nsDocAccessible> docAcc = do_QueryObject(docAccessible);
docAcc->RemoveAccessNodeFromCache(accessible);
}
@ -837,8 +839,7 @@ nsXULTreeItemAccessibleBase::GetRelationByType(PRUint32 aRelationType,
if (parentIndex == -1)
return nsRelUtils::AddTarget(aRelationType, aRelation, mParent);
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(mParent);
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
nsAccessible *logicalParent = treeAcc->GetTreeItemAccessible(parentIndex);
return nsRelUtils::AddTarget(aRelationType, aRelation, logicalParent);
@ -1106,8 +1107,7 @@ nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset,
if (aError)
*aError = NS_OK; // fail peacefully
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(mParent);
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
if (!treeAcc)
return nsnull;
@ -1290,8 +1290,7 @@ nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
PRInt32 rowCount = 0;
treeView->GetRowCount(&rowCount);
if (rowCount > 0 && aOffset <= rowCount) {
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(mParent);
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
if (treeAcc)
return treeAcc->GetTreeItemAccessible(aOffset - 1);

View File

@ -38,8 +38,12 @@
#include "nsXULTreeGridAccessibleWrap.h"
#include "nsAccCache.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsEventShell.h"
#include "nsITreeSelection.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible
@ -1041,12 +1045,12 @@ nsXULTreeGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
nsCOMPtr<nsIDOMElement> columnElm;
mColumn->GetElement(getter_AddRefs(columnElm));
nsCOMPtr<nsIAccessible> headerCell;
GetAccService()->GetAccessibleInWeakShell(columnElm, mWeakShell,
getter_AddRefs(headerCell));
nsRefPtr<nsAccessible> headerCell =
GetAccService()->GetAccessibleInWeakShell(columnElm, mWeakShell);
if (headerCell)
headerCells->AppendElement(headerCell, PR_FALSE);
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell.get()),
PR_FALSE);
NS_ADDREF(*aHeaderCells = headerCells);
return NS_OK;

View File

@ -62,7 +62,8 @@
gComputedStyle = document.defaultView.getComputedStyle(node, "");
var defAttrs = {
"font-style": gComputedStyle.fontStyle,
"font-size": (MAC) ? "8pt" : "10pt",
// The pt font size of the input element can vary by Linux distro.
"font-size": (WIN ? "10pt" : (MAC ? "8pt" : function() { return true; })),
"background-color": gComputedStyle.backgroundColor,
"font-weight": equalsToNormal,
"color": gComputedStyle.color,

View File

@ -54,7 +54,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
// Test for correct nsIDOMDocument retrieval.
var domDoc = null;
try {
domDoc = docAcc.document.QueryInterface(nsIDOMDocument);
domDoc = docAcc.DOMDocument.QueryInterface(nsIDOMDocument);
} catch(e) {}
ok(domDoc, "no nsIDOMDocument for this doc accessible!");
is(domDoc, document, "Document nodes do not match!");

View File

@ -46,6 +46,7 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
$(warning test_applicationacc.xul temporarily disabled, see bug 561508) \
test_aria_globals.html \
test_aria_imgmap.html \
test_button.xul \
@ -70,6 +71,7 @@ _TEST_FILES =\
test_txtcntr.html \
test_txtctrl.html \
test_txtctrl.xul \
wnd.xul \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,76 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible Application Accessible hierarchy tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
// Note: bug 560239 can be tested if this test runs in standalone mode only.
var gURL = "chrome://mochikit/content/a11y/accessible/tree/wnd.xul"
var gWnd = window.openDialog(gURL, "wnd", "chrome,width=600,height=600");
function doTest()
{
// Application accessible should contain two root document accessibles,
// one is for browser window, another one is for open dialog window.
var accTree = {
role: ROLE_APP_ROOT,
children: [
{
role: ROLE_CHROME_WINDOW,
name: "Accessibility Chrome Test Harness - Minefield"
},
{
role: ROLE_CHROME_WINDOW,
name: "Empty Window"
}
]
};
testAccessibleTree(getApplicationAccessible(), accTree);
gWnd.close();
SimpleTest.finish()
}
SimpleTest.waitForExplicitFinish();
// We need to open dialog window before accessibility is started.
addLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=560239"
title="no children of application accessible for windows open before accessibility was started">
Mozilla Bug 560239
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</hbox>
</window>

View File

@ -55,6 +55,9 @@
children: [
{
role: ROLE_TEXT_LEAF // HTML 5 placeholder attribute value
},
{
role: ROLE_TEXT_LEAF // Text node for the node's value
}
]
},
@ -125,6 +128,9 @@
children: [
{
role: ROLE_TEXT_LEAF // HTML 5 placeholder attribute value
},
{
role: ROLE_TEXT_LEAF // Text node for the node's value
}
]
},

View File

@ -86,9 +86,6 @@
}
]
},
{
role: ROLE_PUSHBUTTON
},
{
role: ROLE_PUSHBUTTON
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Empty Window">
</window>

View File

@ -58,7 +58,7 @@ var FullZoom = {
// The global value (if any) for the setting. Lazily loaded from the service
// when first requested, then updated by the pref change listener as it changes.
// If there is no global value, then this should be undefined.
get globalValue FullZoom_get_globalValue() {
get globalValue() {
var globalValue = this._cps.getPref(null, this.name);
if (typeof globalValue != "undefined")
globalValue = this._ensureValid(globalValue);
@ -71,7 +71,7 @@ var FullZoom = {
// Convenience Getters
// Content Pref Service
get _cps FullZoom_get__cps() {
get _cps() {
delete this._cps;
return this._cps = Cc["@mozilla.org/content-pref/service;1"].
getService(Ci.nsIContentPrefService);
@ -86,7 +86,7 @@ var FullZoom = {
// whether we are in private browsing mode
_inPrivateBrowsing: false,
get siteSpecific FullZoom_get_siteSpecific() {
get siteSpecific() {
return !this._inPrivateBrowsing && this._siteSpecificPref;
},

View File

@ -621,8 +621,9 @@ var allTabs = {
prefName: "browser.allTabs.previews",
readPref: function allTabs_readPref() {
var allTabsButton = document.getAnonymousElementByAttribute(
gBrowser.tabContainer, "anonid", "alltabs-button");
var allTabsButton = document.getElementById("alltabs-button");
if (!allTabsButton)
return;
if (gPrefService.getBoolPref(this.prefName)) {
allTabsButton.removeAttribute("type");
allTabsButton.setAttribute("command", "Browser:ShowAllTabs");

View File

@ -13,10 +13,21 @@ tabbrowser {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tabs");
}
#tabbrowser-tabs:not([overflow="true"]) + #new-tab-button,
#tabbrowser-tabs[overflow="true"] > .tabbrowser-arrowscrollbox > .tabs-newtab-button,
#TabsToolbar[currentset]:not([currentset*="tabbrowser-tabs,new-tab-button"]) > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .tabs-newtab-button,
#navigator-toolbox[customizing="true"] > #TabsToolbar > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .tabs-newtab-button {
visibility: collapse;
}
.tabbrowser-tab {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tab");
}
#alltabs-popup {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup");
}
toolbar[printpreview="true"] {
-moz-binding: url("chrome://global/content/printPreviewBindings.xml#printpreviewtoolbar");
}
@ -155,7 +166,7 @@ menuitem.spell-suggestion {
font-weight: bold;
}
#sidebar-box toolbarbutton.tabs-closebutton {
#sidebar-header > .tabs-closebutton {
-moz-user-focus: normal;
}

View File

@ -2196,15 +2196,15 @@ function losslessDecodeURI(aURI) {
encodeURIComponent);
} catch (e) {}
// Encode invisible characters (soft hyphen, zero-width space, BOM,
// line and paragraph separator, word joiner, invisible times,
// invisible separator, object replacement character) (bug 452979)
value = value.replace(/[\v\x0c\x1c\x1d\x1e\x1f\u00ad\u200b\ufeff\u2028\u2029\u2060\u2062\u2063\ufffc]/g,
// Encode invisible characters (line and paragraph separator,
// object replacement character) (bug 452979)
value = value.replace(/[\v\x0c\x1c\x1d\x1e\x1f\u2028\u2029\ufffc]/g,
encodeURIComponent);
// Encode bidirectional formatting characters.
// Encode default ignorable characters. (bug 546013)
// This includes all bidirectional formatting characters.
// (RFC 3987 sections 3.2 and 4.1 paragraph 6)
value = value.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
value = value.replace(/[\u00ad\u034f\u115f-\u1160\u17b4-\u17b5\u180b-\u180d\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufff8]|\ud834[\udd73-\udd7a]|[\udb40-\udb43][\udc00-\udfff]/g,
encodeURIComponent);
return value;
}
@ -3355,8 +3355,6 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
CombinedStopReload.init();
gHomeButton.updatePersonalToolbarStyle();
// Update the urlbar
if (gURLBar) {
URLBarSetURI();
@ -3380,11 +3378,12 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
// XXX Shouldn't have to do this, but I do
if (!gCustomizeSheet)
window.focus();
}
function BrowserToolboxCustomizeChange() {
gHomeButton.updatePersonalToolbarStyle();
allTabs.readPref();
}
/**
@ -6316,6 +6315,11 @@ var gPluginHandler = {
link.href = gPluginHandler.crashReportHelpURL;
let description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
description.appendChild(link);
// Remove the notfication when the page is reloaded.
doc.defaultView.top.addEventListener("unload", function() {
notificationBox.removeNotification(notification);
}, false);
}
}
@ -7151,7 +7155,7 @@ let gPrivateBrowsingUI = {
Services.obs.removeObserver(this, "private-browsing-transition-complete");
},
get _disableUIOnToggle PBUI__disableUIOnTogle() {
get _disableUIOnToggle() {
if (this._privateBrowsingService.autoStarted)
return false;
@ -7353,7 +7357,7 @@ let gPrivateBrowsingUI = {
!this.privateBrowsingEnabled;
},
get privateBrowsingEnabled PBUI_get_privateBrowsingEnabled() {
get privateBrowsingEnabled() {
return this._privateBrowsingService.privateBrowsingEnabled;
}
};

View File

@ -563,7 +563,13 @@
<toolbar id="TabsToolbar"
fullscreentoolbar="true"
customizable="true"
mode="icons" lockmode="true"
iconsize="small" defaulticonsize="small" lockiconsize="true"
context="toolbar-context-menu"
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton"
collapsed="true">
<tabs id="tabbrowser-tabs"
class="tabbrowser-tabs"
context="tabContextMenu"
@ -573,6 +579,34 @@
tooltip="tabbrowser-tab-tooltip">
<tab class="tabbrowser-tab" selected="true"/>
</tabs>
<toolbarbutton id="new-tab-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&tabCmd.label;"
command="cmd_newNavigatorTab"
tooltiptext="&newTabButton.tooltip;"
ondrop="newTabButtonObserver.onDrop(event)"
ondragover="newTabButtonObserver.onDragOver(event)"
ondragenter="newTabButtonObserver.onDragOver(event)"
ondragleave="newTabButtonObserver.onDragLeave(event)"
removable="true"/>
<toolbarbutton id="alltabs-button"
class="toolbarbutton-1 chromeclass-toolbar-additional tabs-alltabs-button"
type="menu"
label="&listAllTabs.label;"
tooltiptext="&listAllTabs.label;"
removable="true">
<menupopup id="alltabs-popup"
position="after_end"/>
</toolbarbutton>
<toolbarbutton id="tabs-closebutton"
class="close-button tabs-closebutton"
command="cmd_close"
label="&closeTab.label;"
tooltiptext="&closeTab.label;"/>
</toolbar>
<toolbarpalette id="BrowserToolbarPalette">
@ -607,15 +641,6 @@
ondragenter="bookmarksButtonObserver.onDragOver(event)"
ondragleave="bookmarksButtonObserver.onDragLeave(event)"/>
<toolbarbutton id="new-tab-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&tabCmd.label;"
command="cmd_newNavigatorTab"
tooltiptext="&newTabButton.tooltip;"
ondrop="newTabButtonObserver.onDrop(event)"
ondragover="newTabButtonObserver.onDragOver(event)"
ondragenter="newTabButtonObserver.onDragOver(event)"
ondragleave="newTabButtonObserver.onDragLeave(event)"/>
<toolbarbutton id="new-window-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&newNavigatorCmd.label;"
command="key_newNavigator"

View File

@ -78,7 +78,7 @@
<script type="application/javascript"
src="chrome://browser/content/places/treeView.js"/>
<script type="application/javascript"><![CDATA[
Components.utils.import("resource://gre/modules/utils.js");
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource:///modules/PlacesUIUtils.jsm");
]]></script>
#endif

View File

@ -6,16 +6,8 @@
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-arrowscrollbox");
}
.tabs-alltabs-popup {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup");
}
.tab-close-button,
.tabs-closebutton {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-close-tab-button");
}
.tab-close-button {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-close-tab-button");
display: none;
}
@ -24,15 +16,6 @@
display: -moz-box;
}
.tabbrowser-tabs:not([overflow="true"]) > .tabs-newtab-button,
.tabbrowser-tabs[overflow="true"] > .tabbrowser-arrowscrollbox > .tabs-newtab-button {
visibility: collapse;
}
.tabs-newtab-button > .toolbarbutton-text {
display: none;
}
tabpanels {
background-color: white;
}
@ -41,10 +24,3 @@ tabpanels {
position: relative;
z-index: 1;
}
%ifdef MOZ_WIDGET_GTK2
/* Favicons override the "images-in-menus" metric in xul.css */
.alltabs-item > .menu-iconic-left {
visibility: inherit;
}
%endif

View File

@ -2457,17 +2457,6 @@
command="cmd_newNavigatorTab"
tooltiptext="&newTabButton.tooltip;"/>
</xul:arrowscrollbox>
<xul:toolbarbutton class="tabs-newtab-button" anonid="newtab-button"
command="cmd_newNavigatorTab"
tooltiptext="&newTabButton.tooltip;"/>
<xul:toolbarbutton class="tabs-alltabs-button" anonid="alltabs-button"
type="menu"
tooltiptext="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup" anonid="alltabs-popup"
position="after_end"/>
</xul:toolbarbutton>
<xul:toolbarbutton anonid="tabs-closebutton"
class="close-button tabs-closebutton"/>
</content>
<implementation implements="nsIDOMEventListener">
@ -2525,10 +2514,6 @@
document.getAnonymousElementByAttribute(this, "anonid", "arrowscrollbox");
</field>
<field name="mTabstripClosebutton">
document.getAnonymousElementByAttribute(this, "anonid", "tabs-closebutton");
</field>
<field name="_prefObserver"><![CDATA[({
tabContainer: this,
@ -2618,7 +2603,9 @@
this.setAttribute("closebuttons", "noclose");
break;
}
this.mTabstripClosebutton.collapsed = this.mCloseButtons != 3;
var tabstripClosebutton = document.getElementById("tabs-closebutton");
if (tabstripClosebutton && tabstripClosebutton.parentNode == this._container)
tabstripClosebutton.collapsed = this.mCloseButtons != 3;
]]></body>
</method>
@ -2660,11 +2647,6 @@
]]></body>
</method>
<field name="mAllTabsPopup">
document.getAnonymousElementByAttribute(this,
"anonid", "alltabs-popup");
</field>
<field name="_animateElement">
this.mTabstrip._scrollButtonDown;
</field>
@ -2780,6 +2762,12 @@
this.mTabstrip.ensureElementIsVisible(t);
]]></body>
</method>
<!-- Deprecated stuff, implemented for backwards compatibility. -->
<property name="mTabstripClosebutton" readonly="true"
onget="return document.getElementById('tabs-closebutton');"/>
<property name="mAllTabsPopup" readonly="true"
onget="return document.getElementById('alltabs-popup');"/>
</implementation>
<handlers>
@ -2852,8 +2840,6 @@
pixelsToScroll = tabStrip.scrollIncrement * -1;
break;
case "scrollbutton-down":
case "alltabs-button":
case "newtab-button":
pixelsToScroll = tabStrip.scrollIncrement;
break;
}
@ -3078,59 +3064,54 @@
<handlers>
<handler event="click" button="0"><![CDATA[
var bindingParent = document.getBindingParent(this);
var tabContainer = bindingParent.parentNode;
/* The only sequence in which a second click event (i.e. dblclik)
* can be dispatched on an in-tab close button is when it is shown
* after the first click (i.e. the first click event was dispatched
* on the tab). This happens when we show the close button only on
* the active tab. (bug 352021)
* The only sequence in which a third click event can be dispatched
* on an in-tab close button is when the tab was opened with a
* double click on the tabbar. (bug 378344)
* In both cases, it is most likely that the close button area has
* been accidentally clicked, therefore we do not close the tab.
*
* We don't want to ignore processing of more than one click event,
* though, since the user might actually be repeatedly clicking to
* close many tabs at once.
*/
if (event.detail > 1 && !this._ignoredClick) {
this._ignoredClick = true;
return;
}
if (bindingParent.localName == "tab") {
let tabContainer = bindingParent.parentNode;
/* The only sequence in which a second click event (i.e. dblclik)
* can be dispatched on an in-tab close button is when it is shown
* after the first click (i.e. the first click event was dispatched
* on the tab). This happens when we show the close button only on
* the active tab. (bug 352021)
* The only sequence in which a third click event can be dispatched
* on an in-tab close button is when the tab was opened with a
* double click on the tabbar. (bug 378344)
* In both cases, it is most likely that the close button area has
* been accidentally clicked, therefore we do not close the tab.
*
* We don't want to ignore processing of more than one click event,
* though, since the user might actually be repeatedly clicking to
* close many tabs at once.
*/
if (event.detail > 1 && !this._ignoredClick) {
this._ignoredClick = true;
// Reset the "ignored click" flag
this._ignoredClick = false;
tabContainer.tabbrowser.removeTab(bindingParent);
this._blockDblClick = true;
/* XXXmano hack (see bug 343628):
* Since we're removing the event target, if the user
* double-clicks this button, the dblclick event will be dispatched
* with the tabbar as its event target (and explicit/originalTarget),
* which treats that as a mouse gesture for opening a new tab.
* In this context, we're manually blocking the dblclick event
* (see dblclick handler).
*/
var self = this;
var clickedOnce = false;
function enableDblClick(event) {
if (event.detail == 1 && !clickedOnce) {
clickedOnce = true;
return;
}
// Reset the "ignored click" flag
this._ignoredClick = false;
tabContainer.tabbrowser.removeTab(bindingParent);
this._blockDblClick = true;
/* XXXmano hack (see bug 343628):
* Since we're removing the event target, if the user
* double-clicks this button, the dblclick event will be dispatched
* with the tabbar as its event target (and explicit/originalTarget),
* which treats that as a mouse gesture for opening a new tab.
* In this context, we're manually blocking the dblclick event
* (see dblclick handler).
*/
let self = this;
let clickedOnce = false;
function enableDblClick(event) {
if (event.detail == 1 && !clickedOnce) {
clickedOnce = true;
return;
}
setTimeout(function() {
self._blockDblClick = false;
}, 0);
tabContainer.removeEventListener("click", enableDblClick, false);
}
tabContainer.addEventListener("click", enableDblClick, false);
setTimeout(function() {
self._blockDblClick = false;
}, 0);
tabContainer.removeEventListener("click", enableDblClick, false);
}
else // "tabs"
bindingParent.tabbrowser.removeCurrentTab();
tabContainer.addEventListener("click", enableDblClick, false);
]]></handler>
<handler event="dblclick" button="0" phase="capturing">
@ -3213,8 +3194,7 @@
<method name="_menuItemOnCommand">
<parameter name="aEvent"/>
<body><![CDATA[
var tabcontainer = document.getBindingParent(this);
tabcontainer.selectedItem = aEvent.target.tab;
gBrowser.selectedTab = aEvent.target.tab;
]]></body>
</method>
@ -3263,7 +3243,7 @@
<method name="_updateTabsVisibilityStatus">
<body><![CDATA[
var tabContainer = document.getBindingParent(this);
var tabContainer = gBrowser.tabContainer;
// We don't want menu item decoration unless there is overflow.
if (tabContainer.getAttribute("overflow") != "true")
return;
@ -3287,7 +3267,7 @@
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"menuitem");
menuItem.setAttribute("class", "menuitem-iconic alltabs-item");
menuItem.setAttribute("class", "menuitem-iconic alltabs-item menuitem-with-favicon");
this._setMenuitemAttributes(menuItem, aTab);
@ -3327,7 +3307,7 @@
<handler event="popupshowing">
<![CDATA[
// set up the menu popup
var tabcontainer = document.getBindingParent(this);
var tabcontainer = gBrowser.tabContainer;
var tabs = tabcontainer.childNodes;
// Listen for changes in the tab bar.
@ -3351,7 +3331,7 @@
menuItem.tab.mCorrespondingMenuitem = null;
this.removeChild(menuItem);
}
var tabcontainer = document.getBindingParent(this);
var tabcontainer = gBrowser.tabContainer;
tabcontainer.mTabstrip.removeEventListener("scroll", this, false);
tabcontainer.removeEventListener("TabOpen", this, false);
tabcontainer.removeEventListener("TabAttrModified", this, false);

View File

@ -18,7 +18,6 @@ browser.jar:
content/browser/aboutRobots-icon-rtl.png (content/aboutRobots-icon-rtl.png)
content/browser/aboutRobots-widget-left.png (content/aboutRobots-widget-left.png)
content/browser/aboutRobots-widget-right.png (content/aboutRobots-widget-right.png)
* content/browser/aboutSupport.xhtml (content/aboutSupport.xhtml)
* content/browser/browser.css (content/browser.css)
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)

View File

@ -96,8 +96,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT },
{ "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
{ "support", "chrome://browser/content/aboutSupport.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
};
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);

View File

@ -189,11 +189,6 @@ static const nsModuleComponentInfo components[] =
NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore",
AboutRedirector::Create },
{ "about:support",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "support",
AboutRedirector::Create },
#ifndef WINCE
{ "Profile Migrator",

View File

@ -764,7 +764,7 @@ BrowserGlue.prototype = {
// from bookmarks.html, we will try to restore from JSON
if (importBookmarks && !restoreDefaultBookmarks && !importBookmarksHTML) {
// get latest JSON backup
Cu.import("resource://gre/modules/utils.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
var bookmarksBackupFile = PlacesUtils.backups.getMostRecent("json");
if (bookmarksBackupFile) {
// restore from JSON backup
@ -894,7 +894,7 @@ BrowserGlue.prototype = {
* Backup bookmarks if needed.
*/
_backupBookmarks: function BG__backupBookmarks() {
Cu.import("resource://gre/modules/utils.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
let lastBackupFile = PlacesUtils.backups.getMostRecent();
@ -1171,8 +1171,13 @@ BrowserGlue.prototype = {
// If we are creating all Smart Bookmarks from ground up, add a
// separator below them in the bookmarks menu.
if (smartBookmarksCurrentVersion == 0 &&
smartBookmarkItemIds.length == 0)
bmsvc.insertSeparator(bmsvc.bookmarksMenuFolder, bookmarksMenuIndex);
smartBookmarkItemIds.length == 0) {
let id = bmsvc.getIdForItemAt(bmsvc.bookmarksMenuFolder,
bookmarksMenuIndex);
// Don't add a separator if the menu was empty or there is one already.
if (id != -1 && bmsvc.getItemType(id) != bmsvc.TYPE_SEPARATOR)
bmsvc.insertSeparator(bmsvc.bookmarksMenuFolder, bookmarksMenuIndex);
}
}
};

View File

@ -1181,7 +1181,7 @@ PlacesController.prototype = {
copiedFolders.push(node);
function generateChunk(type, overrideURI) {
let suffix = i < (nodes.length - 1) ? NEWLINE : "";
let suffix = i < (nodes.length - 1) ? PlacesUtils.endl : "";
let uri = overrideURI;
if (PlacesUtils.nodeIsLivemarkContainer(node))

View File

@ -58,7 +58,7 @@
var Ci = Components.interfaces;
var Cr = Components.results;
Components.utils.import("resource://gre/modules/utils.js");
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource:///modules/PlacesUIUtils.jsm");
]]></script>
<script type="application/javascript"

View File

@ -55,19 +55,10 @@ XPCOMUtils.defineLazyGetter(this, "Services", function() {
});
XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
Cu.import("resource://gre/modules/utils.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
return PlacesUtils;
});
#ifdef XP_MACOSX
// On Mac OSX, the transferable system converts "\r\n" to "\n\n", where we
// really just want "\n".
const NEWLINE= "\n";
#else
// On other platforms, the transferable system converts "\r\n" to "\n".
const NEWLINE = "\r\n";
#endif
var PlacesUIUtils = {
ORGANIZER_LEFTPANE_VERSION: 6,
ORGANIZER_FOLDER_ANNO: "PlacesOrganizer/OrganizerFolder",

View File

@ -57,7 +57,7 @@ XPCOMUtils.defineLazyGetter(this, "Services", function() {
});
XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
Cu.import("resource://gre/modules/utils.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
return PlacesUtils;
});

View File

@ -7,8 +7,6 @@
<H1 LAST_MODIFIED="1177541029">Bookmarks</H1>
<DL><p>
<DT><A HREF="https://en-US.add-ons.mozilla.com/en-US/firefox/bookmarks/" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M%2F3AAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAPkSURBVHjaYmAAgrjyOnOGiKxqxT9%2F%2FvwHCCCGuNJKLpAo49KTL%2F5%2F%2F8PMABBADJFZFWwXnn%2F%2FDxJYeOLNf0aQ9AIg48%2Ff%2Fwwfvv1hAAggZpBAYlWdnrqJLcPVE4e%2Bsuy7%2FfH%2F%2B88%2FGdjY2Bj%2BcCqHMey6%2Ben%2F379%2F%2F%2F8B6unZ9ew%2Fy54jV249f6%2Bm9uXnX4Y9qyaoAAQAhAB7%2FwEAAAAAY3h%2BG1RdbeMMCgkB9%2Fr%2BAPL2%2FAC3vsyi5NG6YQFcbnwdZ3F44uru9gAAAQAAUjEVALPT7wDu9v4A5erz%2FgL19vr16PD6AAUHBgDu9PwA%2F%2F8AAO%2F2%2FgD0%2BP0A7e7x8QPYzsX38vj9g%2BPk6hkLFiAxy%2BP4AeHj5%2FXFtp9GonxaagII7AawXyprpf%2F%2FZ5L5%2Fe%2Fv9%2B%2Fff91ZN7nrG0icJSqrkknJxHm1h5Nl0J8%2F%2Fxg%2B%2FwDa%2Febzv39%2FWKQ2TG97ycIvq%2Bvn52oVxMHGxHDj8RcGQT4uEGZyCct98e3LL3YmJ2enNYxAi%2B48%2B8QQaizGIMLFBLaSlYWZgYWDWZaJhY2V%2BcvPfwz%2BeiIMf%2F%2F%2BY9CV4GAQ42Zh%2BPPvP8O%2Fv%2F%2BZmG7cff7u49c%2FDNtufGZgYmJiOHLvG8Pt1z8Yfv3%2Bz%2FDn19%2B3TCd2LNV7%2F%2FU3w7vPvxkWnHzDcOPFd4ZvQBPv3L79aM%2BS3nfMN88d%2BfyXkW0Lq6BiGAs7J8fHT9%2F%2FXTy%2BY82Lp0cdb5889hcgQJNU85JYFMXP%2B5aHqRmmZJ9kKMGAEBgtDCYYY6BFa%2BlrPc6yRf0LYYtZzG4YaNGibUNJVLuIcBNUTLMQM8ZoppdiaXnf9Xlf5z4ounDu4p57f%2Ff8Pt50SH9ZEfUuLehy93yMRBNroVAg6PV2yBbO9c94tK5v7suF3%2FlMs1o8oU27ltvIMic7fJv7uuqLJGa2UpPxlCILICBtGz1pYWooakeoDaTFgBtNWm04zl%2Fkbs53FnZ%2FZO%2BldGbFP5aaP50cj41pigi8XFjF2zp8ivpgsFMFHp0GgrQZL4DuYGCE6f3pzoBnUwRB8sYi4QGKHf7b5d8HiHWpMBsPvLKDeFiHmVEPBN0yMJyMIUhfb6gXbMkr4xtq1J6Z36eLpmiDH508LNShbDzB4kTIATguNsBqA1CHElJDhGdCGWsDkYY%2FTJh3lUelu384yTlzrtgDWVaggvG8qhDnYcEwwWi0wET%2FTNTh9Gh%2FvVn7v%2B2I%2BHlpWXS59ORgfOr7UGRkVNMUAWPtCMnHdbjjATFNKJeKpdLZYQY0crDzLUvfbHxdqfllj6a7p2VVjUqyGhYwPpZFqxYlf6hZ%2F7X3c736%2Fv4LV1blv94gEvsAAAAASUVORK5CYII%3D" ID="rdf:#$CnoJ1">Get Bookmark Add-ons</A>
<HR>
<DT><H3 ID="rdf:#$ZvPhC3">Mozilla Firefox</H3>
<DL><p>
<DT><A HREF="http://en-US.www.mozilla.com/en-US/firefox/help/" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==" ID="rdf:#$22iCK1">Help and Tutorials</A>

View File

@ -7,8 +7,6 @@
<H1 LAST_MODIFIED="1177541029">Bookmarks</H1>
<DL><p>
<DT><A HREF="https://en-US.add-ons.mozilla.com/en-US/firefox/bookmarks/" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M%2F3AAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAPkSURBVHjaYmAAgrjyOnOGiKxqxT9%2F%2FvwHCCCGuNJKLpAo49KTL%2F5%2F%2F8PMABBADJFZFWwXnn%2F%2FDxJYeOLNf0aQ9AIg48%2Ff%2Fwwfvv1hAAggZpBAYlWdnrqJLcPVE4e%2Bsuy7%2FfH%2F%2B88%2FGdjY2Bj%2BcCqHMey6%2Ben%2F379%2F%2F%2F8B6unZ9ew%2Fy54jV249f6%2Bm9uXnX4Y9qyaoAAQAhAB7%2FwEAAAAAY3h%2BG1RdbeMMCgkB9%2Fr%2BAPL2%2FAC3vsyi5NG6YQFcbnwdZ3F44uru9gAAAQAAUjEVALPT7wDu9v4A5erz%2FgL19vr16PD6AAUHBgDu9PwA%2F%2F8AAO%2F2%2FgD0%2BP0A7e7x8QPYzsX38vj9g%2BPk6hkLFiAxy%2BP4AeHj5%2FXFtp9GonxaagII7AawXyprpf%2F%2FZ5L5%2Fe%2Fv9%2B%2Fff91ZN7nrG0icJSqrkknJxHm1h5Nl0J8%2F%2Fxg%2B%2FwDa%2Febzv39%2FWKQ2TG97ycIvq%2Bvn52oVxMHGxHDj8RcGQT4uEGZyCct98e3LL3YmJ2enNYxAi%2B48%2B8QQaizGIMLFBLaSlYWZgYWDWZaJhY2V%2BcvPfwz%2BeiIMf%2F%2F%2BY9CV4GAQ42Zh%2BPPvP8O%2Fv%2F%2BZmG7cff7u49c%2FDNtufGZgYmJiOHLvG8Pt1z8Yfv3%2Bz%2FDn19%2B3TCd2LNV7%2F%2FU3w7vPvxkWnHzDcOPFd4ZvQBPv3L79aM%2BS3nfMN88d%2BfyXkW0Lq6BiGAs7J8fHT9%2F%2FXTy%2BY82Lp0cdb5889hcgQJNU85JYFMXP%2B5aHqRmmZJ9kKMGAEBgtDCYYY6BFa%2BlrPc6yRf0LYYtZzG4YaNGibUNJVLuIcBNUTLMQM8ZoppdiaXnf9Xlf5z4ounDu4p57f%2Ff8Pt50SH9ZEfUuLehy93yMRBNroVAg6PV2yBbO9c94tK5v7suF3%2FlMs1o8oU27ltvIMic7fJv7uuqLJGa2UpPxlCILICBtGz1pYWooakeoDaTFgBtNWm04zl%2Fkbs53FnZ%2FZO%2BldGbFP5aaP50cj41pigi8XFjF2zp8ivpgsFMFHp0GgrQZL4DuYGCE6f3pzoBnUwRB8sYi4QGKHf7b5d8HiHWpMBsPvLKDeFiHmVEPBN0yMJyMIUhfb6gXbMkr4xtq1J6Z36eLpmiDH508LNShbDzB4kTIATguNsBqA1CHElJDhGdCGWsDkYY%2FTJh3lUelu384yTlzrtgDWVaggvG8qhDnYcEwwWi0wET%2FTNTh9Gh%2FvVn7v%2B2I%2BHlpWXS59ORgfOr7UGRkVNMUAWPtCMnHdbjjATFNKJeKpdLZYQY0crDzLUvfbHxdqfllj6a7p2VVjUqyGhYwPpZFqxYlf6hZ%2F7X3c736%2Fv4LV1blv94gEvsAAAAASUVORK5CYII%3D" ID="rdf:#$CnoJ1">Get Bookmark Add-ons</A>
<HR>
<DT><H3 ID="rdf:#$ZvPhC3">Mozilla Firefox</H3>
<DL><p>
<DT><A HREF="http://en-US.www.mozilla.com/en-US/firefox/help/" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==" ID="rdf:#$22iCK1">Help and Tutorials</A>

View File

@ -108,4 +108,4 @@ const SMART_BOOKMARKS_ON_MENU = 3; // Takes in count the additional separator.
// Default bookmarks constants.
const DEFAULT_BOOKMARKS_ON_TOOLBAR = 2;
const DEFAULT_BOOKMARKS_ON_MENU = 3;
const DEFAULT_BOOKMARKS_ON_MENU = 1;

View File

@ -45,7 +45,6 @@ const LOAD_IN_SIDEBAR_ANNO = "bookmarkProperties/loadInSidebar";
const DESCRIPTION_ANNO = "bookmarkProperties/description";
const POST_DATA_ANNO = "bookmarkProperties/POSTData";
Components.utils.import("resource://gre/modules/utils.js");
do_check_eq(typeof PlacesUtils, "object");
// main
@ -161,10 +160,10 @@ function testCanonicalBookmarks() {
// 6-2: the toolbar contents are imported to the places-toolbar folder,
// the separator above it is removed.
do_check_eq(rootNode.childCount, 4);
do_check_eq(rootNode.childCount, DEFAULT_BOOKMARKS_ON_MENU + 1);
// get test folder
var testFolder = rootNode.getChild(3);
var testFolder = rootNode.getChild(DEFAULT_BOOKMARKS_ON_MENU);
do_check_eq(testFolder.type, testFolder.RESULT_TYPE_FOLDER);
do_check_eq(testFolder.title, "test");

Some files were not shown because too many files have changed in this diff Show More