Browse Source

Base import of Tycho code (warning: huge commit)

Tycho
Pale Moon 6 years ago
parent
commit
3d8ce1a11a
  1. 1
      .clang-format
  2. 3
      .clang-format-ignore
  3. 2
      .gdbinit
  4. 31
      .lldbinit
  5. 27
      .ycm_extra_conf.py
  6. 1
      AUTHORS
  7. 2
      CLOBBER
  8. 244
      Makefile.in
  9. 2
      README.md
  10. 0
      accessible/atk/ARIAGridAccessibleWrap.h
  11. 1443
      accessible/atk/AccessibleWrap.cpp
  12. 106
      accessible/atk/AccessibleWrap.h
  13. 168
      accessible/atk/ApplicationAccessibleWrap.cpp
  14. 35
      accessible/atk/ApplicationAccessibleWrap.h
  15. 155
      accessible/atk/AtkSocketAccessible.cpp
  16. 56
      accessible/atk/AtkSocketAccessible.h
  17. 0
      accessible/atk/DocAccessibleWrap.cpp
  18. 0
      accessible/atk/DocAccessibleWrap.h
  19. 0
      accessible/atk/HTMLTableAccessibleWrap.h
  20. 0
      accessible/atk/HyperTextAccessibleWrap.h
  21. 0
      accessible/atk/ImageAccessibleWrap.h
  22. 0
      accessible/atk/InterfaceInitFuncs.h
  23. 365
      accessible/atk/Platform.cpp
  24. 0
      accessible/atk/RootAccessibleWrap.cpp
  25. 34
      accessible/atk/RootAccessibleWrap.h
  26. 0
      accessible/atk/TextLeafAccessibleWrap.h
  27. 0
      accessible/atk/UtilInterface.cpp
  28. 0
      accessible/atk/XULListboxAccessibleWrap.h
  29. 0
      accessible/atk/XULMenuAccessibleWrap.h
  30. 0
      accessible/atk/XULTreeGridAccessibleWrap.h
  31. 59
      accessible/atk/moz.build
  32. 54
      accessible/atk/nsMai.h
  33. 0
      accessible/atk/nsMaiHyperlink.cpp
  34. 44
      accessible/atk/nsMaiHyperlink.h
  35. 122
      accessible/atk/nsMaiInterfaceAction.cpp
  36. 114
      accessible/atk/nsMaiInterfaceComponent.cpp
  37. 117
      accessible/atk/nsMaiInterfaceDocument.cpp
  38. 120
      accessible/atk/nsMaiInterfaceEditableText.cpp
  39. 0
      accessible/atk/nsMaiInterfaceHyperlinkImpl.cpp
  40. 79
      accessible/atk/nsMaiInterfaceHypertext.cpp
  41. 69
      accessible/atk/nsMaiInterfaceImage.cpp
  42. 0
      accessible/atk/nsMaiInterfaceSelection.cpp
  43. 0
      accessible/atk/nsMaiInterfaceTable.cpp
  44. 491
      accessible/atk/nsMaiInterfaceText.cpp
  45. 108
      accessible/atk/nsMaiInterfaceValue.cpp
  46. 117
      accessible/atk/nsStateMap.h
  47. 860
      accessible/base/ARIAMap.cpp
  48. 264
      accessible/base/ARIAMap.h
  49. 376
      accessible/base/ARIAStateMap.cpp
  50. 67
      accessible/base/ARIAStateMap.h
  51. 0
      accessible/base/AccCollector.cpp
  52. 95
      accessible/base/AccCollector.h
  53. 273
      accessible/base/AccEvent.cpp
  54. 557
      accessible/base/AccEvent.h
  55. 227
      accessible/base/AccGroupInfo.cpp
  56. 114
      accessible/base/AccGroupInfo.h
  57. 456
      accessible/base/AccIterator.cpp
  58. 362
      accessible/base/AccIterator.h
  59. 91
      accessible/base/AccTypes.h
  60. 26
      accessible/base/Asserts.cpp
  61. 553
      accessible/base/DocManager.cpp
  62. 194
      accessible/base/DocManager.h
  63. 590
      accessible/base/EventQueue.cpp
  64. 93
      accessible/base/EventQueue.h
  65. 0
      accessible/base/Filters.cpp
  66. 56
      accessible/base/Filters.h
  67. 419
      accessible/base/FocusManager.cpp
  68. 134
      accessible/base/FocusManager.h
  69. 839
      accessible/base/Logging.cpp
  70. 197
      accessible/base/Logging.h
  71. 449
      accessible/base/NotificationController.cpp
  72. 316
      accessible/base/NotificationController.h
  73. 72
      accessible/base/Platform.h
  74. 109
      accessible/base/Relation.h
  75. 137
      accessible/base/RelationType.h
  76. 130
      accessible/base/RelationTypeMap.h
  77. 798
      accessible/base/Role.h
  78. 1057
      accessible/base/RoleMap.h
  79. 239
      accessible/base/SelectionManager.cpp
  80. 132
      accessible/base/SelectionManager.h
  81. 285
      accessible/base/States.h
  82. 39
      accessible/base/Statistics.h
  83. 126
      accessible/base/StyleInfo.cpp
  84. 48
      accessible/base/StyleInfo.h
  85. 884
      accessible/base/TextAttrs.cpp
  86. 478
      accessible/base/TextAttrs.h
  87. 300
      accessible/base/TextRange.cpp
  88. 257
      accessible/base/TextRange.h
  89. 0
      accessible/base/TextUpdater.cpp
  90. 0
      accessible/base/TextUpdater.h
  91. 110
      accessible/base/TreeWalker.cpp
  92. 88
      accessible/base/TreeWalker.h
  93. 101
      accessible/base/moz.build
  94. 51
      accessible/base/nsAccCache.h
  95. 416
      accessible/base/nsAccUtils.cpp
  96. 248
      accessible/base/nsAccUtils.h
  97. 1807
      accessible/base/nsAccessibilityService.cpp
  98. 360
      accessible/base/nsAccessibilityService.h
  99. 924
      accessible/base/nsAccessiblePivot.cpp
  100. 145
      accessible/base/nsAccessiblePivot.h
  101. Some files were not shown because too many files have changed in this diff Show More

1
.clang-format

@ -0,0 +1 @@
BasedOnStyle: Mozilla

3
.clang-format-ignore

@ -0,0 +1,3 @@
^mfbt/.*
^js/.*
^media/.*

2
.gdbinit

@ -177,5 +177,5 @@ def js
end
def ft
call nsFrame::DumpFrameTree($arg0)
call $arg0->DumpFrameTree()
end

31
.lldbinit

@ -0,0 +1,31 @@
# .lldbinit file for debugging Mozilla
# -----------------------------------------------------------------------------
# For documentation on all of the commands and type summaries defined here
# and in the accompanying Python scripts, see python/lldbutils/README.txt.
# -----------------------------------------------------------------------------
# Import the module that defines complex Goanna debugging commands. This assumes
# you are either running lldb from the top level source directory, the objdir,
# or the dist/bin directory. (.lldbinit files in the objdir and dist/bin set
# topsrcdir appropriately.)
script topsrcdir = topsrcdir if locals().has_key("topsrcdir") else "."; sys.path.append(os.path.join(topsrcdir, "python/lldbutils")); import lldbutils; lldbutils.init()
# Mozilla's use of UNIFIED_SOURCES to include multiple source files into a
# single compiled file breaks lldb breakpoint setting. This works around that.
# See http://lldb.llvm.org/troubleshooting.html for more info.
settings set target.inline-breakpoint-strategy always
# Show the dynamic type of an object when using "expr". This, for example,
# will show a variable declared as "nsIFrame *" that points to an nsBlockFrame
# object as being of type "nsBlockFrame *" rather than "nsIFrame *".
settings set target.prefer-dynamic-value run-target
# Show the string value in atoms.
type summary add nsIAtom --summary-string "${var.mString}"
# Show the value of text nodes.
type summary add nsTextNode --summary-string "${var.mText}"
# Dump the current JS stack.
command alias js expr DumpJSStack()

27
.ycm_extra_conf.py

@ -0,0 +1,27 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import imp
import os
from StringIO import StringIO
import shlex
path = os.path.join(os.path.dirname(__file__), 'mach')
if not os.path.exists(path):
path = os.path.join(os.path.dirname(__file__), 'config.status')
config = imp.load_module('_buildconfig', open(path), path, ('', 'r', imp.PY_SOURCE))
path = os.path.join(config.topsrcdir, 'mach')
mach_module = imp.load_module('_mach', open(path), path, ('', 'r', imp.PY_SOURCE))
def FlagsForFile(filename):
mach = mach_module.get_mach()
out = StringIO()
out.encoding = None
mach.run(['compileflags', filename], stdout=out, stderr=out)
return {
'flags': shlex.split(out.getvalue()),
'do_cache': True
}

1
AUTHORS

@ -19,6 +19,7 @@ Aaron Nowack <anowack@mimiru.net>
Aaron Reed <aaronr@us.ibm.com>
Aaron Spangler <aaron@spangler.ods.org>
Aaron Train <aaron.train@gmail.com>
Abdelrhman Ahmed <a.ahmed1026@gmail.com>
Achim Hasenmueller <achimha@innotek.de>
ActiveState Tool Corp.
Adam Barth <hk9565@gmail.com>

2
CLOBBER

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Clobber required for addition of the URL API.
Clobber required for Tycho code import.

244
Makefile.in

