summaryrefslogtreecommitdiffstats
path: root/accessible/generic/Accessible-inl.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /accessible/generic/Accessible-inl.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/generic/Accessible-inl.h')
-rw-r--r--accessible/generic/Accessible-inl.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/accessible/generic/Accessible-inl.h b/accessible/generic/Accessible-inl.h
new file mode 100644
index 000000000..f80056479
--- /dev/null
+++ b/accessible/generic/Accessible-inl.h
@@ -0,0 +1,135 @@
+/* -*- 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_Accessible_inl_h_
+#define mozilla_a11y_Accessible_inl_h_
+
+#include "DocAccessible.h"
+#include "ARIAMap.h"
+#include "nsCoreUtils.h"
+
+#ifdef A11Y_LOG
+#include "Logging.h"
+#endif
+
+namespace mozilla {
+namespace a11y {
+
+inline mozilla::a11y::role
+Accessible::Role()
+{
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ if (!roleMapEntry || roleMapEntry->roleRule != kUseMapRole)
+ return ARIATransformRole(NativeRole());
+
+ return ARIATransformRole(roleMapEntry->role);
+}
+
+inline bool
+Accessible::HasARIARole() const
+{
+ return mRoleMapEntryIndex != aria::NO_ROLE_MAP_ENTRY_INDEX;
+}
+
+inline bool
+Accessible::IsARIARole(nsIAtom* aARIARole) const
+{
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ return roleMapEntry && roleMapEntry->Is(aARIARole);
+}
+
+inline bool
+Accessible::HasStrongARIARole() const
+{
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ return roleMapEntry && roleMapEntry->roleRule == kUseMapRole;
+}
+
+inline const nsRoleMapEntry*
+Accessible::ARIARoleMap() const
+{
+ return aria::GetRoleMapFromIndex(mRoleMapEntryIndex);
+}
+
+inline mozilla::a11y::role
+Accessible::ARIARole()
+{
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ if (!roleMapEntry || roleMapEntry->roleRule != kUseMapRole)
+ return mozilla::a11y::roles::NOTHING;
+
+ return ARIATransformRole(roleMapEntry->role);
+}
+
+inline void
+Accessible::SetRoleMapEntry(const nsRoleMapEntry* aRoleMapEntry)
+{
+ mRoleMapEntryIndex = aria::GetIndexFromRoleMap(aRoleMapEntry);
+}
+
+inline bool
+Accessible::IsSearchbox() const
+{
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ return (roleMapEntry && roleMapEntry->Is(nsGkAtoms::searchbox)) ||
+ (mContent->IsHTMLElement(nsGkAtoms::input) &&
+ mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+ nsGkAtoms::textInputType, eCaseMatters));
+}
+
+inline bool
+Accessible::HasGenericType(AccGenericType aType) const
+{
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ return (mGenericTypes & aType) ||
+ (roleMapEntry && roleMapEntry->IsOfType(aType));
+}
+
+inline bool
+Accessible::HasNumericValue() const
+{
+ if (mStateFlags & eHasNumericValue)
+ return true;
+
+ const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ return roleMapEntry && roleMapEntry->valueRule != eNoValue;
+}
+
+inline void
+Accessible::ScrollTo(uint32_t aHow) const
+{
+ if (mContent)
+ nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow);
+}
+
+inline bool
+Accessible::InsertAfter(Accessible* aNewChild, Accessible* aRefChild)
+{
+ MOZ_ASSERT(aNewChild, "No new child to insert");
+
+ if (aRefChild && aRefChild->Parent() != this) {
+#ifdef A11Y_LOG
+ logging::TreeInfo("broken accessible tree", 0,
+ "parent", this, "prev sibling parent",
+ aRefChild->Parent(), "child", aNewChild, nullptr);
+ if (logging::IsEnabled(logging::eVerbose)) {
+ logging::Tree("TREE", "Document tree", mDoc);
+ logging::DOMTree("TREE", "DOM document tree", mDoc);
+ }
+#endif
+ MOZ_ASSERT_UNREACHABLE("Broken accessible tree");
+ mDoc->UnbindFromDocument(aNewChild);
+ return false;
+ }
+
+ return InsertChildAt(aRefChild ? aRefChild->IndexInParent() + 1 : 0,
+ aNewChild);
+}
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif