diff --git a/accessible/aom/moz.build b/accessible/aom/moz.build index 88b941435ee8..1b1bbc4290cc 100644 --- a/accessible/aom/moz.build +++ b/accessible/aom/moz.build @@ -34,6 +34,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": LOCAL_INCLUDES += [ "/accessible/android", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other", diff --git a/accessible/base/Platform.h b/accessible/base/Platform.h index 23f214246f2d..68529d176a1d 100644 --- a/accessible/base/Platform.h +++ b/accessible/base/Platform.h @@ -47,10 +47,10 @@ EPlatformDisabledState PlatformDisabledState(); void PreInit(); #endif -#if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_MACOSX) +#if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_DARWIN) /** * Is platform accessibility enabled. - * Only used on linux with atk and MacOS for now. + * Only used on Linux, MacOS and iOS for now. */ bool ShouldA11yBeEnabled(); #endif diff --git a/accessible/base/moz.build b/accessible/base/moz.build index b65c90ceba91..de8e75f0e1a7 100644 --- a/accessible/base/moz.build +++ b/accessible/base/moz.build @@ -112,6 +112,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": LOCAL_INCLUDES += [ "/accessible/android", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other", diff --git a/accessible/generic/moz.build b/accessible/generic/moz.build index 06e229b99999..6d34fe7d6887 100644 --- a/accessible/generic/moz.build +++ b/accessible/generic/moz.build @@ -53,6 +53,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": LOCAL_INCLUDES += [ "/accessible/android", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other", diff --git a/accessible/html/moz.build b/accessible/html/moz.build index 3a246373da0a..73b7737987d4 100644 --- a/accessible/html/moz.build +++ b/accessible/html/moz.build @@ -42,6 +42,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": LOCAL_INCLUDES += [ "/accessible/android", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other", diff --git a/accessible/ios/.clang-format b/accessible/ios/.clang-format new file mode 100644 index 000000000000..269bce4d0fa2 --- /dev/null +++ b/accessible/ios/.clang-format @@ -0,0 +1,11 @@ +--- +# Objective C formatting rules. +# Since this doesn't derive from the Cpp section, we need to redifine the root rules here. +Language: ObjC +BasedOnStyle: Google + +DerivePointerAlignment: false +PointerAlignment: Left +SortIncludes: false +ColumnLimit: 80 +IndentPPDirectives: AfterHash diff --git a/accessible/ios/AccessibleWrap.h b/accessible/ios/AccessibleWrap.h new file mode 100644 index 000000000000..40da51c80a86 --- /dev/null +++ b/accessible/ios/AccessibleWrap.h @@ -0,0 +1,30 @@ +/* clang-format off */ +/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* clang-format on */ +/* 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/. */ + +/* For documentation of the accessibility architecture, + * see https://firefox-source-docs.mozilla.org/accessible/index.html + */ + +#ifndef mozilla_a11y_AccessibleWrap_h_ +#define mozilla_a11y_AccessibleWrap_h_ + +#include "nsCOMPtr.h" +#include "LocalAccessible.h" + +namespace mozilla { +namespace a11y { + +class AccessibleWrap : public LocalAccessible { + public: // construction, destruction + AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); + virtual ~AccessibleWrap() = default; +}; + +} // namespace a11y +} // namespace mozilla + +#endif diff --git a/accessible/ios/AccessibleWrap.mm b/accessible/ios/AccessibleWrap.mm new file mode 100644 index 000000000000..40a09a9f78c3 --- /dev/null +++ b/accessible/ios/AccessibleWrap.mm @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 "AccessibleWrap.h" + +using namespace mozilla::a11y; + +//----------------------------------------------------- +// construction +//----------------------------------------------------- +AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) + : LocalAccessible(aContent, aDoc) {} + diff --git a/accessible/ios/ApplicationAccessibleWrap.h b/accessible/ios/ApplicationAccessibleWrap.h new file mode 100644 index 000000000000..fd5ced8eb22a --- /dev/null +++ b/accessible/ios/ApplicationAccessibleWrap.h @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=4:tabstop=4: + */ +/* 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 { + +using ApplicationAccessibleWrap = ApplicationAccessible; +} // namespace a11y +} // namespace mozilla + +#endif diff --git a/accessible/ios/DocAccessibleWrap.h b/accessible/ios/DocAccessibleWrap.h new file mode 100644 index 000000000000..e14dfd43943b --- /dev/null +++ b/accessible/ios/DocAccessibleWrap.h @@ -0,0 +1,23 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +/* For documentation of the accessibility architecture, + * see https://firefox-source-docs.mozilla.org/accessible/index.html + */ + +#ifndef mozilla_a11y_DocAccessibleWrap_h__ +#define mozilla_a11y_DocAccessibleWrap_h__ + +#include "DocAccessible.h" + +namespace mozilla { +namespace a11y { + +typedef DocAccessible DocAccessibleWrap; + +} // namespace a11y +} // namespace mozilla + +#endif diff --git a/accessible/ios/Platform.mm b/accessible/ios/Platform.mm new file mode 100644 index 000000000000..8f594ace9cd2 --- /dev/null +++ b/accessible/ios/Platform.mm @@ -0,0 +1,47 @@ +/* -*- 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 "RemoteAccessible.h" +#include "DocAccessibleParent.h" + +namespace mozilla { +namespace a11y { + +bool ShouldA11yBeEnabled() { + // XXX: Figure out proper a11y activation strategies in iOS. + return true; +} + +void PlatformInit() {} + +void PlatformShutdown() {} + +void ProxyCreated(RemoteAccessible* aProxy) {} + +void ProxyDestroyed(RemoteAccessible* aProxy) {} + +void PlatformEvent(Accessible*, uint32_t) {} + +void PlatformStateChangeEvent(Accessible*, uint64_t, bool) {} + +void PlatformFocusEvent(Accessible* aTarget, + const LayoutDeviceIntRect& aCaretRect) {} + +void PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset, + bool aIsSelectionCollapsed, int32_t aGranularity, + const LayoutDeviceIntRect& aCaretRect, + bool aFromUser) {} + +void PlatformTextChangeEvent(Accessible*, const nsAString&, int32_t, uint32_t, + bool, bool) {} + +void PlatformShowHideEvent(Accessible*, Accessible*, bool, bool) {} + +void PlatformSelectionEvent(Accessible*, Accessible*, uint32_t) {} + +} // namespace a11y +} // namespace mozilla diff --git a/accessible/ios/RootAccessibleWrap.h b/accessible/ios/RootAccessibleWrap.h new file mode 100644 index 000000000000..00d62af8ec3e --- /dev/null +++ b/accessible/ios/RootAccessibleWrap.h @@ -0,0 +1,23 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +/* For documentation of the accessibility architecture, + * see https://firefox-source-docs.mozilla.org/accessible/index.html + */ + +#ifndef mozilla_a11y_RootAccessibleWrap_h__ +#define mozilla_a11y_RootAccessibleWrap_h__ + +#include "RootAccessible.h" + +namespace mozilla { +namespace a11y { + +typedef RootAccessible RootAccessibleWrap; + +} // namespace a11y +} // namespace mozilla + +#endif diff --git a/accessible/ios/moz.build b/accessible/ios/moz.build new file mode 100644 index 000000000000..cc72da0f7316 --- /dev/null +++ b/accessible/ios/moz.build @@ -0,0 +1,26 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +EXPORTS.mozilla.a11y += [ + "AccessibleWrap.h", +] + +SOURCES += [ + "AccessibleWrap.mm", + "Platform.mm", +] + +LOCAL_INCLUDES += [ + "/accessible/base", + "/accessible/generic", + "/accessible/html", + "/accessible/ipc", + "/accessible/xul", +] + +FINAL_LIBRARY = "xul" + +include("/ipc/chromium/chromium-config.mozbuild") diff --git a/accessible/ipc/moz.build b/accessible/ipc/moz.build index b8ff3b9c4f9d..462018fb935a 100644 --- a/accessible/ipc/moz.build +++ b/accessible/ipc/moz.build @@ -18,6 +18,10 @@ else: LOCAL_INCLUDES += [ "/accessible/mac", ] + elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other", diff --git a/accessible/moz.build b/accessible/moz.build index ed05b5b50ed3..000230672afe 100644 --- a/accessible/moz.build +++ b/accessible/moz.build @@ -14,6 +14,8 @@ elif toolkit == "cocoa": DIRS += ["mac"] elif toolkit == "android": DIRS += ["android"] +elif toolkit == "uikit": + DIRS += ["ios"] else: DIRS += ["other"] diff --git a/accessible/xpcom/moz.build b/accessible/xpcom/moz.build index 2ce13081a2b0..65cfbfdc0b1d 100644 --- a/accessible/xpcom/moz.build +++ b/accessible/xpcom/moz.build @@ -59,6 +59,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": LOCAL_INCLUDES += [ "/accessible/android", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other", diff --git a/accessible/xul/moz.build b/accessible/xul/moz.build index 4fccfff6e015..88fc3ffa29b8 100644 --- a/accessible/xul/moz.build +++ b/accessible/xul/moz.build @@ -46,6 +46,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": LOCAL_INCLUDES += [ "/accessible/android", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": + LOCAL_INCLUDES += [ + "/accessible/ios", + ] else: LOCAL_INCLUDES += [ "/accessible/other",