@ -3,88 +3,183 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
ifndef .PYMAKE
ifeq (,$(MAKE_VERSION))
$(error GNU Make is required)
endif
ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION)))
$(error GNU Make 3.80 or higher is required)
endif
make_min_ver := 3.81
ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
$(error GNU Make $(make_min_ver) or higher is required)
endif
export TOPLEVEL_BUILD := 1
include $(DEPTH)/config/autoconf.mk
default::
ifdef COMPILE_ENVIRONMENT
ifdef MOZ_BUILD_APP
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
endif
include $(topsrcdir)/config/config.mk
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
GARBAGE_DIRS += dist _javagen _profile staticlib
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
config/autoconf.mk \
unallmakefiles mozilla-config.h \
mozilla-config.h \
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
.mozconfig.mk
ifdef JS_STANDALONE
configure_dir = $(topsrcdir)/js/src
else
configure_dir = $(topsrcdir)
endif
ifndef MOZ_PROFILE_USE
# We need to explicitly put backend.RecursiveMakeBackend.built here
# We need to explicitly put backend.RecursiveMakeBackend here
# otherwise the rule in rules.mk doesn't run early enough.
default alldep all:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
$(RM) -r $(DIST)/sdk
$(RM) -r $(DIST)/include
$(RM) -r $(DIST)/private
$(RM) -r $(DIST)/public
$(RM) -r $(DIST)/bin
$(RM) -r _tests
$(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
ifndef JS_STANDALONE
ifndef LIBXUL_SDK
$(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
endif
endif
endif
ifdef JS_STANDALONE
.PHONY: CLOBBER
CLOBBER:
else
CLOBBER: $(topsrcdir)/CLOBBER
@echo "STOP! The CLOBBER file has changed."
@echo "Please run the build through a sanctioned build wrapper, such as"
@echo "'mach build' or client.mk."
@echo 'STOP! The CLOBBER file has changed.'
@echo 'Please run the build through a sanctioned build wrapper, such as'
@echo '"mach build" or client.mk.'
@exit 1
endif
$(topsrcdir)/configure: $(topsrcdir)/configure.in
@echo "STOP! configure.in has changed, and your configure is out of date."
@echo "Please rerun autoconf and re-configure your build directory."
@echo "To ignore this message, touch 'configure' in the source directory,"
@echo "but your build might not succeed."
$(topsrcdir)/js/src/configure: $(topsrcdir)/js/src/configure.in
$(topsrcdir)/configure $(topsrcdir)/js/src/configure:
@echo 'STOP! $^ has changed, and your configure is out of date.'
@echo 'Please rerun autoconf and re-configure your build directory.'
@echo 'To ignore this message, touch "$@",'
@echo 'but your build might not succeed.'
@exit 1
config.status: $(topsrcdir)/configure
@echo "STOP! configure has changed and needs to be run in this build directory."
@echo "Please rerun configure."
@echo "To ignore this message, touch 'config.status' in the build directory,"
@echo "but your build might not succeed."
config.status: $(configure_dir)/configure
js/src/config.status: $(topsrcdir)/js/src/configure
config.status js/src/config.status:
@echo 'STOP! $^ has changed and needs to be run again.'
@echo 'Please rerun it.'
@echo 'To ignore this message, touch "$(CURDIR)/$@",'
@echo 'but your build might not succeed.'
@exit 1
# Build pseudo-external modules first when export is explicitly called
export::
$(RM) -r $(DIST)/sdk
$(MAKE) -C config export
$(MAKE) tier_nspr
# Regenerate the build backend if it is out of date. We only have this rule in
# this main make file because having it in rules.mk and applied to partial tree
# builds resulted in a world of hurt. Gory details are in bug 877308.
#
# The mach build driver will ensure the backend is up to date for partial tree
# builds. This cleanly avoids most of the pain.
backend.RecursiveMakeBackend:
@echo 'Build configuration changed. Regenerating backend.'
$(PYTHON) config.status
Makefile: backend.RecursiveMakeBackend
@$(TOUCH) $@
include backend.RecursiveMakeBackend.pp
default:: backend.RecursiveMakeBackend
install_manifests := \
$(addprefix dist/,bin idl include public private sdk xpi-stage) \
_tests \
$(NULL)
install_manifest_depends = \
CLOBBER \
$(configure_dir)/configure \
config.status \
backend.RecursiveMakeBackend \
$(NULL)
ifndef JS_STANDALONE
ifndef LIBXUL_SDK
install_manifest_depends += \
$(topsrcdir)/js/src/configure \
js/src/config.status \
$(NULL)
endif
endif
.PHONY: install-manifests
install-manifests: $(addprefix install-,$(install_manifests))
# process_install_manifest needs to be invoked with --no-remove when building
# js as standalone because automated builds are building nspr separately and
# that would remove the resulting files.
# Eventually, a standalone js build would just be able to build nspr itself,
# removing the need for the former.
ifdef JS_STANDALONE
NO_REMOVE=1
endif
.PHONY: $(addprefix install-,$(install_manifests))
$(addprefix install-,$(filter dist/%,$(install_manifests))): install-dist/%: $(install_manifest_depends)
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$*)
install-_tests: $(install_manifest_depends)
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests)
# For compatibility
.PHONY: install-tests
install-tests: install-_tests
include $(topsrcdir)/build/moz-automation.mk
# _tests should be purged during cleaning. However, we don't want it purged
# during PGO builds because it contains some auto-generated files.
ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
GARBAGE_DIRS += _tests
endif
# Windows PGO builds don't perform a clean before the 2nd pass. So, we want
# to preserve content for the 2nd pass on Windows. Everywhere else, we always
# process the install manifests as part of export.
# For the binaries rule, not all the install manifests matter, so force only
# the interesting ones to be done.
ifdef MOZ_PROFILE_USE
ifndef NO_PROFILE_GUIDED_OPTIMIZE
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
export:: install-manifests
binaries::
@$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
endif
endif
else # !MOZ_PROFILE_USE (normal build)
export:: install-manifests
binaries::
@$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
endif
# For historical reasons that are unknown, $(DIST)/sdk is always blown away
# with no regard for PGO passes. This decision could probably be revisited.
export:: install-dist/sdk
ifndef JS_STANDALONE
ifdef ENABLE_TESTS
# Additional makefile targets to call automated test suites
include $(topsrcdir)/testing/testsuite-targets.mk
endif
endif
default all::
$(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
include $(topsrcdir)/config/rules.mk
distclean::
cat unallmakefiles | $(XARGS) rm -f
$(RM) unallmakefiles $(DIST_GARBAGE)
$(RM) $(DIST_GARBAGE)
ifeq ($(OS_ARCH),WINNT)
# we want to copy PDB files on Windows
@ -98,7 +193,7 @@ endif
ifeq ($(OS_ARCH),Darwin)
# need to pass arch flags for universal builds
ifdef UNIVERSAL_BINARY
MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info
MAKE_SYM_STORE_PATH := $(DIST)/universal
else
MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
@ -111,9 +206,11 @@ MAKE_SYM_STORE_ARGS := -c --vcs-info
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
MAKE_SYM_STORE_PATH := $(DIST)/bin
endif
MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist_include,$(DIST)/include
SYM_STORE_SOURCE_DIRS := $(topsrcdir)
ifndef JS_STANDALONE
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
ifdef MOZ_SYMBOLS_EXTRA_BUILDID
@ -127,11 +224,36 @@ buildsymbols:
uploadsymbols:
codesighs:
$(MAKE) -C $(MOZ_BUILD_APP)/installer codesighs
# defined in package-name.mk
# MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
# exporting it makes make run its $(shell) command for each invoked submake,
# so transform it to an immediate assignment.
MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
export MOZ_SOURCE_STAMP
endif
.PHONY: update-packaging
update-packaging:
$(MAKE) -C tools/update-packaging
.PHONY: pretty-package
pretty-package:
unset MOZ_SIGN_CMD && $(MAKE) package MOZ_PKG_PRETTYNAMES=1
.PHONY: pretty-package-tests
pretty-package-tests:
unset MOZ_SIGN_CMD && $(MAKE) package-tests MOZ_PKG_PRETTYNAMES=1
.PHONY: pretty-l10n-check
pretty-l10n-check:
unset MOZ_SIGN_CMD && $(MAKE) l10n-check MOZ_PKG_PRETTYNAMES=1
.PHONY: pretty-update-packaging
pretty-update-packaging:
unset MOZ_SIGN_CMD && $(MAKE) -C tools/update-packaging MOZ_PKG_PRETTYNAMES=1
.PHONY: pretty-installer
pretty-installer:
unset MOZ_SIGN_CMD && $(MAKE) installer MOZ_PKG_PRETTYNAMES=1
#XXX: this is a hack, since we don't want to clobber for MSVC
# PGO support, but we can't do this test in client.mk
@ -145,7 +267,7 @@ endif
else
maybe_clobber_profiledbuild:
$(RM) $(DIST)/bin/*.pgc
find $(DIST)/$(MOZ_APP_NAME) -name "*.pgc" -exec mv {} $(DIST)/bin \;
find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
endif
.PHONY: maybe_clobber_profiledbuild
@ -153,15 +275,23 @@ endif
# Look for R_386_PC32 relocations in shared libs, these
# break x86_64 builds and SELinux users.
ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
scheck::
@relcount=`find $(DIST)/bin -name "*.so" | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo "FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?"; exit 1; else echo "PASSED"; fi
check::
@relcount=`find $(DIST)/bin -name '*.so' | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo 'FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?'; exit 1; else echo 'PASSED'; fi
endif
js/src/Makefile: subsrcdir := js/src
ifdef JS_STANDALONE
# Delegate js-specific rules to js
check-%:
$(MAKE) -C js/src $@
source-package install:
$(MAKE) -C js/src $@
# Every export rule depends on config/export, but the rule for config/export
# doesn't exist when building js non-standalone.
.PHONY: config/export
config/export:
ifdef ENABLE_TESTS
# Incorporate static tier directories into tests. This should be incorporated
# into moz.build files someday.
check::
$(call SUBMAKE,$@,js/src)
endif
# There used to be build interdependencies here. They are now in config/recurse.mk

2
README.md

@ -2,7 +2,7 @@
This is the source code for the Pale Moon web browser, an independent
browser derived from Firefox/Mozilla community code. The source tree is
mostly laid out like other Mozilla-based products.
mostly laid out like Mozilla-based products.
An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:

0
accessible/src/atk/ARIAGridAccessibleWrap.h → accessible/atk/ARIAGridAccessibleWrap.h

1443
accessible/atk/AccessibleWrap.cpp

File diff suppressed because it is too large Load Diff

106
accessible/atk/AccessibleWrap.h

@ -0,0 +1,106 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __NS_ACCESSIBLE_WRAP_H__
#define __NS_ACCESSIBLE_WRAP_H__
#include "nsCOMPtr.h"
#include "Accessible.h"
struct _AtkObject;
typedef struct _AtkObject AtkObject;
enum AtkProperty {
PROP_0, // gobject convention
PROP_NAME,
PROP_DESCRIPTION,
PROP_PARENT, // ancestry has changed
PROP_ROLE,
PROP_LAYER,
PROP_MDI_ZORDER,
PROP_TABLE_CAPTION,
PROP_TABLE_COLUMN_DESCRIPTION,
PROP_TABLE_COLUMN_HEADER,
PROP_TABLE_ROW_DESCRIPTION,
PROP_TABLE_ROW_HEADER,
PROP_TABLE_SUMMARY,
PROP_LAST // gobject convention
};
struct AtkPropertyChange {
int32_t type; // property type as listed above
void *oldvalue;
void *newvalue;
};
namespace mozilla {
namespace a11y {
class MaiHyperlink;
/**
* AccessibleWrap, and its descendents in atk directory provide the
* implementation of AtkObject.
*/
class AccessibleWrap : public Accessible
{
public:
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
virtual ~AccessibleWrap();
void ShutdownAtkObject();
virtual void Shutdown() override;
// return the atk object for this AccessibleWrap
virtual void GetNativeInterface(void** aOutAccessible) override;
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
AtkObject * GetAtkObject(void);
static AtkObject* GetAtkObject(Accessible* aAccessible);
bool IsValidObject();
// get/set the MaiHyperlink object for this AccessibleWrap
MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
static const char * ReturnString(nsAString &aString) {
static nsCString returnedString;
returnedString = NS_ConvertUTF16toUTF8(aString);
return returnedString.get();
}
protected:
nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
bool aIsAdded);
AtkObject *mAtkObject;
private:
/*
* do we have text-remove and text-insert signals if not we need to use
* text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
* bug 619002
*/
enum EAvailableAtkSignals {
eUnknown,
eHaveNewAtkTextSignals,
eNoNewAtkSignals
};
static EAvailableAtkSignals gAvailableAtkSignals;
uint16_t CreateMaiInterfaces();
};
} // namespace a11y
} // namespace mozilla
#endif /* __NS_ACCESSIBLE_WRAP_H__ */

168
accessible/atk/ApplicationAccessibleWrap.cpp

@ -0,0 +1,168 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ApplicationAccessibleWrap.h"
#include "nsCOMPtr.h"
#include "nsMai.h"
#include "nsAutoPtr.h"
#include "nsAccessibilityService.h"
#include <gtk/gtk.h>
#include <atk/atk.h>
using namespace mozilla;
using namespace mozilla::a11y;
// ApplicationAccessibleWrap
ApplicationAccessibleWrap::ApplicationAccessibleWrap():
ApplicationAccessible()
{
}
ApplicationAccessibleWrap::~ApplicationAccessibleWrap()
{
AccessibleWrap::ShutdownAtkObject();
}
gboolean
toplevel_event_watcher(GSignalInvocationHint* ihint,
guint n_param_values,
const GValue* param_values,
gpointer data)
{
static GQuark sQuark_goanna_acc_obj = 0;
if (!sQuark_goanna_acc_obj)
sQuark_goanna_acc_obj = g_quark_from_static_string("GoannaAccObj");
if (nsAccessibilityService::IsShutdown())
return TRUE;
GObject* object = reinterpret_cast<GObject*>(g_value_get_object(param_values));
if (!GTK_IS_WINDOW(object))
return TRUE;
AtkObject* child = gtk_widget_get_accessible(GTK_WIDGET(object));
// GTK native dialog
if (!IS_MAI_OBJECT(child) &&
(atk_object_get_role(child) == ATK_ROLE_DIALOG)) {
if (data == reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW)) {
// Attach the dialog accessible to app accessible tree
Accessible* windowAcc = GetAccService()->AddNativeRootAccessible(child);
g_object_set_qdata(G_OBJECT(child), sQuark_goanna_acc_obj,
reinterpret_cast<gpointer>(windowAcc));
} else {
// Deattach the dialog accessible
Accessible* windowAcc =
reinterpret_cast<Accessible*>
(g_object_get_qdata(G_OBJECT(child), sQuark_goanna_acc_obj));
if (windowAcc) {
GetAccService()->RemoveNativeRootAccessible(windowAcc);
g_object_set_qdata(G_OBJECT(child), sQuark_goanna_acc_obj, nullptr);
}
}
}
return TRUE;
}
ENameValueFlag
ApplicationAccessibleWrap::Name(nsString& aName)
{
// ATK doesn't provide a way to obtain an application name (for example,
// Firefox or Thunderbird) like IA2 does. Thus let's return an application
// name as accessible name that was used to get a branding name (for example,
// Minefield aka nightly Firefox or Daily aka nightly Thunderbird).
AppName(aName);
return eNameOK;
}
void
ApplicationAccessibleWrap::GetNativeInterface(void** aOutAccessible)
{
*aOutAccessible = nullptr;
if (!mAtkObject) {
mAtkObject =
reinterpret_cast<AtkObject*>(g_object_new(MAI_TYPE_ATK_OBJECT, nullptr));
if (!mAtkObject)
return;
atk_object_initialize(mAtkObject, this);
mAtkObject->role = ATK_ROLE_INVALID;
mAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mAtkObject;
}
struct AtkRootAccessibleAddedEvent {
AtkObject *app_accessible;
AtkObject *root_accessible;
uint32_t index;
};
gboolean fireRootAccessibleAddedCB(gpointer data)
{
AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)data;
g_signal_emit_by_name(eventData->app_accessible, "children_changed::add",
eventData->index, eventData->root_accessible, nullptr);
g_object_unref(eventData->app_accessible);
g_object_unref(eventData->root_accessible);
free(data);
return FALSE;
}
bool
ApplicationAccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aChild)
{
if (!ApplicationAccessible::InsertChildAt(aIdx, aChild))
return false;
AtkObject* atkAccessible = AccessibleWrap::GetAtkObject(aChild);
atk_object_set_parent(atkAccessible, mAtkObject);
uint32_t count = mChildren.Length();
// Emit children_changed::add in a timeout
// to make sure aRootAccWrap is fully initialized.
AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)
malloc(sizeof(AtkRootAccessibleAddedEvent));
if (eventData) {
eventData->app_accessible = mAtkObject;
eventData->root_accessible = atkAccessible;
eventData->index = count -1;
g_object_ref(mAtkObject);
g_object_ref(atkAccessible);
g_timeout_add(0, fireRootAccessibleAddedCB, eventData);
}
return true;
}
bool
ApplicationAccessibleWrap::RemoveChild(Accessible* aChild)
{
int32_t index = aChild->IndexInParent();
AtkObject* atkAccessible = AccessibleWrap::GetAtkObject(aChild);
atk_object_set_parent(atkAccessible, nullptr);
g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
atkAccessible, nullptr);
return ApplicationAccessible::RemoveChild(aChild);
}

35
accessible/atk/ApplicationAccessibleWrap.h

@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__
#define mozilla_a11y_ApplicationAccessibleWrap_h__
#include "ApplicationAccessible.h"
namespace mozilla {
namespace a11y {
class ApplicationAccessibleWrap: public ApplicationAccessible
{
public:
ApplicationAccessibleWrap();
virtual ~ApplicationAccessibleWrap();
// Accessible
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) override;
virtual bool RemoveChild(Accessible* aChild) override;
/**
* Return the atk object for app root accessible.
*/
virtual void GetNativeInterface(void** aOutAccessible) override;
};
} // namespace a11y
} // namespace mozilla
#endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */

155
accessible/atk/AtkSocketAccessible.cpp

@ -0,0 +1,155 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <atk/atk.h>
#include "AtkSocketAccessible.h"
#include "InterfaceInitFuncs.h"
#include "nsMai.h"
#include "mozilla/Likely.h"
using namespace mozilla::a11y;
AtkSocketEmbedType AtkSocketAccessible::g_atk_socket_embed = nullptr;
GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
const char* AtkSocketAccessible::sATKSocketEmbedSymbol = "atk_socket_embed";
const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type";
bool AtkSocketAccessible::gCanEmbed = FALSE;
extern "C" void mai_atk_component_iface_init(AtkComponentIface* aIface);
extern "C" GType mai_atk_socket_get_type(void);
/* MaiAtkSocket */
#define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type ())
#define MAI_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
#define MAI_IS_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
MAI_TYPE_ATK_SOCKET))
#define MAI_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
MAI_TYPE_ATK_SOCKET,\
MaiAtkSocketClass))
#define MAI_IS_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
MAI_TYPE_ATK_SOCKET))
#define MAI_ATK_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
MAI_TYPE_ATK_SOCKET,\
MaiAtkSocketClass))
typedef struct _MaiAtkSocket
{
AtkSocket parent;
AccessibleWrap* accWrap;
} MaiAtkSocket;
typedef struct _MaiAtkSocketClass
{
AtkSocketClass parent_class;
} MaiAtkSocketClass;
G_DEFINE_TYPE_EXTENDED(MaiAtkSocket, mai_atk_socket,
AtkSocketAccessible::g_atk_socket_type, 0,
G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
mai_atk_component_iface_init))
void
mai_atk_socket_class_init(MaiAtkSocketClass* aAcc)
{
}
void
mai_atk_socket_init(MaiAtkSocket* aAcc)
{
}
static AtkObject*
mai_atk_socket_new(AccessibleWrap* aAccWrap)
{
NS_ENSURE_TRUE(aAccWrap, nullptr);
MaiAtkSocket* acc = nullptr;
acc = static_cast<MaiAtkSocket*>(g_object_new(MAI_TYPE_ATK_SOCKET, nullptr));
NS_ENSURE_TRUE(acc, nullptr);
acc->accWrap = aAccWrap;
return ATK_OBJECT(acc);
}
extern "C" {
static AtkObject*
RefAccessibleAtPoint(AtkComponent* aComponent, gint aX, gint aY,
AtkCoordType aCoordType)
{
NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nullptr);
return refAccessibleAtPointHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
aX, aY, aCoordType);
}
static void
GetExtents(AtkComponent* aComponent, gint* aX, gint* aY, gint* aWidth,
gint* aHeight, AtkCoordType aCoordType)
{
*aX = *aY = *aWidth = *aHeight = 0;
if (!MAI_IS_ATK_SOCKET(aComponent))
return;
getExtentsHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
aX, aY, aWidth, aHeight, aCoordType);
}
}
void
mai_atk_component_iface_init(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if (MOZ_UNLIKELY(!aIface))
return;
aIface->ref_accessible_at_point = RefAccessibleAtPoint;
aIface->get_extents = GetExtents;
}
AtkSocketAccessible::AtkSocketAccessible(nsIContent* aContent,
DocAccessible* aDoc,
const nsCString& aPlugId) :
AccessibleWrap(aContent, aDoc)
{
mAtkObject = mai_atk_socket_new(this);
if (!mAtkObject)
return;
// Embeds the children of an AtkPlug, specified by plugId, as the children of
// this socket.
// Using G_TYPE macros instead of ATK_SOCKET macros to avoid undefined
// symbols.
if (gCanEmbed && G_TYPE_CHECK_INSTANCE_TYPE(mAtkObject, g_atk_socket_type) &&
!aPlugId.IsVoid()) {
AtkSocket* accSocket =
G_TYPE_CHECK_INSTANCE_CAST(mAtkObject, g_atk_socket_type, AtkSocket);
g_atk_socket_embed(accSocket, (gchar*)aPlugId.get());
}
}
void
AtkSocketAccessible::GetNativeInterface(void** aOutAccessible)
{
*aOutAccessible = mAtkObject;
}
void
AtkSocketAccessible::Shutdown()
{
if (mAtkObject) {
if (MAI_IS_ATK_SOCKET(mAtkObject))
MAI_ATK_SOCKET(mAtkObject)->accWrap = nullptr;
g_object_unref(mAtkObject);
mAtkObject = nullptr;
}
AccessibleWrap::Shutdown();
}

56
accessible/atk/AtkSocketAccessible.h

@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _AtkSocketAccessible_H_
#define _AtkSocketAccessible_H_
#include "AccessibleWrap.h"
// This file gets included by nsAccessibilityService.cpp, which can't include
// atk.h (or glib.h), so we can't rely on it being included.
#ifdef __ATK_H__
extern "C" typedef void (*AtkSocketEmbedType) (AtkSocket*, gchar*);
#else
extern "C" typedef void (*AtkSocketEmbedType) (void*, void*);
#endif
namespace mozilla {
namespace a11y {
/**
* Provides a AccessibleWrap wrapper around AtkSocket for out-of-process
* accessibles.
*/
class AtkSocketAccessible : public AccessibleWrap
{
public:
// Soft references to AtkSocket
static AtkSocketEmbedType g_atk_socket_embed;
#ifdef __ATK_H__
static GType g_atk_socket_type;
#endif
static const char* sATKSocketEmbedSymbol;
static const char* sATKSocketGetTypeSymbol;
/*
* True if the current Atk version supports AtkSocket and it was correctly
* loaded.
*/
static bool gCanEmbed;
AtkSocketAccessible(nsIContent* aContent, DocAccessible* aDoc,
const nsCString& aPlugId);
virtual void Shutdown() override;
virtual void GetNativeInterface(void** aOutAccessible) override;
};
} // namespace a11y
} // namespace mozilla
#endif

0
accessible/src/atk/DocAccessibleWrap.cpp → accessible/atk/DocAccessibleWrap.cpp

0
accessible/src/atk/DocAccessibleWrap.h → accessible/atk/DocAccessibleWrap.h

0
accessible/src/atk/HTMLTableAccessibleWrap.h → accessible/atk/HTMLTableAccessibleWrap.h

0
accessible/src/atk/HyperTextAccessibleWrap.h → accessible/atk/HyperTextAccessibleWrap.h

0
accessible/src/atk/ImageAccessibleWrap.h → accessible/atk/ImageAccessibleWrap.h

0
accessible/src/atk/InterfaceInitFuncs.h → accessible/atk/InterfaceInitFuncs.h

365
accessible/atk/Platform.cpp

@ -0,0 +1,365 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Platform.h"
#include "nsIAccessibleEvent.h"
#include "nsIGConfService.h"
#include "nsIServiceManager.h"
#include "nsMai.h"
#include "AtkSocketAccessible.h"
#include "prenv.h"
#include "prlink.h"
#ifdef MOZ_ENABLE_DBUS
#include <dbus/dbus.h>
#endif
#include <gtk/gtk.h>
#if (MOZ_WIDGET_GTK == 3)
#include <atk-bridge.h>
#endif
using namespace mozilla;
using namespace mozilla::a11y;
int atkMajorVersion = 1, atkMinorVersion = 12;
extern "C" {
typedef GType (* AtkGetTypeType) (void);
typedef void (*GnomeAccessibilityInit) (void);
typedef void (*GnomeAccessibilityShutdown) (void);
}
static PRLibrary* sATKLib = nullptr;
static const char sATKLibName[] = "libatk-1.0.so.0";
static const char sATKHyperlinkImplGetTypeSymbol[] =
"atk_hyperlink_impl_get_type";
gboolean toplevel_event_watcher(GSignalInvocationHint*, guint, const GValue*,
gpointer);
static bool sToplevel_event_hook_added = false;
static gulong sToplevel_show_hook = 0;
static gulong sToplevel_hide_hook = 0;
GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
#if (MOZ_WIDGET_GTK == 2)
struct GnomeAccessibilityModule
{
const char *libName;
PRLibrary *lib;
const char *initName;
GnomeAccessibilityInit init;
const char *shutdownName;
GnomeAccessibilityShutdown shutdown;
};
static GnomeAccessibilityModule sAtkBridge = {
#ifdef AIX
"libatk-bridge.a(libatk-bridge.so.0)", nullptr,
#else
"libatk-bridge.so", nullptr,
#endif
"gnome_accessibility_module_init", nullptr,
"gnome_accessibility_module_shutdown", nullptr
};
static GnomeAccessibilityModule sGail = {
"libgail.so", nullptr,
"gnome_accessibility_module_init", nullptr,
"gnome_accessibility_module_shutdown", nullptr
};
static nsresult
LoadGtkModule(GnomeAccessibilityModule& aModule)
{
NS_ENSURE_ARG(aModule.libName);
if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) {
//try to load the module with "gtk-2.0/modules" appended
char *curLibPath = PR_GetLibraryPath();
nsAutoCString libPath(curLibPath);
#if defined(LINUX) && defined(__x86_64__)
libPath.AppendLiteral(":/usr/lib64:/usr/lib");
#else
libPath.AppendLiteral(":/usr/lib");
#endif
PR_FreeLibraryName(curLibPath);
int16_t loc1 = 0, loc2 = 0;
int16_t subLen = 0;
while (loc2 >= 0) {
loc2 = libPath.FindChar(':', loc1);
if (loc2 < 0)
subLen = libPath.Length() - loc1;
else
subLen = loc2 - loc1;
nsAutoCString sub(Substring(libPath, loc1, subLen));
sub.AppendLiteral("/gtk-2.0/modules/");
sub.Append(aModule.libName);
aModule.lib = PR_LoadLibrary(sub.get());
if (aModule.lib)
break;
loc1 = loc2+1;
}
if (!aModule.lib)
return NS_ERROR_FAILURE;
}
//we have loaded the library, try to get the function ptrs
if (!(aModule.init = PR_FindFunctionSymbol(aModule.lib,
aModule.initName)) ||
!(aModule.shutdown = PR_FindFunctionSymbol(aModule.lib,
aModule.shutdownName))) {
//fail, :(
PR_UnloadLibrary(aModule.lib);
aModule.lib = nullptr;
return NS_ERROR_FAILURE;
}
return NS_OK;
}
#endif // (MOZ_WIDGET_GTK == 2)
void
a11y::PlatformInit()
{
if (!ShouldA11yBeEnabled())
return;
sATKLib = PR_LoadLibrary(sATKLibName);
if (!sATKLib)
return;
AtkGetTypeType pfn_atk_hyperlink_impl_get_type =
(AtkGetTypeType) PR_FindFunctionSymbol(sATKLib, sATKHyperlinkImplGetTypeSymbol);
if (pfn_atk_hyperlink_impl_get_type)
g_atk_hyperlink_impl_type = pfn_atk_hyperlink_impl_get_type();
AtkGetTypeType pfn_atk_socket_get_type = (AtkGetTypeType)
PR_FindFunctionSymbol(sATKLib, AtkSocketAccessible::sATKSocketGetTypeSymbol);
if (pfn_atk_socket_get_type) {
AtkSocketAccessible::g_atk_socket_type = pfn_atk_socket_get_type();
AtkSocketAccessible::g_atk_socket_embed = (AtkSocketEmbedType)
PR_FindFunctionSymbol(sATKLib, AtkSocketAccessible ::sATKSocketEmbedSymbol);
AtkSocketAccessible::gCanEmbed =
AtkSocketAccessible::g_atk_socket_type != G_TYPE_INVALID &&
AtkSocketAccessible::g_atk_socket_embed;
}
const char* (*atkGetVersion)() =
(const char* (*)()) PR_FindFunctionSymbol(sATKLib, "atk_get_version");
if (atkGetVersion) {
const char* version = atkGetVersion();
if (version) {
char* endPtr = nullptr;
atkMajorVersion = strtol(version, &endPtr, 10);
if (*endPtr == '.')
atkMinorVersion = strtol(endPtr + 1, &endPtr, 10);
}
}
#if (MOZ_WIDGET_GTK == 2)
// Load and initialize gail library.
nsresult rv = LoadGtkModule(sGail);
if (NS_SUCCEEDED(rv))
(*sGail.init)();
#endif
// Initialize the MAI Utility class, it will overwrite gail_util.
g_type_class_unref(g_type_class_ref(mai_util_get_type()));
// Init atk-bridge now
PR_SetEnv("NO_AT_BRIDGE=0");
#if (MOZ_WIDGET_GTK == 2)
rv = LoadGtkModule(sAtkBridge);
if (NS_SUCCEEDED(rv)) {
(*sAtkBridge.init)();
}
#else
atk_bridge_adaptor_init(nullptr, nullptr);
#endif
if (!sToplevel_event_hook_added) {
sToplevel_event_hook_added = true;
sToplevel_show_hook =
g_signal_add_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
0, toplevel_event_watcher,
reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW),
nullptr);
sToplevel_hide_hook =
g_signal_add_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW), 0,
toplevel_event_watcher,
reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_HIDE),
nullptr);
}
}
void
a11y::PlatformShutdown()
{
if (sToplevel_event_hook_added) {
sToplevel_event_hook_added = false;
g_signal_remove_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
sToplevel_show_hook);
g_signal_remove_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
sToplevel_hide_hook);
}
#if (MOZ_WIDGET_GTK == 2)
if (sAtkBridge.lib) {
// Do not shutdown/unload atk-bridge,
// an exit function registered will take care of it
// if (sAtkBridge.shutdown)
// (*sAtkBridge.shutdown)();
// PR_UnloadLibrary(sAtkBridge.lib);
sAtkBridge.lib = nullptr;
sAtkBridge.init = nullptr;
sAtkBridge.shutdown = nullptr;
}
if (sGail.lib) {
// Do not shutdown gail because
// 1) Maybe it's not init-ed by us. e.g. GtkEmbed
// 2) We need it to avoid assert in spi_atk_tidy_windows
// if (sGail.shutdown)
// (*sGail.shutdown)();
// PR_UnloadLibrary(sGail.lib);
sGail.lib = nullptr;
sGail.init = nullptr;
sGail.shutdown = nullptr;
}
#endif
// if (sATKLib) {
// PR_UnloadLibrary(sATKLib);
// sATKLib = nullptr;
// }
}
static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
#ifdef MOZ_ENABLE_DBUS
static DBusPendingCall *sPendingCall = nullptr;
#endif
void
a11y::PreInit()
{
#ifdef MOZ_ENABLE_DBUS
static bool sChecked = FALSE;
if (sChecked)
return;
sChecked = TRUE;
// dbus is only checked if GNOME_ACCESSIBILITY is unset
// also make sure that a session bus address is available to prevent dbus from
// starting a new one. Dbus confuses the test harness when it creates a new
// process (see bug 693343)
if (PR_GetEnv(sAccEnv) || !PR_GetEnv("DBUS_SESSION_BUS_ADDRESS"))
return;
DBusConnection* bus = dbus_bus_get(DBUS_BUS_SESSION, nullptr);
if (!bus)
return;
dbus_connection_set_exit_on_disconnect(bus, FALSE);
static const char* iface = "org.a11y.Status";
static const char* member = "IsEnabled";
DBusMessage *message;
message = dbus_message_new_method_call("org.a11y.Bus", "/org/a11y/bus",
"org.freedesktop.DBus.Properties",
"Get");
if (!message)
goto dbus_done;
dbus_message_append_args(message, DBUS_TYPE_STRING, &iface,
DBUS_TYPE_STRING, &member, DBUS_TYPE_INVALID);
dbus_connection_send_with_reply(bus, message, &sPendingCall, 1000);
dbus_message_unref(message);
dbus_done:
dbus_connection_unref(bus);
#endif
}
bool
a11y::ShouldA11yBeEnabled()
{
static bool sChecked = false, sShouldEnable = false;
if (sChecked)
return sShouldEnable;
sChecked = true;
EPlatformDisabledState disabledState = PlatformDisabledState();
if (disabledState == ePlatformIsDisabled)
return sShouldEnable = false;
// check if accessibility enabled/disabled by environment variable
const char* envValue = PR_GetEnv(sAccEnv);
if (envValue)
return sShouldEnable = !!atoi(envValue);
#ifdef MOZ_ENABLE_DBUS
PreInit();
bool dbusSuccess = false;
DBusMessage *reply = nullptr;
if (!sPendingCall)
goto dbus_done;
dbus_pending_call_block(sPendingCall);
reply = dbus_pending_call_steal_reply(sPendingCall);
dbus_pending_call_unref(sPendingCall);
sPendingCall = nullptr;
if (!reply ||
dbus_message_get_type(reply) != DBUS_MESSAGE_TYPE_METHOD_RETURN ||
strcmp(dbus_message_get_signature (reply), DBUS_TYPE_VARIANT_AS_STRING))
goto dbus_done;
DBusMessageIter iter, iter_variant, iter_struct;
dbus_bool_t dResult;
dbus_message_iter_init(reply, &iter);
dbus_message_iter_recurse (&iter, &iter_variant);
switch (dbus_message_iter_get_arg_type(&iter_variant)) {
case DBUS_TYPE_STRUCT:
// at-spi2-core 2.2.0-2.2.1 had a bug where it returned a struct
dbus_message_iter_recurse(&iter_variant, &iter_struct);
if (dbus_message_iter_get_arg_type(&iter_struct) == DBUS_TYPE_BOOLEAN) {
dbus_message_iter_get_basic(&iter_struct, &dResult);
sShouldEnable = dResult;
dbusSuccess = true;
}
break;
case DBUS_TYPE_BOOLEAN:
dbus_message_iter_get_basic(&iter_variant, &dResult);
sShouldEnable = dResult;
dbusSuccess = true;
break;
default:
break;
}
dbus_done:
if (reply)
dbus_message_unref(reply);
if (dbusSuccess)
return sShouldEnable;
#endif
//check gconf-2 setting
static const char sGconfAccessibilityKey[] =
"/desktop/gnome/interface/accessibility";
nsresult rv = NS_OK;
nsCOMPtr<nsIGConfService> gconf =
do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && gconf)
gconf->GetBool(NS_LITERAL_CSTRING(sGconfAccessibilityKey), &sShouldEnable);
return sShouldEnable;
}

0
accessible/src/atk/RootAccessibleWrap.cpp → accessible/atk/RootAccessibleWrap.cpp

34
accessible/atk/RootAccessibleWrap.h

@ -0,0 +1,34 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_RootAccessibleWrap_h__
#define mozilla_a11y_RootAccessibleWrap_h__
#include "BaseAccessibles.h"
#include "RootAccessible.h"
namespace mozilla {
namespace a11y {
typedef RootAccessible RootAc