author | Eitan Isaacson <eitan@monotonous.org> |
Fri, 19 Feb 2021 23:14:32 +0000 | |
changeset 568148 | 0df6a015e7c44653ff9cb114d25644c0515b0cc9 |
parent 568147 | 9070544a3a945d2608389d7771f8ae9ac69f6a4d |
child 568149 | 345de85e66c21ef1928b11822683402465a98240 |
push id | 38221 |
push user | cbrindusan@mozilla.com |
push date | Sat, 20 Feb 2021 09:33:16 +0000 |
treeherder | mozilla-central@398870af9cb5 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | morgan |
bugs | 1693597 |
milestone | 87.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/accessible/android/AccessibleWrap.cpp +++ b/accessible/android/AccessibleWrap.cpp @@ -1,17 +1,17 @@ /* -*- 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" #include "JavaBuiltins.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "HyperTextAccessible-inl.h" #include "AccEvent.h" #include "AndroidInputType.h" #include "DocAccessibleWrap.h" #include "IDSet.h" #include "SessionAccessibility.h" #include "TextLeafAccessible.h" #include "TraversalRule.h" @@ -40,17 +40,17 @@ using namespace mozilla::a11y; // IDs should be a positive 32bit integer. IDSet sIDSet(31UL); //----------------------------------------------------- // construction //----------------------------------------------------- AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : Accessible(aContent, aDoc) { + : LocalAccessible(aContent, aDoc) { if (aDoc) { mID = AcquireID(); DocAccessibleWrap* doc = static_cast<DocAccessibleWrap*>(aDoc); doc->AddID(mID, this); } } //----------------------------------------------------- @@ -95,17 +95,17 @@ nsresult AccessibleWrap::HandleAccEvent( if (accessible != aEvent->Document() && !aEvent->IsFromUserInput()) { AccCaretMoveEvent* caretEvent = downcast_accEvent(aEvent); HyperTextAccessible* ht = AsHyperText(); // Pivot to the caret's position if it has an expanded selection. // This is used mostly for find in page. if ((ht && ht->SelectionCount())) { DOMPoint point = AsHyperText()->OffsetToDOMPoint(caretEvent->GetCaretOffset()); - if (Accessible* newPos = + if (LocalAccessible* newPos = doc->GetAccessibleOrContainer(point.node)) { static_cast<AccessibleWrap*>(newPos)->PivotTo( java::SessionAccessibility::HTML_GRANULARITY_DEFAULT, true, true); } } } break; @@ -115,17 +115,17 @@ nsresult AccessibleWrap::HandleAccEvent( java::SessionAccessibility::HTML_GRANULARITY_DEFAULT, true, true); break; } default: break; } } - nsresult rv = Accessible::HandleAccEvent(aEvent); + nsresult rv = LocalAccessible::HandleAccEvent(aEvent); NS_ENSURE_SUCCESS(rv, rv); accessible->HandleLiveRegionEvent(aEvent); if (IPCAccessibilityActive()) { return NS_OK; } @@ -242,22 +242,22 @@ void AccessibleWrap::Shutdown() { if (auto doc = static_cast<DocAccessibleWrap*>(mDoc.get())) { doc->RemoveID(mID); } ReleaseID(mID); mID = 0; } } - Accessible::Shutdown(); + LocalAccessible::Shutdown(); } bool AccessibleWrap::DoAction(uint8_t aIndex) const { if (ActionCount()) { - return Accessible::DoAction(aIndex); + return LocalAccessible::DoAction(aIndex); } if (mContent) { // We still simulate a click on an accessible even if there is no // known actions. For the sake of bad markup. DoCommand(); return true; } @@ -295,34 +295,34 @@ bool AccessibleWrap::GetSelectionBounds( } void AccessibleWrap::PivotTo(int32_t aGranularity, bool aForward, bool aInclusive) { AccessibleOrProxy accOrProxyRoot = AccessibleOrProxy(RootAccessible()); a11y::Pivot pivot(accOrProxyRoot); TraversalRule rule(aGranularity); AccessibleOrProxy accOrProxy = AccessibleOrProxy(this); - Accessible* result = + LocalAccessible* result = aForward ? pivot.Next(accOrProxy, rule, aInclusive).AsAccessible() : pivot.Prev(accOrProxy, rule, aInclusive).AsAccessible(); if (result && (result != this || aInclusive)) { PivotMoveReason reason = aForward ? nsIAccessiblePivot::REASON_NEXT : nsIAccessiblePivot::REASON_PREV; RefPtr<AccEvent> event = new AccVCChangeEvent( result->Document(), this, -1, -1, result, -1, -1, reason, nsIAccessiblePivot::NO_BOUNDARY, eFromUserInput); nsEventShell::FireEvent(event); } } void AccessibleWrap::ExploreByTouch(float aX, float aY) { a11y::Pivot pivot(RootAccessible()); TraversalRule rule; - Accessible* result = pivot.AtPoint(aX, aY, rule).AsAccessible(); + LocalAccessible* result = pivot.AtPoint(aX, aY, rule).AsAccessible(); if (result && result != this) { RefPtr<AccEvent> event = new AccVCChangeEvent(result->Document(), this, -1, -1, result, -1, -1, nsIAccessiblePivot::REASON_POINT, nsIAccessiblePivot::NO_BOUNDARY, eFromUserInput); nsEventShell::FireEvent(event); } @@ -352,17 +352,17 @@ void AccessibleWrap::NavigateText(int32_ case 2: // MOVEMENT_GRANULARITY_WORD pivotGranularity = nsIAccessiblePivot::WORD_BOUNDARY; break; default: break; } int32_t newOffset; - Accessible* newAnchor = nullptr; + LocalAccessible* newAnchor = nullptr; if (aForward) { newAnchor = pivot.NextText(this, &start, &end, pivotGranularity); newOffset = end; } else { newAnchor = pivot.PrevText(this, &start, &end, pivotGranularity); newOffset = start; } @@ -904,21 +904,21 @@ bool AccessibleWrap::HandleLiveRegionEve uint16_t priority = live.EqualsIgnoreCase("assertive") ? nsIAccessibleAnnouncementEvent::ASSERTIVE : nsIAccessibleAnnouncementEvent::POLITE; nsString atomic; rv = attributes->GetStringProperty("container-atomic"_ns, atomic); - Accessible* announcementTarget = this; + LocalAccessible* announcementTarget = this; nsAutoString announcement; if (atomic.EqualsIgnoreCase("true")) { - Accessible* atomicAncestor = nullptr; - for (Accessible* parent = announcementTarget; parent; + LocalAccessible* atomicAncestor = nullptr; + for (LocalAccessible* parent = announcementTarget; parent; parent = parent->LocalParent()) { dom::Element* element = parent->Elm(); if (element && element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_atomic, nsGkAtoms::_true, eCaseMatters)) { atomicAncestor = parent; break; }
--- a/accessible/android/AccessibleWrap.h +++ b/accessible/android/AccessibleWrap.h @@ -1,26 +1,26 @@ /* -*- 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/. */ #ifndef mozilla_a11y_AccessibleWrap_h_ #define mozilla_a11y_AccessibleWrap_h_ -#include "Accessible.h" +#include "LocalAccessible.h" #include "mozilla/a11y/ProxyAccessible.h" #include "mozilla/java/GeckoBundleWrappers.h" #include "mozilla/java/SessionAccessibilityWrappers.h" #include "nsCOMPtr.h" namespace mozilla { namespace a11y { -class AccessibleWrap : public Accessible { +class AccessibleWrap : public LocalAccessible { public: AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); virtual ~AccessibleWrap(); MOZ_CAN_RUN_SCRIPT_BOUNDARY // TODO: Mark this as MOZ_CAN_RUN_SCRIPT virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
--- a/accessible/android/DocAccessibleWrap.cpp +++ b/accessible/android/DocAccessibleWrap.cpp @@ -1,15 +1,15 @@ /* -*- 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 "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleOrProxy.h" #include "DocAccessibleChild.h" #include "DocAccessibleWrap.h" #include "nsIDocShell.h" #include "nsIScrollableFrame.h" #include "nsLayoutUtils.h" #include "nsAccessibilityService.h" #include "nsAccUtils.h" @@ -105,35 +105,35 @@ void DocAccessibleWrap::CacheViewportCal {nsLayoutUtils::FrameForPointOption::OnlyVisible}); AccessibleHashtable inViewAccs; for (size_t i = 0; i < frames.Length(); i++) { nsIContent* content = frames.ElementAt(i)->GetContent(); if (!content) { continue; } - Accessible* visibleAcc = docAcc->GetAccessibleOrContainer(content); + LocalAccessible* visibleAcc = docAcc->GetAccessibleOrContainer(content); if (!visibleAcc) { continue; } - for (Accessible* acc = visibleAcc; acc && acc != docAcc->LocalParent(); + for (LocalAccessible* acc = visibleAcc; acc && acc != docAcc->LocalParent(); acc = acc->LocalParent()) { if (inViewAccs.Contains(acc->UniqueID())) { break; } inViewAccs.Put(acc->UniqueID(), RefPtr{acc}); } } if (IPCAccessibilityActive()) { DocAccessibleChild* ipcDoc = docAcc->IPCDoc(); nsTArray<BatchData> cacheData(inViewAccs.Count()); for (auto iter = inViewAccs.Iter(); !iter.Done(); iter.Next()) { - Accessible* accessible = iter.Data(); + LocalAccessible* accessible = iter.Data(); nsAutoString name; accessible->Name(name); nsAutoString textValue; accessible->Value(textValue); nsAutoString nodeID; static_cast<AccessibleWrap*>(accessible)->WrapperDOMNodeID(nodeID); nsAutoString description; accessible->Description(description); @@ -157,18 +157,18 @@ void DocAccessibleWrap::CacheViewportCal sessionAcc->ReplaceViewportCache(accessibles); } if (docAcc->mCachePivotBoundaries) { AccessibleOrProxy accOrProxy = AccessibleOrProxy(docAcc); a11y::Pivot pivot(accOrProxy); TraversalRule rule(java::SessionAccessibility::HTML_GRANULARITY_DEFAULT); - Accessible* first = pivot.First(rule).AsAccessible(); - Accessible* last = pivot.Last(rule).AsAccessible(); + LocalAccessible* first = pivot.First(rule).AsAccessible(); + LocalAccessible* last = pivot.Last(rule).AsAccessible(); // If first/last are null, pass the root document as pivot boundary. if (IPCAccessibilityActive()) { DocAccessibleChild* ipcDoc = docAcc->IPCDoc(); DocAccessibleChild* firstDoc = first ? first->Document()->IPCDoc() : ipcDoc; DocAccessibleChild* lastDoc = last ? last->Document()->IPCDoc() : ipcDoc; if (ipcDoc && firstDoc && lastDoc) { @@ -261,17 +261,17 @@ void DocAccessibleWrap::UpdateFocusPathB if (!mFocusPath.Count()) { return; } if (IPCAccessibilityActive()) { DocAccessibleChild* ipcDoc = IPCDoc(); nsTArray<BatchData> boundsData(mFocusPath.Count()); for (auto iter = mFocusPath.Iter(); !iter.Done(); iter.Next()) { - Accessible* accessible = iter.Data(); + LocalAccessible* accessible = iter.Data(); if (!accessible || accessible->IsDefunct()) { MOZ_ASSERT_UNREACHABLE("Focus path cached accessible is gone."); continue; } boundsData.AppendElement( BatchData(accessible->Document()->IPCDoc(), UNIQUE_ID(accessible), 0, accessible->Bounds(), 0, nsString(), nsString(), nsString(), @@ -280,17 +280,17 @@ void DocAccessibleWrap::UpdateFocusPathB UnspecifiedNaN<double>(), nsTArray<Attribute>())); } ipcDoc->SendBatch(eBatch_BoundsUpdate, boundsData); } else if (RefPtr<SessionAccessibility> sessionAcc = SessionAccessibility::GetInstanceFor(this)) { nsTArray<AccessibleWrap*> accessibles(mFocusPath.Count()); for (auto iter = mFocusPath.Iter(); !iter.Done(); iter.Next()) { - Accessible* accessible = iter.Data(); + LocalAccessible* accessible = iter.Data(); if (!accessible || accessible->IsDefunct()) { MOZ_ASSERT_UNREACHABLE("Focus path cached accessible is gone."); continue; } accessibles.AppendElement(static_cast<AccessibleWrap*>(accessible)); }
--- a/accessible/android/ProxyAccessibleWrap.cpp +++ b/accessible/android/ProxyAccessibleWrap.cpp @@ -1,15 +1,15 @@ /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- * 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 "ProxyAccessibleWrap.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "nsPersistentProperties.h" #include "mozilla/a11y/DocAccessiblePlatformExtParent.h" using namespace mozilla::a11y; ProxyAccessibleWrap::ProxyAccessibleWrap(ProxyAccessible* aProxy) @@ -45,29 +45,29 @@ void ProxyAccessibleWrap::Shutdown() { ReleaseID(mID); mID = 0; } mBits.proxy = nullptr; mStateFlags |= eIsDefunct; } -// Accessible +// LocalAccessible already_AddRefed<nsIPersistentProperties> ProxyAccessibleWrap::Attributes() { AutoTArray<Attribute, 10> attrs; Proxy()->Attributes(&attrs); return AttributeArrayToProperties(attrs); } uint32_t ProxyAccessibleWrap::ChildCount() const { return Proxy()->ChildrenCount(); } -Accessible* ProxyAccessibleWrap::LocalChildAt(uint32_t aIndex) const { +LocalAccessible* ProxyAccessibleWrap::LocalChildAt(uint32_t aIndex) const { ProxyAccessible* child = Proxy()->RemoteChildAt(aIndex); return child ? WrapperFor(child) : nullptr; } ENameValueFlag ProxyAccessibleWrap::Name(nsString& aName) const { Proxy()->Name(aName); return eNameOK; }
--- a/accessible/android/ProxyAccessibleWrap.h +++ b/accessible/android/ProxyAccessibleWrap.h @@ -10,35 +10,35 @@ #include "AccessibleWrap.h" #include "DocAccessibleParent.h" namespace mozilla { namespace a11y { /** - * A wrapper for Accessible proxies. The public methods here should be overriden - * from AccessibleWrap or its super classes. - * This gives us an abstraction layer so SessionAccessibility doesn't have - * to distinguish between a local or remote accessibles. - * NOTE: This shouldn't be regarded as a full Accessible implementation. + * A wrapper for Accessible proxies. The public methods here should be + * overriden from AccessibleWrap or its super classes. This gives us an + * abstraction layer so SessionAccessibility doesn't have to distinguish between + * a local or remote accessibles. NOTE: This shouldn't be regarded as a full + * Accessible implementation. */ class ProxyAccessibleWrap : public AccessibleWrap { public: explicit ProxyAccessibleWrap(ProxyAccessible* aProxy); virtual void Shutdown() override; - // Accessible + // LocalAccessible virtual already_AddRefed<nsIPersistentProperties> Attributes() override; virtual uint32_t ChildCount() const override; - virtual Accessible* LocalChildAt(uint32_t aIndex) const override; + virtual LocalAccessible* LocalChildAt(uint32_t aIndex) const override; virtual ENameValueFlag Name(nsString& aName) const override; virtual void Value(nsString& aValue) const override; virtual uint64_t State() override; virtual nsIntRect Bounds() const override;
--- a/accessible/android/RootAccessibleWrap.cpp +++ b/accessible/android/RootAccessibleWrap.cpp @@ -1,16 +1,16 @@ /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- * 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 "RootAccessibleWrap.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleOrProxy.h" #include "DocAccessibleParent.h" #include "DocAccessible-inl.h" #include "ProxyAccessibleWrap.h" #include "SessionAccessibility.h" #include "mozilla/PresShell.h" using namespace mozilla;
--- a/accessible/android/SessionAccessibility.cpp +++ b/accessible/android/SessionAccessibility.cpp @@ -1,15 +1,15 @@ /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- * 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 "SessionAccessibility.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AndroidUiThread.h" #include "DocAccessibleParent.h" #include "nsThreadUtils.h" #include "AccessibilityEvent.h" #include "HyperTextAccessible.h" #include "JavaBuiltins.h" #include "RootAccessibleWrap.h" #include "nsAccessibilityService.h" @@ -165,22 +165,22 @@ RefPtr<SessionAccessibility> SessionAcce auto tab = static_cast<dom::BrowserParent*>(aAccessible->Document()->Manager()); dom::Element* frame = tab->GetOwnerElement(); MOZ_ASSERT(frame); if (!frame) { return nullptr; } - Accessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc()); + LocalAccessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc()); return chromeDoc ? GetInstanceFor(chromeDoc) : nullptr; } RefPtr<SessionAccessibility> SessionAccessibility::GetInstanceFor( - Accessible* aAccessible) { + LocalAccessible* aAccessible) { RootAccessible* rootAcc = aAccessible->RootAccessible(); nsViewManager* vm = rootAcc->PresShellPtr()->GetViewManager(); if (!vm) { return nullptr; } nsCOMPtr<nsIWidget> rootWidget; vm->GetRootWidget(getter_AddRefs(rootWidget));
--- a/accessible/android/SessionAccessibility.h +++ b/accessible/android/SessionAccessibility.h @@ -39,17 +39,18 @@ class SessionAccessibility final const java::SessionAccessibility::NativeProvider::Ref& GetJavaAccessibility() { return mSessionAccessibility; } static void Init(); static RefPtr<SessionAccessibility> GetInstanceFor( ProxyAccessible* aAccessible); - static RefPtr<SessionAccessibility> GetInstanceFor(Accessible* aAccessible); + static RefPtr<SessionAccessibility> GetInstanceFor( + LocalAccessible* aAccessible); // Native implementations using Base::AttachNative; using Base::DisposeNative; jni::Object::LocalRef GetNodeInfo(int32_t aID); void SetText(int32_t aID, jni::String::Param aText); void Click(int32_t aID); void Pivot(int32_t aID, int32_t aGranularity, bool aForward, bool aInclusive);
--- a/accessible/android/TraversalRule.cpp +++ b/accessible/android/TraversalRule.cpp @@ -4,18 +4,18 @@ * 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 "TraversalRule.h" #include "mozilla/ArrayUtils.h" #include "Role.h" -#include "Accessible.h" -#include "Accessible-inl.h" +#include "LocalAccessible.h" +#include "LocalAccessible-inl.h" #include "HTMLListAccessible.h" #include "SessionAccessibility.h" #include "nsAccUtils.h" #include "nsIAccessiblePivot.h" using namespace mozilla; using namespace mozilla::a11y; @@ -23,17 +23,17 @@ TraversalRule::TraversalRule() : TraversalRule(java::SessionAccessibility::HTML_GRANULARITY_DEFAULT) {} TraversalRule::TraversalRule(int32_t aGranularity) : mGranularity(aGranularity) {} uint16_t TraversalRule::Match(const AccessibleOrProxy& aAccOrProxy) { MOZ_ASSERT(aAccOrProxy.IsAccessible(), "Should only receive accessibles when processing on android."); - Accessible* aAccessible = aAccOrProxy.AsAccessible(); + LocalAccessible* aAccessible = aAccOrProxy.AsAccessible(); uint16_t result = nsIAccessibleTraversalRule::FILTER_IGNORE; if (nsAccUtils::MustPrune(aAccessible)) { result |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE; } uint64_t state = aAccessible->State(); @@ -67,109 +67,109 @@ uint16_t TraversalRule::Match(const Acce default: result |= DefaultMatch(aAccessible); break; } return result; } -bool TraversalRule::IsSingleLineage(Accessible* aAccessible) { - Accessible* child = aAccessible; +bool TraversalRule::IsSingleLineage(LocalAccessible* aAccessible) { + LocalAccessible* child = aAccessible; while (child) { switch (child->ChildCount()) { case 0: return true; case 1: child = child->LocalFirstChild(); break; case 2: - if (Accessible* bullet = + if (LocalAccessible* bullet = child->LocalParent()->IsHTMLListItem() ? child->LocalParent()->AsHTMLListItem()->Bullet() : nullptr) { child = bullet->LocalNextSibling(); } else { return false; } break; default: return false; } } return true; } -bool TraversalRule::IsListItemBullet(const Accessible* aAccessible) { - Accessible* parent = aAccessible->LocalParent(); +bool TraversalRule::IsListItemBullet(const LocalAccessible* aAccessible) { + LocalAccessible* parent = aAccessible->LocalParent(); return parent && parent->IsHTMLListItem() && parent->AsHTMLListItem()->Bullet() == aAccessible; } -bool TraversalRule::IsFlatSubtree(const Accessible* aAccessible) { +bool TraversalRule::IsFlatSubtree(const LocalAccessible* aAccessible) { for (auto child = aAccessible->LocalFirstChild(); child; child = child->LocalNextSibling()) { roles::Role role = child->Role(); if (role == roles::TEXT_LEAF || role == roles::STATICTEXT) { continue; } if (child->ChildCount() > 0 || child->ActionCount() > 0) { return false; } } return true; } -bool TraversalRule::HasName(const Accessible* aAccessible) { +bool TraversalRule::HasName(const LocalAccessible* aAccessible) { nsAutoString name; aAccessible->Name(name); name.CompressWhitespace(); return !name.IsEmpty(); } -uint16_t TraversalRule::LinkMatch(Accessible* aAccessible) { +uint16_t TraversalRule::LinkMatch(LocalAccessible* aAccessible) { if (aAccessible->Role() == roles::LINK && (aAccessible->State() & states::LINKED) != 0) { return nsIAccessibleTraversalRule::FILTER_MATCH | nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE; } return nsIAccessibleTraversalRule::FILTER_IGNORE; } -uint16_t TraversalRule::HeadingMatch(Accessible* aAccessible) { +uint16_t TraversalRule::HeadingMatch(LocalAccessible* aAccessible) { if (aAccessible->Role() == roles::HEADING && aAccessible->ChildCount()) { return nsIAccessibleTraversalRule::FILTER_MATCH; } return nsIAccessibleTraversalRule::FILTER_IGNORE; } -uint16_t TraversalRule::SectionMatch(Accessible* aAccessible) { +uint16_t TraversalRule::SectionMatch(LocalAccessible* aAccessible) { roles::Role role = aAccessible->Role(); if (role == roles::HEADING || role == roles::LANDMARK || aAccessible->LandmarkRole()) { return nsIAccessibleTraversalRule::FILTER_MATCH; } return nsIAccessibleTraversalRule::FILTER_IGNORE; } -uint16_t TraversalRule::LandmarkMatch(Accessible* aAccessible) { +uint16_t TraversalRule::LandmarkMatch(LocalAccessible* aAccessible) { if (aAccessible->LandmarkRole()) { return nsIAccessibleTraversalRule::FILTER_MATCH; } return nsIAccessibleTraversalRule::FILTER_IGNORE; } -uint16_t TraversalRule::ControlMatch(Accessible* aAccessible) { +uint16_t TraversalRule::ControlMatch(LocalAccessible* aAccessible) { switch (aAccessible->Role()) { case roles::PUSHBUTTON: case roles::SPINBUTTON: case roles::TOGGLE_BUTTON: case roles::BUTTONDROPDOWN: case roles::BUTTONDROPDOWNGRID: case roles::COMBOBOX: case roles::LISTBOX: @@ -198,17 +198,17 @@ uint16_t TraversalRule::ControlMatch(Acc break; default: break; } return nsIAccessibleTraversalRule::FILTER_IGNORE; } -uint16_t TraversalRule::DefaultMatch(Accessible* aAccessible) { +uint16_t TraversalRule::DefaultMatch(LocalAccessible* aAccessible) { switch (aAccessible->Role()) { case roles::COMBOBOX: // We don't want to ignore the subtree because this is often // where the list box hangs out. return nsIAccessibleTraversalRule::FILTER_MATCH; case roles::EDITCOMBOBOX: if (aAccessible->NativeState() & states::EDITABLE) { // Only match ARIA 1.0 comboboxes; i.e. where the combobox itself is
--- a/accessible/android/TraversalRule.h +++ b/accessible/android/TraversalRule.h @@ -7,50 +7,50 @@ #ifndef _TraversalRule_H_ #define _TraversalRule_H_ #include "Pivot.h" namespace mozilla { namespace a11y { -class Accessible; +class LocalAccessible; /** * Class represents a simple traversal rule. */ class TraversalRule final : public PivotRule { public: TraversalRule(); explicit TraversalRule(int32_t aGranularity); ~TraversalRule() = default; virtual uint16_t Match(const AccessibleOrProxy& aAccOrProxy) override; private: - bool IsSingleLineage(Accessible* aAccessible); + bool IsSingleLineage(LocalAccessible* aAccessible); - bool IsFlatSubtree(const Accessible* aAccessible); + bool IsFlatSubtree(const LocalAccessible* aAccessible); - bool IsListItemBullet(const Accessible* aAccessible); + bool IsListItemBullet(const LocalAccessible* aAccessible); - bool HasName(const Accessible* aAccessible); + bool HasName(const LocalAccessible* aAccessible); - uint16_t DefaultMatch(Accessible* aAccessible); + uint16_t DefaultMatch(LocalAccessible* aAccessible); - uint16_t LinkMatch(Accessible* aAccessible); + uint16_t LinkMatch(LocalAccessible* aAccessible); - uint16_t HeadingMatch(Accessible* aAccessible); + uint16_t HeadingMatch(LocalAccessible* aAccessible); - uint16_t ControlMatch(Accessible* aAccessible); + uint16_t ControlMatch(LocalAccessible* aAccessible); - uint16_t SectionMatch(Accessible* aAccessible); + uint16_t SectionMatch(LocalAccessible* aAccessible); - uint16_t LandmarkMatch(Accessible* aAccessible); + uint16_t LandmarkMatch(LocalAccessible* aAccessible); int32_t mGranularity; }; } // namespace a11y } // namespace mozilla #endif
--- a/accessible/aom/AccessibleNode.cpp +++ b/accessible/aom/AccessibleNode.cpp @@ -7,17 +7,17 @@ #include "mozilla/dom/AccessibleNodeBinding.h" #include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/DOMStringList.h" #include "mozilla/StaticPrefs_accessibility.h" #include "nsContentUtils.h" #include "nsIPersistentProperties2.h" #include "nsISimpleEnumerator.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "nsAccessibilityService.h" #include "DocAccessible.h" #include "mozilla/dom/Document.h" // for inline nsINode::GetParentObject #include "mozilla/dom/ToJSValue.h" using namespace mozilla; using namespace mozilla::a11y;
--- a/accessible/aom/AccessibleNode.h +++ b/accessible/aom/AccessibleNode.h @@ -16,17 +16,17 @@ class nsINode; namespace mozilla { class ErrorResult; namespace a11y { -class Accessible; +class LocalAccessible; } namespace dom { class DOMStringList; struct ParentObject; #define ANODE_ENUM(name) e##name, @@ -195,17 +195,17 @@ class AccessibleNode : public nsISupport } // The 2k'th bit indicates whether the k'th boolean property is used(1) or // not(0) and 2k+1'th bit contains the property's value(1:true, 0:false) uint32_t mBooleanProperties; nsRefPtrHashtable<nsUint32HashKey, AccessibleNode> mRelationProperties; nsDataHashtable<nsUint32HashKey, nsString> mStringProperties; - RefPtr<a11y::Accessible> mIntl; + RefPtr<a11y::LocalAccessible> mIntl; RefPtr<nsINode> mDOMNode; RefPtr<dom::DOMStringList> mStates; }; } // namespace dom } // namespace mozilla #endif // A11Y_JSAPI_ACCESSIBLENODE
--- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -1,17 +1,17 @@ /* -*- 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 "AccessibleWrap.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "ApplicationAccessibleWrap.h" #include "InterfaceInitFuncs.h" #include "nsAccUtils.h" #include "mozilla/a11y/PDocAccessible.h" #include "OuterDocAccessible.h" #include "ProxyAccessible.h" #include "DocAccessibleParent.h" #include "RootAccessible.h" @@ -242,17 +242,17 @@ GType mai_atk_object_get_type(void) { type = g_type_register_static(ATK_TYPE_OBJECT, "MaiAtkObject", &tinfo, GTypeFlags(0)); quark_mai_hyperlink = g_quark_from_static_string("MaiHyperlink"); } return type; } AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : Accessible(aContent, aDoc), mAtkObject(nullptr) {} + : LocalAccessible(aContent, aDoc), mAtkObject(nullptr) {} AccessibleWrap::~AccessibleWrap() { NS_ASSERTION(!mAtkObject, "ShutdownAtkObject() is not called"); } void AccessibleWrap::ShutdownAtkObject() { if (!mAtkObject) return; @@ -260,17 +260,17 @@ void AccessibleWrap::ShutdownAtkObject() if (IS_MAI_OBJECT(mAtkObject)) MAI_ATK_OBJECT(mAtkObject)->Shutdown(); g_object_unref(mAtkObject); mAtkObject = nullptr; } void AccessibleWrap::Shutdown() { ShutdownAtkObject(); - Accessible::Shutdown(); + LocalAccessible::Shutdown(); } void AccessibleWrap::GetNativeInterface(void** aOutAccessible) { *aOutAccessible = nullptr; if (!mAtkObject) { if (IsDefunct() || IsText()) { // We don't create ATK objects for node which has been shutdown or @@ -293,19 +293,19 @@ void AccessibleWrap::GetNativeInterface( } AtkObject* AccessibleWrap::GetAtkObject(void) { void* atkObj = nullptr; GetNativeInterface(&atkObj); return static_cast<AtkObject*>(atkObj); } -// Get AtkObject from Accessible interface +// Get AtkObject from LocalAccessible interface /* static */ -AtkObject* AccessibleWrap::GetAtkObject(Accessible* acc) { +AtkObject* AccessibleWrap::GetAtkObject(LocalAccessible* acc) { void* atkObjPtr = nullptr; acc->GetNativeInterface(&atkObjPtr); return atkObjPtr ? ATK_OBJECT(atkObjPtr) : nullptr; } /* private */ uint16_t AccessibleWrap::CreateMaiInterfaces(void) { uint16_t interfacesBits = 0; @@ -671,17 +671,17 @@ static AtkAttributeSet* ConvertToAtkAttr objAttr->value = g_strdup(NS_ConvertUTF16toUTF8(value).get()); objAttributeSet = g_slist_prepend(objAttributeSet, objAttr); } // libspi will free it return objAttributeSet; } -AtkAttributeSet* GetAttributeSet(Accessible* aAccessible) { +AtkAttributeSet* GetAttributeSet(LocalAccessible* aAccessible) { nsCOMPtr<nsIPersistentProperties> attributes = aAccessible->Attributes(); if (attributes) return ConvertToAtkAttributeSet(attributes); return nullptr; } AtkAttributeSet* getAttributesCB(AtkObject* aAtkObj) { AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj); @@ -766,17 +766,17 @@ AtkObject* refChildCB(AtkObject* aAtkObj AtkObject* childAtkObj = nullptr; AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj); if (accWrap) { if (nsAccUtils::MustPrune(accWrap)) { return nullptr; } - Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex); + LocalAccessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex); if (accChild) { childAtkObj = AccessibleWrap::GetAtkObject(accChild); } else { OuterDocAccessible* docOwner = accWrap->AsOuterDoc(); if (docOwner) { ProxyAccessible* proxyDoc = docOwner->RemoteChildDoc(); if (proxyDoc) childAtkObj = GetWrapperFor(proxyDoc); } @@ -800,17 +800,17 @@ AtkObject* refChildCB(AtkObject* aAtkObj if (aAtkObj != childAtkObj->accessible_parent) { atk_object_set_parent(childAtkObj, aAtkObj); } return childAtkObj; } gint getIndexInParentCB(AtkObject* aAtkObj) { - // We don't use Accessible::IndexInParent() because we don't include text + // We don't use LocalAccessible::IndexInParent() because we don't include text // leaf nodes as children in ATK. if (ProxyAccessible* proxy = GetProxy(aAtkObj)) { if (ProxyAccessible* parent = proxy->RemoteParent()) { return parent->IndexOfEmbeddedChild(proxy); } if (proxy->OuterDocOfRemoteBrowser()) { return 0; @@ -819,17 +819,17 @@ gint getIndexInParentCB(AtkObject* aAtkO return -1; } AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj); if (!accWrap) { return -1; } - Accessible* parent = accWrap->LocalParent(); + LocalAccessible* parent = accWrap->LocalParent(); if (!parent) return -1; // No parent return parent->GetIndexOfEmbeddedChild(accWrap); } static void TranslateStates(uint64_t aState, roles::Role aRole, AtkStateSet* aStateSet) { // atk doesn't have a read only state so read only things shouldn't be @@ -867,28 +867,28 @@ AtkStateSet* refStateSetCB(AtkObject* aA TranslateStates(proxy->State(), proxy->Role(), state_set); } else { TranslateStates(states::DEFUNCT, roles::NOTHING, state_set); } return state_set; } -static void UpdateAtkRelation(RelationType aType, Accessible* aAcc, +static void UpdateAtkRelation(RelationType aType, LocalAccessible* aAcc, AtkRelationType aAtkType, AtkRelationSet* aAtkSet) { if (aAtkType == ATK_RELATION_NULL) return; AtkRelation* atkRelation = atk_relation_set_get_relation_by_type(aAtkSet, aAtkType); if (atkRelation) atk_relation_set_remove(aAtkSet, atkRelation); Relation rel(aAcc->RelationByType(aType)); nsTArray<AtkObject*> targets; - Accessible* tempAcc = nullptr; + LocalAccessible* tempAcc = nullptr; while ((tempAcc = rel.Next())) { targets.AppendElement(AccessibleWrap::GetAtkObject(tempAcc)); } if (aType == RelationType::EMBEDS && aAcc->IsRoot()) { if (ProxyAccessible* proxyDoc = aAcc->AsRoot()->GetPrimaryRemoteTopLevelContentDoc()) { targets.AppendElement(GetWrapperFor(proxyDoc)); @@ -958,17 +958,17 @@ AtkRelationSet* refRelationSetCB(AtkObje // Check if aAtkObj is a valid MaiAtkObject, and return the AccessibleWrap // for it. AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj) { bool isMAIObject = IS_MAI_OBJECT(aAtkObj); NS_ENSURE_TRUE(isMAIObject || MAI_IS_ATK_SOCKET(aAtkObj), nullptr); AccessibleWrap* accWrap = nullptr; if (isMAIObject) { - Accessible* acc = MAI_ATK_OBJECT(aAtkObj)->accWrap.AsAccessible(); + LocalAccessible* acc = MAI_ATK_OBJECT(aAtkObj)->accWrap.AsAccessible(); accWrap = static_cast<AccessibleWrap*>(acc); } else { accWrap = MAI_ATK_SOCKET(aAtkObj)->accWrap; } // Check if the accessible was deconstructed. if (!accWrap) return nullptr; @@ -1060,24 +1060,24 @@ void a11y::ProxyDestroyed(ProxyAccessibl } obj->Shutdown(); g_object_unref(obj); aProxy->SetWrapper(0); } nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) { - nsresult rv = Accessible::HandleAccEvent(aEvent); + nsresult rv = LocalAccessible::HandleAccEvent(aEvent); NS_ENSURE_SUCCESS(rv, rv); if (IPCAccessibilityActive()) { return NS_OK; } - Accessible* accessible = aEvent->GetAccessible(); + LocalAccessible* accessible = aEvent->GetAccessible(); NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE); // The accessible can become defunct if we have an xpcom event listener // which decides it would be fun to change the DOM and flush layout. if (accessible->IsDefunct()) return NS_OK; uint32_t type = aEvent->GetEventType(); @@ -1235,17 +1235,17 @@ nsresult AccessibleWrap::HandleAccEvent( break; case nsIAccessibleEvent::EVENT_SECTION_CHANGED: g_signal_emit_by_name(atkObj, "visible_data_changed"); break; case nsIAccessibleEvent::EVENT_SHOW: { AccMutationEvent* event = downcast_accEvent(aEvent); - Accessible* parentAcc = + LocalAccessible* parentAcc = event ? event->LocalParent() : accessible->LocalParent(); AtkObject* parent = AccessibleWrap::GetAtkObject(parentAcc); NS_ENSURE_STATE(parent); auto obj = reinterpret_cast<MaiAtkObject*>(atkObj); obj->FireAtkShowHideEvent(parent, true, aEvent->IsFromUserInput()); return NS_OK; } @@ -1253,17 +1253,17 @@ nsresult AccessibleWrap::HandleAccEvent( // XXX - Handle native dialog accessibles. if (!accessible->IsRoot() && accessible->HasARIARole() && accessible->ARIARole() == roles::DIALOG) { guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT); g_signal_emit(atkObj, id, 0); } AccMutationEvent* event = downcast_accEvent(aEvent); - Accessible* parentAcc = + LocalAccessible* parentAcc = event ? event->LocalParent() : accessible->LocalParent(); AtkObject* parent = AccessibleWrap::GetAtkObject(parentAcc); NS_ENSURE_STATE(parent); auto obj = reinterpret_cast<MaiAtkObject*>(atkObj); obj->FireAtkShowHideEvent(parent, false, aEvent->IsFromUserInput()); return NS_OK; } @@ -1492,27 +1492,27 @@ void MaiAtkObject::FireAtkShowHideEvent( void a11y::ProxySelectionEvent(ProxyAccessible*, ProxyAccessible* aWidget, uint32_t) { MaiAtkObject* obj = MAI_ATK_OBJECT(GetWrapperFor(aWidget)); g_signal_emit_by_name(obj, "selection_changed"); } // static -void AccessibleWrap::GetKeyBinding(Accessible* aAccessible, +void AccessibleWrap::GetKeyBinding(LocalAccessible* aAccessible, nsAString& aResult) { // Return all key bindings including access key and keyboard shortcut. // Get access key. nsAutoString keyBindingsStr; KeyBinding keyBinding = aAccessible->AccessKey(); if (!keyBinding.IsEmpty()) { keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat); - Accessible* parent = aAccessible->LocalParent(); + LocalAccessible* parent = aAccessible->LocalParent(); roles::Role role = parent ? parent->Role() : roles::NOTHING; if (role == roles::PARENT_MENUITEM || role == roles::MENUITEM || role == roles::RADIO_MENU_ITEM || role == roles::CHECK_MENU_ITEM) { // It is submenu, expose keyboard shortcuts from menu hierarchy like // "s;<Alt>f:s" nsAutoString keysInHierarchyStr = keyBindingsStr; do { KeyBinding parentKeyBinding = parent->AccessKey(); @@ -1539,72 +1539,72 @@ void AccessibleWrap::GetKeyBinding(Acces keyBinding = aAccessible->KeyboardShortcut(); if (!keyBinding.IsEmpty()) { keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat); } aResult = keyBindingsStr; } // static -Accessible* AccessibleWrap::GetColumnHeader(TableAccessible* aAccessible, - int32_t aColIdx) { +LocalAccessible* AccessibleWrap::GetColumnHeader(TableAccessible* aAccessible, + int32_t aColIdx) { if (!aAccessible) { return nullptr; } - Accessible* cell = aAccessible->CellAt(0, aColIdx); + LocalAccessible* cell = aAccessible->CellAt(0, aColIdx); if (!cell) { return nullptr; } // If the cell at the first row is column header then assume it is column // header for all rows, if (cell->Role() == roles::COLUMNHEADER) { return cell; } // otherwise get column header for the data cell at the first row. TableCellAccessible* tableCell = cell->AsTableCell(); if (!tableCell) { return nullptr; } - AutoTArray<Accessible*, 10> headerCells; + AutoTArray<LocalAccessible*, 10> headerCells; tableCell->ColHeaderCells(&headerCells); if (headerCells.IsEmpty()) { return nullptr; } return headerCells[0]; } // static -Accessible* AccessibleWrap::GetRowHeader(TableAccessible* aAccessible, - int32_t aRowIdx) { +LocalAccessible* AccessibleWrap::GetRowHeader(TableAccessible* aAccessible, + int32_t aRowIdx) { if (!aAccessible) { return nullptr; } - Accessible* cell = aAccessible->CellAt(aRowIdx, 0); + LocalAccessible* cell = aAccessible->CellAt(aRowIdx, 0); if (!cell) { return nullptr; } // If the cell at the first column is row header then assume it is row // header for all columns, if (cell->Role() == roles::ROWHEADER) { return cell; } // otherwise get row header for the data cell at the first column. TableCellAccessible* tableCell = cell->AsTableCell(); if (!tableCell) { return nullptr; } - AutoTArray<Accessible*, 10> headerCells; + AutoTArray<LocalAccessible*, 10> headerCells; tableCell->RowHeaderCells(&headerCells); if (headerCells.IsEmpty()) { return nullptr; } return headerCells[0]; }
--- a/accessible/atk/AccessibleWrap.h +++ b/accessible/atk/AccessibleWrap.h @@ -3,17 +3,17 @@ /* 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" +#include "LocalAccessible.h" struct _AtkObject; typedef struct _AtkObject AtkObject; enum AtkProperty { PROP_0, // gobject convention PROP_NAME, PROP_DESCRIPTION, @@ -40,45 +40,45 @@ namespace mozilla { namespace a11y { class MaiHyperlink; /** * AccessibleWrap, and its descendents in atk directory provide the * implementation of AtkObject. */ -class AccessibleWrap : public Accessible { +class AccessibleWrap : public LocalAccessible { 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); + static AtkObject* GetAtkObject(LocalAccessible* aAccessible); bool IsValidObject(); static const char* ReturnString(nsAString& aString) { static nsCString returnedString; CopyUTF16toUTF8(aString, returnedString); return returnedString.get(); } - static void GetKeyBinding(Accessible* aAccessible, nsAString& aResult); + static void GetKeyBinding(LocalAccessible* aAccessible, nsAString& aResult); - static Accessible* GetColumnHeader(TableAccessible* aAccessible, - int32_t aColIdx); - static Accessible* GetRowHeader(TableAccessible* aAccessible, - int32_t aRowIdx); + static LocalAccessible* GetColumnHeader(TableAccessible* aAccessible, + int32_t aColIdx); + static LocalAccessible* GetRowHeader(TableAccessible* aAccessible, + int32_t aRowIdx); protected: nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject* aObject); nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject* aObject); AtkObject* mAtkObject; private:
--- a/accessible/atk/ApplicationAccessibleWrap.cpp +++ b/accessible/atk/ApplicationAccessibleWrap.cpp @@ -44,23 +44,24 @@ gboolean toplevel_event_watcher(GSignalI AtkRole role = atk_object_get_role(child); // GTK native dialog if (!IS_MAI_OBJECT(child) && (role == ATK_ROLE_DIALOG || role == ATK_ROLE_FILE_CHOOSER || role == ATK_ROLE_COLOR_CHOOSER || role == ATK_ROLE_FONT_CHOOSER)) { if (data == reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW)) { // Attach the dialog accessible to app accessible tree - Accessible* windowAcc = GetAccService()->AddNativeRootAccessible(child); + LocalAccessible* windowAcc = + GetAccService()->AddNativeRootAccessible(child); g_object_set_qdata(G_OBJECT(child), sQuark_gecko_acc_obj, reinterpret_cast<gpointer>(windowAcc)); } else { // Deattach the dialog accessible - Accessible* windowAcc = reinterpret_cast<Accessible*>( + LocalAccessible* windowAcc = reinterpret_cast<LocalAccessible*>( g_object_get_qdata(G_OBJECT(child), sQuark_gecko_acc_obj)); if (windowAcc) { GetAccService()->RemoveNativeRootAccessible(windowAcc); g_object_set_qdata(G_OBJECT(child), sQuark_gecko_acc_obj, nullptr); } } } @@ -105,17 +106,17 @@ gboolean fireRootAccessibleAddedCB(gpoin g_object_unref(eventData->app_accessible); g_object_unref(eventData->root_accessible); free(data); return FALSE; } bool ApplicationAccessibleWrap::InsertChildAt(uint32_t aIdx, - Accessible* aChild) { + LocalAccessible* 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 @@ -129,17 +130,17 @@ bool ApplicationAccessibleWrap::InsertCh g_object_ref(mAtkObject); g_object_ref(atkAccessible); g_timeout_add(0, fireRootAccessibleAddedCB, eventData); } return true; } -bool ApplicationAccessibleWrap::RemoveChild(Accessible* aChild) { +bool ApplicationAccessibleWrap::RemoveChild(LocalAccessible* 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);
--- a/accessible/atk/ApplicationAccessibleWrap.h +++ b/accessible/atk/ApplicationAccessibleWrap.h @@ -12,20 +12,20 @@ namespace mozilla { namespace a11y { class ApplicationAccessibleWrap : public ApplicationAccessible { public: ApplicationAccessibleWrap(); virtual ~ApplicationAccessibleWrap(); - // Accessible + // LocalAccessible virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override; - virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) override; - virtual bool RemoveChild(Accessible* aChild) override; + virtual bool InsertChildAt(uint32_t aIdx, LocalAccessible* aChild) override; + virtual bool RemoveChild(LocalAccessible* aChild) override; /** * Return the atk object for app root accessible. */ virtual void GetNativeInterface(void** aOutAccessible) override; }; } // namespace a11y
--- a/accessible/atk/nsMaiHyperlink.cpp +++ b/accessible/atk/nsMaiHyperlink.cpp @@ -141,17 +141,17 @@ void finalizeCB(GObject* aObj) { } } gchar* getUriCB(AtkHyperlink* aLink, gint aLinkIndex) { MaiHyperlink* maiLink = GetMaiHyperlink(aLink); if (!maiLink) return nullptr; nsAutoCString cautoStr; - if (Accessible* hyperlink = maiLink->GetAccHyperlink()) { + if (LocalAccessible* hyperlink = maiLink->GetAccHyperlink()) { nsCOMPtr<nsIURI> uri = hyperlink->AnchorURIAt(aLinkIndex); if (!uri) return nullptr; nsresult rv = uri->GetSpec(cautoStr); NS_ENSURE_SUCCESS(rv, nullptr); return g_strdup(cautoStr.get()); } @@ -164,68 +164,68 @@ gchar* getUriCB(AtkHyperlink* aLink, gin } AtkObject* getObjectCB(AtkHyperlink* aLink, gint aLinkIndex) { MaiHyperlink* maiLink = GetMaiHyperlink(aLink); if (!maiLink) { return nullptr; } - if (Accessible* hyperlink = maiLink->GetAccHyperlink()) { - Accessible* anchor = hyperlink->AnchorAt(aLinkIndex); + if (LocalAccessible* hyperlink = maiLink->GetAccHyperlink()) { + LocalAccessible* anchor = hyperlink->AnchorAt(aLinkIndex); NS_ENSURE_TRUE(anchor, nullptr); return AccessibleWrap::GetAtkObject(anchor); } ProxyAccessible* anchor = maiLink->Proxy()->AnchorAt(aLinkIndex); return anchor ? GetWrapperFor(anchor) : nullptr; } gint getEndIndexCB(AtkHyperlink* aLink) { MaiHyperlink* maiLink = GetMaiHyperlink(aLink); if (!maiLink) return false; - if (Accessible* hyperlink = maiLink->GetAccHyperlink()) { + if (LocalAccessible* hyperlink = maiLink->GetAccHyperlink()) { return static_cast<gint>(hyperlink->EndOffset()); } bool valid = false; uint32_t endIdx = maiLink->Proxy()->EndOffset(&valid); return valid ? static_cast<gint>(endIdx) : -1; } gint getStartIndexCB(AtkHyperlink* aLink) { MaiHyperlink* maiLink = GetMaiHyperlink(aLink); if (!maiLink) return -1; - if (Accessible* hyperlink = maiLink->GetAccHyperlink()) { + if (LocalAccessible* hyperlink = maiLink->GetAccHyperlink()) { return static_cast<gint>(hyperlink->StartOffset()); } bool valid = false; uint32_t startIdx = maiLink->Proxy()->StartOffset(&valid); return valid ? static_cast<gint>(startIdx) : -1; } gboolean isValidCB(AtkHyperlink* aLink) { MaiHyperlink* maiLink = GetMaiHyperlink(aLink); if (!maiLink) return false; - if (Accessible* hyperlink = maiLink->GetAccHyperlink()) { + if (LocalAccessible* hyperlink = maiLink->GetAccHyperlink()) { return static_cast<gboolean>(hyperlink->IsLinkValid()); } return static_cast<gboolean>(maiLink->Proxy()->IsLinkValid()); } gint getAnchorCountCB(AtkHyperlink* aLink) { MaiHyperlink* maiLink = GetMaiHyperlink(aLink); if (!maiLink) return -1; - if (Accessible* hyperlink = maiLink->GetAccHyperlink()) { + if (LocalAccessible* hyperlink = maiLink->GetAccHyperlink()) { return static_cast<gint>(hyperlink->AnchorCount()); } bool valid = false; uint32_t anchorCount = maiLink->Proxy()->AnchorCount(&valid); return valid ? static_cast<gint>(anchorCount) : -1; }
--- a/accessible/atk/nsMaiHyperlink.h +++ b/accessible/atk/nsMaiHyperlink.h @@ -3,17 +3,17 @@ /* 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 __MAI_HYPERLINK_H__ #define __MAI_HYPERLINK_H__ #include "nsMai.h" -#include "Accessible.h" +#include "LocalAccessible.h" struct _AtkHyperlink; typedef struct _AtkHyperlink AtkHyperlink; namespace mozilla { namespace a11y { /* @@ -22,20 +22,20 @@ namespace a11y { class MaiHyperlink { public: explicit MaiHyperlink(AccessibleOrProxy aHyperLink); ~MaiHyperlink(); public: AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; } - Accessible* GetAccHyperlink() { + LocalAccessible* GetAccHyperlink() { if (!mHyperlink.IsAccessible()) return nullptr; - Accessible* link = mHyperlink.AsAccessible(); + LocalAccessible* link = mHyperlink.AsAccessible(); if (!link) { return nullptr; } NS_ASSERTION(link->IsLink(), "Why isn't it a link!"); return link; }
--- a/accessible/atk/nsMaiInterfaceAction.cpp +++ b/accessible/atk/nsMaiInterfaceAction.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "nsMai.h" #include "Role.h" #include "mozilla/Likely.h" #include "ProxyAccessible.h" #include "nsString.h" using namespace mozilla::a11y;
--- a/accessible/atk/nsMaiInterfaceComponent.cpp +++ b/accessible/atk/nsMaiInterfaceComponent.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleWrap.h" #include "nsAccUtils.h" #include "nsCoreUtils.h" #include "nsMai.h" #include "mozilla/Likely.h" #include "mozilla/a11y/DocAccessibleParent.h" #include "mozilla/a11y/ProxyAccessible.h" #include "mozilla/dom/BrowserParent.h" @@ -113,17 +113,17 @@ AtkObject* refAccessibleAtPointHelper(At } MOZ_ASSERT(node); nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(node); aX += winCoords.x; aY += winCoords.y; } AccessibleOrProxy accAtPoint = - acc.ChildAtPoint(aX, aY, Accessible::eDeepestChild); + acc.ChildAtPoint(aX, aY, LocalAccessible::eDeepestChild); if (accAtPoint.IsNull()) { return nullptr; } roles::Role role = accAtPoint.Role(); if (role == roles::TEXT_LEAF || role == roles::STATICTEXT) { // We don't include text leaf nodes in the ATK tree, so return the parent. accAtPoint = accAtPoint.Parent(); MOZ_ASSERT(!accAtPoint.IsNull(), "Text leaf should always have a parent");
--- a/accessible/atk/nsMaiInterfaceDocument.cpp +++ b/accessible/atk/nsMaiInterfaceDocument.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleWrap.h" #include "DocAccessible.h" #include "nsMai.h" #include "ProxyAccessible.h" #include "mozilla/Likely.h" using namespace mozilla::a11y;
--- a/accessible/atk/nsMaiInterfaceEditableText.cpp +++ b/accessible/atk/nsMaiInterfaceEditableText.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "HyperTextAccessible-inl.h" #include "nsMai.h" #include "ProxyAccessible.h" #include "nsString.h" #include "mozilla/Likely.h" using namespace mozilla::a11y;
--- a/accessible/atk/nsMaiInterfaceHypertext.cpp +++ b/accessible/atk/nsMaiInterfaceHypertext.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "HyperTextAccessible.h" #include "nsMai.h" #include "nsMaiHyperlink.h" #include "ProxyAccessible.h" #include "mozilla/Likely.h" using namespace mozilla::a11y; @@ -19,17 +19,17 @@ extern "C" { static AtkHyperlink* getLinkCB(AtkHypertext* aText, gint aLinkIndex) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); AtkObject* atkHyperLink = nullptr; if (accWrap) { HyperTextAccessible* hyperText = accWrap->AsHyperText(); NS_ENSURE_TRUE(hyperText, nullptr); - Accessible* hyperLink = hyperText->LinkAt(aLinkIndex); + LocalAccessible* hyperLink = hyperText->LinkAt(aLinkIndex); if (!hyperLink || !hyperLink->IsLink()) { return nullptr; } atkHyperLink = AccessibleWrap::GetAtkObject(hyperLink); } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) { ProxyAccessible* proxyLink = proxy->LinkAt(aLinkIndex); if (!proxyLink) return nullptr;
--- a/accessible/atk/nsMaiInterfaceSelection.cpp +++ b/accessible/atk/nsMaiInterfaceSelection.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleWrap.h" #include "nsMai.h" #include "ProxyAccessible.h" #include "mozilla/Likely.h" #include <atk/atk.h> using namespace mozilla::a11y; @@ -43,17 +43,17 @@ static gboolean clearSelectionCB(AtkSele return FALSE; } static AtkObject* refSelectionCB(AtkSelection* aSelection, gint i) { AtkObject* atkObj = nullptr; AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); if (accWrap && accWrap->IsSelect()) { - Accessible* selectedItem = accWrap->GetSelectedItem(i); + LocalAccessible* selectedItem = accWrap->GetSelectedItem(i); if (!selectedItem) { return nullptr; } atkObj = AccessibleWrap::GetAtkObject(selectedItem); } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aSelection))) { ProxyAccessible* selectedItem = proxy->GetSelectedItem(i); if (selectedItem) {
--- a/accessible/atk/nsMaiInterfaceTable.cpp +++ b/accessible/atk/nsMaiInterfaceTable.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleWrap.h" #include "nsAccUtils.h" #include "TableAccessible.h" #include "TableCellAccessible.h" #include "nsMai.h" #include "ProxyAccessible.h" #include "nsArrayUtils.h" @@ -23,17 +23,17 @@ extern "C" { static AtkObject* refAtCB(AtkTable* aTable, gint aRowIdx, gint aColIdx) { if (aRowIdx < 0 || aColIdx < 0) { return nullptr; } AtkObject* cellAtkObj = nullptr; AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); if (accWrap) { - Accessible* cell = accWrap->AsTable()->CellAt(aRowIdx, aColIdx); + LocalAccessible* cell = accWrap->AsTable()->CellAt(aRowIdx, aColIdx); if (!cell) { return nullptr; } cellAtkObj = AccessibleWrap::GetAtkObject(cell); } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aTable))) { ProxyAccessible* cell = proxy->TableCellAt(aRowIdx, aColIdx); if (!cell) { @@ -155,17 +155,17 @@ static gint getRowExtentAtCB(AtkTable* a } return -1; } static AtkObject* getCaptionCB(AtkTable* aTable) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); if (accWrap) { - Accessible* caption = accWrap->AsTable()->Caption(); + LocalAccessible* caption = accWrap->AsTable()->Caption(); return caption ? AccessibleWrap::GetAtkObject(caption) : nullptr; } if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aTable))) { ProxyAccessible* caption = proxy->TableCaption(); return caption ? GetWrapperFor(caption) : nullptr; } @@ -184,17 +184,17 @@ static const gchar* getColumnDescription } return AccessibleWrap::ReturnString(autoStr); } static AtkObject* getColumnHeaderCB(AtkTable* aTable, gint aColIdx) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); if (accWrap) { - Accessible* header = + LocalAccessible* header = AccessibleWrap::GetColumnHeader(accWrap->AsTable(), aColIdx); return header ? AccessibleWrap::GetAtkObject(header) : nullptr; } if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aTable))) { ProxyAccessible* header = proxy->AtkTableColumnHeader(aColIdx); return header ? GetWrapperFor(header) : nullptr; } @@ -214,17 +214,17 @@ static const gchar* getRowDescriptionCB( } return AccessibleWrap::ReturnString(autoStr); } static AtkObject* getRowHeaderCB(AtkTable* aTable, gint aRowIdx) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); if (accWrap) { - Accessible* header = + LocalAccessible* header = AccessibleWrap::GetRowHeader(accWrap->AsTable(), aRowIdx); return header ? AccessibleWrap::GetAtkObject(header) : nullptr; } if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aTable))) { ProxyAccessible* header = proxy->AtkTableRowHeader(aRowIdx); return header ? GetWrapperFor(header) : nullptr; }
--- a/accessible/atk/nsMaiInterfaceTableCell.cpp +++ b/accessible/atk/nsMaiInterfaceTableCell.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccessibleWrap.h" #include "nsAccUtils.h" #include "TableAccessible.h" #include "TableCellAccessible.h" #include "nsMai.h" #include "ProxyAccessible.h" #include "nsArrayUtils.h" @@ -98,38 +98,38 @@ static gboolean GetColumnRowSpanCB(AtkTa static AtkObject* GetTableCB(AtkTableCell* aTableCell) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTableCell)); if (accWrap) { TableAccessible* table = accWrap->AsTableCell()->Table(); if (!table) { return nullptr; } - Accessible* tableAcc = table->AsAccessible(); + LocalAccessible* tableAcc = table->AsAccessible(); return tableAcc ? AccessibleWrap::GetAtkObject(tableAcc) : nullptr; } if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aTableCell))) { ProxyAccessible* table = proxy->TableOfACell(); return table ? GetWrapperFor(table) : nullptr; } return nullptr; } static GPtrArray* GetColumnHeaderCellsCB(AtkTableCell* aCell) { if (AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aCell))) { - AutoTArray<Accessible*, 10> headers; + AutoTArray<LocalAccessible*, 10> headers; accWrap->AsTableCell()->ColHeaderCells(&headers); if (headers.IsEmpty()) { return nullptr; } GPtrArray* atkHeaders = g_ptr_array_sized_new(headers.Length()); - for (Accessible* header : headers) { + for (LocalAccessible* header : headers) { AtkObject* atkHeader = AccessibleWrap::GetAtkObject(header); g_object_ref(atkHeader); g_ptr_array_add(atkHeaders, atkHeader); } return atkHeaders; } @@ -150,24 +150,24 @@ static GPtrArray* GetColumnHeaderCellsCB return atkHeaders; } return nullptr; } static GPtrArray* GetRowHeaderCellsCB(AtkTableCell* aCell) { if (AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aCell))) { - AutoTArray<Accessible*, 10> headers; + AutoTArray<LocalAccessible*, 10> headers; accWrap->AsTableCell()->RowHeaderCells(&headers); if (headers.IsEmpty()) { return nullptr; } GPtrArray* atkHeaders = g_ptr_array_sized_new(headers.Length()); - for (Accessible* header : headers) { + for (LocalAccessible* header : headers) { AtkObject* atkHeader = AccessibleWrap::GetAtkObject(header); g_object_ref(atkHeader); g_ptr_array_add(atkHeaders, atkHeader); } return atkHeaders; }
--- a/accessible/atk/nsMaiInterfaceText.cpp +++ b/accessible/atk/nsMaiInterfaceText.cpp @@ -1,17 +1,17 @@ /* -*- 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 "InterfaceInitFuncs.h" #include "mozilla/a11y/PDocAccessible.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "HyperTextAccessible-inl.h" #include "nsMai.h" #include "ProxyAccessible.h" #include "nsIAccessibleTypes.h" #include "nsIPersistentProperties2.h" #include "nsISimpleEnumerator.h" #include "nsUTF8Utils.h"
--- a/accessible/base/ARIAMap.h +++ b/accessible/base/ARIAMap.h @@ -167,17 +167,17 @@ struct nsRoleMapEntry { // Action mapping rule, how to expose accessible action EActionRule actionRule; // 'live' and 'container-live' object attributes mapping rule: how to expose // these object attributes if ARIA 'live' attribute is missed. ELiveAttrRule liveAttRule; - // Accessible types this role belongs to. + // LocalAccessible types this role belongs to. uint32_t accTypes; // Automatic state mapping rule: always include in states uint64_t state; // or kNoReqStates if no default state for this role // ARIA properties supported for this role (in other words, the aria-foo // attribute to accessible states mapping rules). // Currently you cannot have unlimited mappings, because
--- a/accessible/base/AccEvent.cpp +++ b/accessible/base/AccEvent.cpp @@ -29,17 +29,17 @@ static_assert(static_cast<bool>(eNoUserI //////////////////////////////////////////////////////////////////////////////// // AccEvent //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // AccEvent constructors -AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible, +AccEvent::AccEvent(uint32_t aEventType, LocalAccessible* aAccessible, EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) : mEventType(aEventType), mEventRule(aEventRule), mAccessible(aAccessible) { if (aIsFromUserInput == eAutoDetect) { mIsFromUserInput = dom::UserActivation::IsHandlingUserInput(); } else { mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false; } } @@ -75,17 +75,18 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(A // Note: we pass in eAllowDupes to the base class because we don't support text // events coalescence. We fire delayed text change events in DocAccessible but // we continue to base the event off the accessible object rather than just the // node. This means we won't try to create an accessible based on the node when // we are ready to fire the event and so we will no longer assert at that point // if the node was removed from the document. Either way, the AT won't work with // a defunct accessible so the behaviour should be equivalent. -AccTextChangeEvent::AccTextChangeEvent(Accessible* aAccessible, int32_t aStart, +AccTextChangeEvent::AccTextChangeEvent(LocalAccessible* aAccessible, + int32_t aStart, const nsAString& aModifiedText, bool aIsInserted, EIsFromUserInput aIsFromUserInput) : AccEvent( aIsInserted ? static_cast<uint32_t>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) : static_cast<uint32_t>(nsIAccessibleEvent::EVENT_TEXT_REMOVED), aAccessible, aIsFromUserInput, eAllowDupes), @@ -97,28 +98,28 @@ AccTextChangeEvent::AccTextChangeEvent(A mIsFromUserInput = mAccessible->State() & (states::FOCUSED | states::EDITABLE); } //////////////////////////////////////////////////////////////////////////////// // AccHideEvent //////////////////////////////////////////////////////////////////////////////// -AccHideEvent::AccHideEvent(Accessible* aTarget, bool aNeedsShutdown) +AccHideEvent::AccHideEvent(LocalAccessible* aTarget, bool aNeedsShutdown) : AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget), mNeedsShutdown(aNeedsShutdown) { mNextSibling = mAccessible->LocalNextSibling(); mPrevSibling = mAccessible->LocalPrevSibling(); } //////////////////////////////////////////////////////////////////////////////// // AccShowEvent //////////////////////////////////////////////////////////////////////////////// -AccShowEvent::AccShowEvent(Accessible* aTarget) +AccShowEvent::AccShowEvent(LocalAccessible* aTarget) : AccMutationEvent(::nsIAccessibleEvent::EVENT_SHOW, aTarget) { int32_t idx = aTarget->IndexInParent(); MOZ_ASSERT(idx >= 0); mInsertionIndex = idx; } //////////////////////////////////////////////////////////////////////////////// // AccTextSelChangeEvent @@ -144,17 +145,18 @@ void AccTextSelChangeEvent::SelectionRan nsTArray<TextRange>* aRanges) const { TextRange::TextRangesFromSelection(mSel, aRanges); } //////////////////////////////////////////////////////////////////////////////// // AccSelChangeEvent //////////////////////////////////////////////////////////////////////////////// -AccSelChangeEvent::AccSelChangeEvent(Accessible* aWidget, Accessible* aItem, +AccSelChangeEvent::AccSelChangeEvent(LocalAccessible* aWidget, + LocalAccessible* aItem, SelChangeType aSelChangeType) : AccEvent(0, aItem, eAutoDetect, eCoalesceSelectionChange), mWidget(aWidget), mItem(aItem), mSelChangeType(aSelChangeType), mPreceedingCount(0), mPackedEvent(nullptr) { if (aSelChangeType == eSelectionAdd) { @@ -167,49 +169,49 @@ AccSelChangeEvent::AccSelChangeEvent(Acc mEventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE; } } //////////////////////////////////////////////////////////////////////////////// // AccTableChangeEvent //////////////////////////////////////////////////////////////////////////////// -AccTableChangeEvent::AccTableChangeEvent(Accessible* aAccessible, +AccTableChangeEvent::AccTableChangeEvent(LocalAccessible* aAccessible, uint32_t aEventType, int32_t aRowOrColIndex, int32_t aNumRowsOrCols) : AccEvent(aEventType, aAccessible), mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols) {} //////////////////////////////////////////////////////////////////////////////// // AccVCChangeEvent //////////////////////////////////////////////////////////////////////////////// -AccVCChangeEvent::AccVCChangeEvent(Accessible* aAccessible, - Accessible* aOldAccessible, +AccVCChangeEvent::AccVCChangeEvent(LocalAccessible* aAccessible, + LocalAccessible* aOldAccessible, int32_t aOldStart, int32_t aOldEnd, - Accessible* aNewAccessible, + LocalAccessible* aNewAccessible, int32_t aNewStart, int32_t aNewEnd, int16_t aReason, int16_t aBoundaryType, EIsFromUserInput aIsFromUserInput) : AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible, aIsFromUserInput), mOldAccessible(aOldAccessible), mNewAccessible(aNewAccessible), mOldStart(aOldStart), mNewStart(aNewStart), mOldEnd(aOldEnd), mNewEnd(aNewEnd), mReason(aReason), mBoundaryType(aBoundaryType) {} already_AddRefed<nsIAccessibleEvent> a11y::MakeXPCEvent(AccEvent* aEvent) { DocAccessible* doc = aEvent->Document(); - Accessible* acc = aEvent->GetAccessible(); + LocalAccessible* acc = aEvent->GetAccessible(); nsINode* node = acc->GetNode(); bool fromUser = aEvent->IsFromUserInput(); uint32_t type = aEvent->GetEventType(); uint32_t eventGroup = aEvent->GetEventGroups(); nsCOMPtr<nsIAccessibleEvent> xpEvent; if (eventGroup & (1 << AccEvent::eStateChangeEvent)) { AccStateChangeEvent* sc = downcast_accEvent(aEvent);
--- a/accessible/base/AccEvent.h +++ b/accessible/base/AccEvent.h @@ -3,17 +3,17 @@ * 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 _AccEvent_H_ #define _AccEvent_H_ #include "nsIAccessibleEvent.h" -#include "mozilla/a11y/Accessible.h" +#include "mozilla/a11y/LocalAccessible.h" class nsEventShell; namespace mozilla { namespace dom { class Selection; } @@ -67,29 +67,29 @@ class AccEvent { // will be emitted. eRemoveDupes, // eDoNotEmit : This event is confirmed as a duplicate, do not emit it. eDoNotEmit }; // Initialize with an accessible. - AccEvent(uint32_t aEventType, Accessible* aAccessible, + AccEvent(uint32_t aEventType, LocalAccessible* aAccessible, EIsFromUserInput aIsFromUserInput = eAutoDetect, EEventRule aEventRule = eRemoveDupes); // AccEvent uint32_t GetEventType() const { return mEventType; } EEventRule GetEventRule() const { return mEventRule; } bool IsFromUserInput() const { return mIsFromUserInput; } EIsFromUserInput FromUserInput() const { return static_cast<EIsFromUserInput>(mIsFromUserInput); } - Accessible* GetAccessible() const { return mAccessible; } + LocalAccessible* GetAccessible() const { return mAccessible; } DocAccessible* Document() const { return mAccessible->Document(); } /** * Down casting. */ enum EventGroup { eGenericEvent, eStateChangeEvent, @@ -119,37 +119,38 @@ class AccEvent { NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent) protected: virtual ~AccEvent() {} bool mIsFromUserInput; uint32_t mEventType; EEventRule mEventRule; - RefPtr<Accessible> mAccessible; + RefPtr<LocalAccessible> mAccessible; friend class EventQueue; friend class EventTree; friend class ::nsEventShell; friend class NotificationController; }; /** * Accessible state change event. */ class AccStateChangeEvent : public AccEvent { public: - AccStateChangeEvent(Accessible* aAccessible, uint64_t aState, bool aIsEnabled, + AccStateChangeEvent(LocalAccessible* aAccessible, uint64_t aState, + bool aIsEnabled, EIsFromUserInput aIsFromUserInput = eAutoDetect) : AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsFromUserInput, eCoalesceStateChange), mState(aState), mIsEnabled(aIsEnabled) {} - AccStateChangeEvent(Accessible* aAccessible, uint64_t aState) + AccStateChangeEvent(LocalAccessible* aAccessible, uint64_t aState) : AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, eAutoDetect, eCoalesceStateChange), mState(aState) { mIsEnabled = (mAccessible->State() & mState) != 0; } // AccEvent static const EventGroup kEventGroup = eStateChangeEvent; @@ -168,17 +169,17 @@ class AccStateChangeEvent : public AccEv friend class EventQueue; }; /** * Accessible text change event. */ class AccTextChangeEvent : public AccEvent { public: - AccTextChangeEvent(Accessible* aAccessible, int32_t aStart, + AccTextChangeEvent(LocalAccessible* aAccessible, int32_t aStart, const nsAString& aModifiedText, bool aIsInserted, EIsFromUserInput aIsFromUserInput = eAutoDetect); // AccEvent static const EventGroup kEventGroup = eTextChangeEvent; virtual unsigned int GetEventGroups() const override { return AccEvent::GetEventGroups() | (1U << eTextChangeEvent); } @@ -202,17 +203,17 @@ class AccTextChangeEvent : public AccEve }; /** * A base class for events related to tree mutation, either an AccMutation * event, or an AccReorderEvent. */ class AccTreeMutationEvent : public AccEvent { public: - AccTreeMutationEvent(uint32_t aEventType, Accessible* aTarget) + AccTreeMutationEvent(uint32_t aEventType, LocalAccessible* aTarget) : AccEvent(aEventType, aTarget, eAutoDetect, eCoalesceReorder), mGeneration(0) {} // Event static const EventGroup kEventGroup = eTreeMutationEvent; virtual unsigned int GetEventGroups() const override { return AccEvent::GetEventGroups() | (1U << eTreeMutationEvent); } @@ -234,17 +235,17 @@ class AccTreeMutationEvent : public AccE uint32_t mGeneration; }; /** * Base class for show and hide accessible events. */ class AccMutationEvent : public AccTreeMutationEvent { public: - AccMutationEvent(uint32_t aEventType, Accessible* aTarget) + AccMutationEvent(uint32_t aEventType, LocalAccessible* aTarget) : AccTreeMutationEvent(aEventType, aTarget) { // Don't coalesce these since they are coalesced by reorder event. Coalesce // contained text change events. mParent = mAccessible->LocalParent(); } virtual ~AccMutationEvent() {} // Event @@ -252,61 +253,61 @@ class AccMutationEvent : public AccTreeM virtual unsigned int GetEventGroups() const override { return AccTreeMutationEvent::GetEventGroups() | (1U << eMutationEvent); } // MutationEvent bool IsShow() const { return mEventType == nsIAccessibleEvent::EVENT_SHOW; } bool IsHide() const { return mEventType == nsIAccessibleEvent::EVENT_HIDE; } - Accessible* LocalParent() const { return mParent; } + LocalAccessible* LocalParent() const { return mParent; } protected: nsCOMPtr<nsINode> mNode; - RefPtr<Accessible> mParent; + RefPtr<LocalAccessible> mParent; RefPtr<AccTextChangeEvent> mTextChangeEvent; friend class EventTree; friend class NotificationController; }; /** * Accessible hide event. */ class AccHideEvent : public AccMutationEvent { public: - explicit AccHideEvent(Accessible* aTarget, bool aNeedsShutdown = true); + explicit AccHideEvent(LocalAccessible* aTarget, bool aNeedsShutdown = true); // Event static const EventGroup kEventGroup = eHideEvent; virtual unsigned int GetEventGroups() const override { return AccMutationEvent::GetEventGroups() | (1U << eHideEvent); } // AccHideEvent - Accessible* TargetParent() const { return mParent; } - Accessible* TargetNextSibling() const { return mNextSibling; } - Accessible* TargetPrevSibling() const { return mPrevSibling; } + LocalAccessible* TargetParent() const { return mParent; } + LocalAccessible* TargetNextSibling() const { return mNextSibling; } + LocalAccessible* TargetPrevSibling() const { return mPrevSibling; } bool NeedsShutdown() const { return mNeedsShutdown; } protected: bool mNeedsShutdown; - RefPtr<Accessible> mNextSibling; - RefPtr<Accessible> mPrevSibling; + RefPtr<LocalAccessible> mNextSibling; + RefPtr<LocalAccessible> mPrevSibling; friend class EventTree; friend class NotificationController; }; /** * Accessible show event. */ class AccShowEvent : public AccMutationEvent { public: - explicit AccShowEvent(Accessible* aTarget); + explicit AccShowEvent(LocalAccessible* aTarget); // Event static const EventGroup kEventGroup = eShowEvent; virtual unsigned int GetEventGroups() const override { return AccMutationEvent::GetEventGroups() | (1U << eShowEvent); } uint32_t InsertionIndex() const { return mInsertionIndex; } @@ -318,33 +319,33 @@ class AccShowEvent : public AccMutationE friend class EventTree; }; /** * Class for reorder accessible event. Takes care about */ class AccReorderEvent : public AccTreeMutationEvent { public: - explicit AccReorderEvent(Accessible* aTarget) + explicit AccReorderEvent(LocalAccessible* aTarget) : AccTreeMutationEvent(::nsIAccessibleEvent::EVENT_REORDER, aTarget) {} virtual ~AccReorderEvent() {} // Event static const EventGroup kEventGroup = eReorderEvent; virtual unsigned int GetEventGroups() const override { return AccTreeMutationEvent::GetEventGroups() | (1U << eReorderEvent); } }; /** * Accessible caret move event. */ class AccCaretMoveEvent : public AccEvent { public: - AccCaretMoveEvent(Accessible* aAccessible, int32_t aCaretOffset, + AccCaretMoveEvent(LocalAccessible* aAccessible, int32_t aCaretOffset, bool aIsSelectionCollapsed, EIsFromUserInput aIsFromUserInput = eAutoDetect) : AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, aIsFromUserInput), mCaretOffset(aCaretOffset), mIsSelectionCollapsed(aIsSelectionCollapsed) {} virtual ~AccCaretMoveEvent() {} @@ -402,46 +403,46 @@ class AccTextSelChangeEvent : public Acc /** * Accessible widget selection change event. */ class AccSelChangeEvent : public AccEvent { public: enum SelChangeType { eSelectionAdd, eSelectionRemove }; - AccSelChangeEvent(Accessible* aWidget, Accessible* aItem, + AccSelChangeEvent(LocalAccessible* aWidget, LocalAccessible* aItem, SelChangeType aSelChangeType); virtual ~AccSelChangeEvent() {} // AccEvent static const EventGroup kEventGroup = eSelectionChangeEvent; virtual unsigned int GetEventGroups() const override { return AccEvent::GetEventGroups() | (1U << eSelectionChangeEvent); } // AccSelChangeEvent - Accessible* Widget() const { return mWidget; } + LocalAccessible* Widget() const { return mWidget; } private: - RefPtr<Accessible> mWidget; - RefPtr<Accessible> mItem; + RefPtr<LocalAccessible> mWidget; + RefPtr<LocalAccessible> mItem; SelChangeType mSelChangeType; uint32_t mPreceedingCount; AccSelChangeEvent* mPackedEvent; friend class EventQueue; }; /** * Accessible table change event. */ class AccTableChangeEvent : public AccEvent { public: - AccTableChangeEvent(Accessible* aAccessible, uint32_t aEventType, + AccTableChangeEvent(LocalAccessible* aAccessible, uint32_t aEventType, int32_t aRowOrColIndex, int32_t aNumRowsOrCols); // AccEvent static const EventGroup kEventGroup = eTableChangeEvent; virtual unsigned int GetEventGroups() const override { return AccEvent::GetEventGroups() | (1U << eTableChangeEvent); } @@ -455,57 +456,58 @@ class AccTableChangeEvent : public AccEv uint32_t mNumRowsOrCols; // the number of inserted/deleted rows/columns }; /** * Accessible virtual cursor change event. */ class AccVCChangeEvent : public AccEvent { public: - AccVCChangeEvent(Accessible* aAccessible, Accessible* aOldAccessible, - int32_t aOldStart, int32_t aOldEnd, - Accessible* aNewAccessible, int32_t aNewStart, - int32_t aNewEnd, int16_t aReason, int16_t aBoundaryType, + AccVCChangeEvent(LocalAccessible* aAccessible, + LocalAccessible* aOldAccessible, int32_t aOldStart, + int32_t aOldEnd, LocalAccessible* aNewAccessible, + int32_t aNewStart, int32_t aNewEnd, int16_t aReason, + int16_t aBoundaryType, EIsFromUserInput aIsFromUserInput = eFromUserInput); virtual ~AccVCChangeEvent() {} // AccEvent static const EventGroup kEventGroup = eVirtualCursorChangeEvent; virtual unsigned int GetEventGroups() const override { return AccEvent::GetEventGroups() | (1U << eVirtualCursorChangeEvent); } // AccVCChangeEvent - Accessible* OldAccessible() const { return mOldAccessible; } + LocalAccessible* OldAccessible() const { return mOldAccessible; } int32_t OldStartOffset() const { return mOldStart; } int32_t OldEndOffset() const { return mOldEnd; } - Accessible* NewAccessible() const { return mNewAccessible; } + LocalAccessible* NewAccessible() const { return mNewAccessible; } int32_t NewStartOffset() const { return mNewStart; } int32_t NewEndOffset() const { return mNewEnd; } int32_t Reason() const { return mReason; } int32_t BoundaryType() const { return mBoundaryType; } private: - RefPtr<Accessible> mOldAccessible; - RefPtr<Accessible> mNewAccessible; + RefPtr<LocalAccessible> mOldAccessible; + RefPtr<LocalAccessible> mNewAccessible; int32_t mOldStart; int32_t mNewStart; int32_t mOldEnd; int32_t mNewEnd; int16_t mReason; int16_t mBoundaryType; }; /** * Accessible object attribute changed event. */ class AccObjectAttrChangedEvent : public AccEvent { public: - AccObjectAttrChangedEvent(Accessible* aAccessible, nsAtom* aAttribute) + AccObjectAttrChangedEvent(LocalAccessible* aAccessible, nsAtom* aAttribute) : AccEvent(::nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED, aAccessible), mAttribute(aAttribute) {} // AccEvent static const EventGroup kEventGroup = eObjectAttrChangedEvent; virtual unsigned int GetEventGroups() const override { return AccEvent::GetEventGroups() | (1U << eObjectAttrChangedEvent); @@ -520,17 +522,17 @@ class AccObjectAttrChangedEvent : public virtual ~AccObjectAttrChangedEvent() {} }; /** * Accessible scroll event. */ class AccScrollingEvent : public AccEvent { public: - AccScrollingEvent(uint32_t aEventType, Accessible* aAccessible, + AccScrollingEvent(uint32_t aEventType, LocalAccessible* aAccessible, uint32_t aScrollX, uint32_t aScrollY, uint32_t aMaxScrollX, uint32_t aMaxScrollY) : AccEvent(aEventType, aAccessible), mScrollX(aScrollX), mScrollY(aScrollY), mMaxScrollX(aMaxScrollX), mMaxScrollY(aMaxScrollY) {} @@ -558,18 +560,18 @@ class AccScrollingEvent : public AccEven uint32_t mMaxScrollY; }; /** * Accessible announcement event. */ class AccAnnouncementEvent : public AccEvent { public: - AccAnnouncementEvent(Accessible* aAccessible, const nsAString& aAnnouncement, - uint16_t aPriority) + AccAnnouncementEvent(LocalAccessible* aAccessible, + const nsAString& aAnnouncement, uint16_t aPriority) : AccEvent(nsIAccessibleEvent::EVENT_ANNOUNCEMENT, aAccessible), mAnnouncement(aAnnouncement), mPriority(aPriority) {} virtual ~AccAnnouncementEvent() {} // AccEvent static const EventGroup kEventGroup = eAnnouncementEvent;
--- a/accessible/base/AccGroupInfo.cpp +++ b/accessible/base/AccGroupInfo.cpp @@ -6,42 +6,42 @@ #include "nsAccUtils.h" #include "TableAccessible.h" #include "Role.h" #include "States.h" using namespace mozilla::a11y; -AccGroupInfo::AccGroupInfo(const Accessible* aItem, role aRole) +AccGroupInfo::AccGroupInfo(const LocalAccessible* aItem, role aRole) : mPosInSet(0), mSetSize(0), mParent(nullptr), mItem(aItem), mRole(aRole) { MOZ_COUNT_CTOR(AccGroupInfo); Update(); } void AccGroupInfo::Update() { mParent = nullptr; - Accessible* parent = mItem->LocalParent(); + LocalAccessible* parent = mItem->LocalParent(); if (!parent) return; int32_t indexInParent = mItem->IndexInParent(); uint32_t siblingCount = parent->ChildCount(); if (indexInParent == -1 || indexInParent >= static_cast<int32_t>(siblingCount)) { NS_ERROR("Wrong index in parent! Tree invalidation problem."); return; } int32_t level = nsAccUtils::GetARIAOrDefaultLevel(mItem); // Compute position in set. mPosInSet = 1; for (int32_t idx = indexInParent - 1; idx >= 0; idx--) { - Accessible* sibling = parent->LocalChildAt(idx); + LocalAccessible* sibling = parent->LocalChildAt(idx); roles::Role siblingRole = sibling->Role(); // If the sibling is separator then the group is ended. if (siblingRole == roles::SEPARATOR) break; if (BaseRole(siblingRole) != mRole) { continue; } @@ -77,17 +77,17 @@ void AccGroupInfo::Update() { mPosInSet++; } // Compute set size. mSetSize = mPosInSet; for (uint32_t idx = indexInParent + 1; idx < siblingCount; idx++) { - Accessible* sibling = parent->LocalChildAt(idx); + LocalAccessible* sibling = parent->LocalChildAt(idx); roles::Role siblingRole = sibling->Role(); // If the sibling is separator then the group is ended. if (siblingRole == roles::SEPARATOR) break; if (BaseRole(siblingRole) != mRole) { continue; @@ -126,37 +126,37 @@ void AccGroupInfo::Update() { // ARIA tree and list can be arranged by using ARIA groups to organize levels. if (parentRole != roles::GROUPING) return; // Way #1 for ARIA tree (not ARIA treegrid): previous sibling of a group is a // parent. In other words the parent of the tree item will be a group and // the previous tree item of the group is a conceptual parent of the tree // item. if (mRole == roles::OUTLINEITEM) { - Accessible* parentPrevSibling = parent->LocalPrevSibling(); + LocalAccessible* parentPrevSibling = parent->LocalPrevSibling(); if (parentPrevSibling && parentPrevSibling->Role() == mRole) { mParent = parentPrevSibling; return; } } // Way #2 for ARIA list and tree: group is a child of an item. In other words // the parent of the item will be a group and containing item of the group is // a conceptual parent of the item. if (mRole == roles::LISTITEM || mRole == roles::OUTLINEITEM) { - Accessible* grandParent = parent->LocalParent(); + LocalAccessible* grandParent = parent->LocalParent(); if (grandParent && grandParent->Role() == mRole) mParent = grandParent; } } -Accessible* AccGroupInfo::FirstItemOf(const Accessible* aContainer) { +LocalAccessible* AccGroupInfo::FirstItemOf(const LocalAccessible* aContainer) { // ARIA tree can be arranged by ARIA groups case #1 (previous sibling of a // group is a parent) or by aria-level. a11y::role containerRole = aContainer->Role(); - Accessible* item = aContainer->LocalNextSibling(); + LocalAccessible* item = aContainer->LocalNextSibling(); if (item) { if (containerRole == roles::OUTLINEITEM && item->Role() == roles::GROUPING) { item = item->LocalFirstChild(); } if (item) { AccGroupInfo* itemGroupInfo = item->GetGroupInfo(); @@ -185,34 +185,34 @@ Accessible* AccGroupInfo::FirstItemOf(co // Otherwise, it can be a direct child if the container is a list or tree. item = aContainer->LocalFirstChild(); if (ShouldReportRelations(item->Role(), containerRole)) return item; return nullptr; } -uint32_t AccGroupInfo::TotalItemCount(Accessible* aContainer, +uint32_t AccGroupInfo::TotalItemCount(LocalAccessible* aContainer, bool* aIsHierarchical) { uint32_t itemCount = 0; switch (aContainer->Role()) { case roles::TABLE: if (nsCoreUtils::GetUIntAttr(aContainer->GetContent(), nsGkAtoms::aria_rowcount, (int32_t*)&itemCount)) { break; } if (TableAccessible* tableAcc = aContainer->AsTable()) { return tableAcc->RowCount(); } break; case roles::ROW: - if (Accessible* table = nsAccUtils::TableFor(aContainer)) { + if (LocalAccessible* table = nsAccUtils::TableFor(aContainer)) { if (nsCoreUtils::GetUIntAttr(table->GetContent(), nsGkAtoms::aria_colcount, (int32_t*)&itemCount)) { break; } if (TableAccessible* tableAcc = table->AsTable()) { return tableAcc->ColCount(); @@ -228,17 +228,17 @@ uint32_t AccGroupInfo::TotalItemCount(Ac case roles::GROUPING: case roles::TREE_TABLE: case roles::COMBOBOX_LIST: case roles::LISTBOX: case roles::DEFINITION_LIST: case roles::EDITCOMBOBOX: case roles::RADIO_GROUP: case roles::PAGETABLIST: { - Accessible* childItem = AccGroupInfo::FirstItemOf(aContainer); + LocalAccessible* childItem = AccGroupInfo::FirstItemOf(aContainer); if (!childItem) { childItem = aContainer->LocalFirstChild(); if (childItem && childItem->IsTextLeaf()) { // First child can be a text leaf, check its sibling for an item. childItem = childItem->LocalNextSibling(); } } @@ -253,27 +253,27 @@ uint32_t AccGroupInfo::TotalItemCount(Ac } default: break; } return itemCount; } -Accessible* AccGroupInfo::NextItemTo(Accessible* aItem) { +LocalAccessible* AccGroupInfo::NextItemTo(LocalAccessible* aItem) { AccGroupInfo* groupInfo = aItem->GetGroupInfo(); if (!groupInfo) return nullptr; // If the item in middle of the group then search next item in siblings. if (groupInfo->PosInSet() >= groupInfo->SetSize()) return nullptr; - Accessible* parent = aItem->LocalParent(); + LocalAccessible* parent = aItem->LocalParent(); uint32_t childCount = parent->ChildCount(); for (uint32_t idx = aItem->IndexInParent() + 1; idx < childCount; idx++) { - Accessible* nextItem = parent->LocalChildAt(idx); + LocalAccessible* nextItem = parent->LocalChildAt(idx); AccGroupInfo* nextGroupInfo = nextItem->GetGroupInfo(); if (nextGroupInfo && nextGroupInfo->ConceptualParent() == groupInfo->ConceptualParent()) { return nextItem; } } MOZ_ASSERT_UNREACHABLE(
--- a/accessible/base/AccGroupInfo.h +++ b/accessible/base/AccGroupInfo.h @@ -1,16 +1,16 @@ /* 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 AccGroupInfo_h_ #define AccGroupInfo_h_ -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" namespace mozilla { namespace a11y { /** * Calculate and store group information. */ class AccGroupInfo { @@ -26,27 +26,27 @@ class AccGroupInfo { * Return a number of items in the group. */ uint32_t SetSize() const { return mSetSize; } /** * Return a direct or logical parent of the accessible that this group info is * created for. */ - Accessible* ConceptualParent() const { return mParent; } + LocalAccessible* ConceptualParent() const { return mParent; } /** * Update group information. */ void Update(); /** * Create group info. */ - static AccGroupInfo* CreateGroupInfo(const Accessible* aAccessible) { + static AccGroupInfo* CreateGroupInfo(const LocalAccessible* aAccessible) { mozilla::a11y::role role = aAccessible->Role(); if (role != mozilla::a11y::roles::ROW && role != mozilla::a11y::roles::OUTLINEITEM && role != mozilla::a11y::roles::OPTION && role != mozilla::a11y::roles::LISTITEM && role != mozilla::a11y::roles::MENUITEM && role != mozilla::a11y::roles::COMBOBOX_OPTION && role != mozilla::a11y::roles::RICH_OPTION && @@ -62,31 +62,32 @@ class AccGroupInfo { AccGroupInfo* info = new AccGroupInfo(aAccessible, BaseRole(role)); return info; } /** * Return a first item for the given container. */ - static Accessible* FirstItemOf(const Accessible* aContainer); + static LocalAccessible* FirstItemOf(const LocalAccessible* aContainer); /** * Return total number of items in container, and if it is has nested * collections. */ - static uint32_t TotalItemCount(Accessible* aContainer, bool* aIsHierarchical); + static uint32_t TotalItemCount(LocalAccessible* aContainer, + bool* aIsHierarchical); /** * Return next item of the same group to the given item. */ - static Accessible* NextItemTo(Accessible* aItem); + static LocalAccessible* NextItemTo(LocalAccessible* aItem); protected: - AccGroupInfo(const Accessible* aItem, a11y::role aRole); + AccGroupInfo(const LocalAccessible* aItem, a11y::role aRole); private: AccGroupInfo() = delete; AccGroupInfo(const AccGroupInfo&) = delete; AccGroupInfo& operator=(const AccGroupInfo&) = delete; static mozilla::a11y::role BaseRole(mozilla::a11y::role aRole) { if (aRole == mozilla::a11y::roles::CHECK_MENU_ITEM || @@ -105,17 +106,17 @@ class AccGroupInfo { /** * Return true if the given parent and child roles should have their node * relations reported. */ static bool ShouldReportRelations(a11y::role aRole, a11y::role aParentRole); uint32_t mPosInSet; uint32_t mSetSize; - Accessible* mParent; - const Accessible* mItem; + LocalAccessible* mParent; + const LocalAccessible* mItem; a11y::role mRole; }; } // namespace a11y } // namespace mozilla #endif
--- a/accessible/base/AccIterator.cpp +++ b/accessible/base/AccIterator.cpp @@ -14,33 +14,33 @@ using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // AccIterator //////////////////////////////////////////////////////////////////////////////// -AccIterator::AccIterator(const Accessible* aAccessible, +AccIterator::AccIterator(const LocalAccessible* aAccessible, filters::FilterFuncPtr aFilterFunc) : mFilterFunc(aFilterFunc) { mState = new IteratorState(aAccessible); } AccIterator::~AccIterator() { while (mState) { IteratorState* tmp = mState; mState = tmp->mParentState; delete tmp; } } -Accessible* AccIterator::Next() { +LocalAccessible* AccIterator::Next() { while (mState) { - Accessible* child = mState->mParent->LocalChildAt(mState->mIndex++); + LocalAccessible* child = mState->mParent->LocalChildAt(mState->mIndex++); if (!child) { IteratorState* tmp = mState; mState = mState->mParentState; delete tmp; continue; } @@ -54,17 +54,17 @@ Accessible* AccIterator::Next() { } return nullptr; } //////////////////////////////////////////////////////////////////////////////// // nsAccIterator::IteratorState -AccIterator::IteratorState::IteratorState(const Accessible* aParent, +AccIterator::IteratorState::IteratorState(const LocalAccessible* aParent, IteratorState* mParentState) : mParent(aParent), mIndex(0), mParentState(mParentState) {} //////////////////////////////////////////////////////////////////////////////// // RelatedAccIterator //////////////////////////////////////////////////////////////////////////////// RelatedAccIterator::RelatedAccIterator(DocAccessible* aDocument, @@ -74,25 +74,25 @@ RelatedAccIterator::RelatedAccIterator(D nsAutoString id; if (aDependentContent->IsElement() && aDependentContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id)) { mProviders = mDocument->GetRelProviders(aDependentContent->AsElement(), id); } } -Accessible* RelatedAccIterator::Next() { +LocalAccessible* RelatedAccIterator::Next() { if (!mProviders) return nullptr; while (mIndex < mProviders->Length()) { const auto& provider = (*mProviders)[mIndex++]; // Return related accessible for the given attribute. if (provider->mRelAttr == mRelAttr) { - Accessible* related = mDocument->GetAccessible(provider->mContent); + LocalAccessible* related = mDocument->GetAccessible(provider->mContent); if (related) { return related; } // If the document content is pointed by relation then return the // document itself. if (provider->mContent == mDocument->GetContent()) { return mDocument; @@ -103,45 +103,45 @@ Accessible* RelatedAccIterator::Next() { return nullptr; } //////////////////////////////////////////////////////////////////////////////// // HTMLLabelIterator //////////////////////////////////////////////////////////////////////////////// HTMLLabelIterator::HTMLLabelIterator(DocAccessible* aDocument, - const Accessible* aAccessible, + const LocalAccessible* aAccessible, LabelFilter aFilter) : mRelIter(aDocument, aAccessible->GetContent(), nsGkAtoms::_for), mAcc(aAccessible), mLabelFilter(aFilter) {} -bool HTMLLabelIterator::IsLabel(Accessible* aLabel) { +bool HTMLLabelIterator::IsLabel(LocalAccessible* aLabel) { dom::HTMLLabelElement* labelEl = dom::HTMLLabelElement::FromNode(aLabel->GetContent()); return labelEl && labelEl->GetControl() == mAcc->GetContent(); } -Accessible* HTMLLabelIterator::Next() { +LocalAccessible* HTMLLabelIterator::Next() { // Get either <label for="[id]"> element which explicitly points to given // element, or <label> ancestor which implicitly point to it. - Accessible* label = nullptr; + LocalAccessible* label = nullptr; while ((label = mRelIter.Next())) { if (IsLabel(label)) { return label; } } // Ignore ancestor label on not widget accessible. if (mLabelFilter == eSkipAncestorLabel || !mAcc->IsWidget()) return nullptr; // Go up tree to get a name of ancestor label if there is one (an ancestor // <label> implicitly points to us). Don't go up farther than form or // document. - Accessible* walkUp = mAcc->LocalParent(); + LocalAccessible* walkUp = mAcc->LocalParent(); while (walkUp && !walkUp->IsDoc()) { nsIContent* walkUpEl = walkUp->GetContent(); if (IsLabel(walkUp) && !walkUpEl->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) { mLabelFilter = eSkipAncestorLabel; // prevent infinite loop return walkUp; } @@ -156,52 +156,52 @@ Accessible* HTMLLabelIterator::Next() { //////////////////////////////////////////////////////////////////////////////// // HTMLOutputIterator //////////////////////////////////////////////////////////////////////////////// HTMLOutputIterator::HTMLOutputIterator(DocAccessible* aDocument, nsIContent* aElement) : mRelIter(aDocument, aElement, nsGkAtoms::_for) {} -Accessible* HTMLOutputIterator::Next() { - Accessible* output = nullptr; +LocalAccessible* HTMLOutputIterator::Next() { + LocalAccessible* output = nullptr; while ((output = mRelIter.Next())) { if (output->GetContent()->IsHTMLElement(nsGkAtoms::output)) return output; } return nullptr; } //////////////////////////////////////////////////////////////////////////////// // XULLabelIterator //////////////////////////////////////////////////////////////////////////////// XULLabelIterator::XULLabelIterator(DocAccessible* aDocument, nsIContent* aElement) : mRelIter(aDocument, aElement, nsGkAtoms::control) {} -Accessible* XULLabelIterator::Next() { - Accessible* label = nullptr; +LocalAccessible* XULLabelIterator::Next() { + LocalAccessible* label = nullptr; while ((label = mRelIter.Next())) { if (label->GetContent()->IsXULElement(nsGkAtoms::label)) return label; } return nullptr; } //////////////////////////////////////////////////////////////////////////////// // XULDescriptionIterator //////////////////////////////////////////////////////////////////////////////// XULDescriptionIterator::XULDescriptionIterator(DocAccessible* aDocument, nsIContent* aElement) : mRelIter(aDocument, aElement, nsGkAtoms::control) {} -Accessible* XULDescriptionIterator::Next() { - Accessible* descr = nullptr; +LocalAccessible* XULDescriptionIterator::Next() { + LocalAccessible* descr = nullptr; while ((descr = mRelIter.Next())) { if (descr->GetContent()->IsXULElement(nsGkAtoms::description)) return descr; } return nullptr; } //////////////////////////////////////////////////////////////////////////////// @@ -259,45 +259,45 @@ dom::Element* IDRefsIterator::GetElem(ns } return nullptr; } dom::Element* IDRefsIterator::GetElem(const nsDependentSubstring& aID) { return GetElem(mContent, aID); } -Accessible* IDRefsIterator::Next() { +LocalAccessible* IDRefsIterator::Next() { nsIContent* nextEl = nullptr; while ((nextEl = NextElem())) { - Accessible* acc = mDoc->GetAccessible(nextEl); + LocalAccessible* acc = mDoc->GetAccessible(nextEl); if (acc) { return acc; } } return nullptr; } //////////////////////////////////////////////////////////////////////////////// // SingleAccIterator //////////////////////////////////////////////////////////////////////////////// -Accessible* SingleAccIterator::Next() { - RefPtr<Accessible> nextAcc; +LocalAccessible* SingleAccIterator::Next() { + RefPtr<LocalAccessible> nextAcc; mAcc.swap(nextAcc); if (!nextAcc || nextAcc->IsDefunct()) { return nullptr; } return nextAcc; } //////////////////////////////////////////////////////////////////////////////// // ItemIterator //////////////////////////////////////////////////////////////////////////////// -Accessible* ItemIterator::Next() { +LocalAccessible* ItemIterator::Next() { if (mContainer) { mAnchor = AccGroupInfo::FirstItemOf(mContainer); mContainer = nullptr; return mAnchor; } return mAnchor ? (mAnchor = AccGroupInfo::NextItemTo(mAnchor)) : nullptr; } @@ -313,17 +313,17 @@ XULTreeItemIterator::XULTreeItemIterator mTreeView(aTreeView), mRowCount(-1), mContainerLevel(-1), mCurrRowIdx(aRowIdx + 1) { mTreeView->GetRowCount(&mRowCount); if (aRowIdx != -1) mTreeView->GetLevel(aRowIdx, &mContainerLevel); } -Accessible* XULTreeItemIterator::Next() { +LocalAccessible* XULTreeItemIterator::Next() { while (mCurrRowIdx < mRowCount) { int32_t level = 0; mTreeView->GetLevel(mCurrRowIdx, &level); if (level == mContainerLevel + 1) { return mXULTree->GetTreeItemAccessible(mCurrRowIdx++); }
--- a/accessible/base/AccIterator.h +++ b/accessible/base/AccIterator.h @@ -18,48 +18,48 @@ namespace mozilla { namespace a11y { /** * AccIterable is a basic interface for iterators over accessibles. */ class AccIterable { public: virtual ~AccIterable() {} - virtual Accessible* Next() = 0; + virtual LocalAccessible* Next() = 0; private: friend class Relation; std::unique_ptr<AccIterable> mNextIter; }; /** * Allows to iterate through accessible children or subtree complying with * filter function. */ class AccIterator : public AccIterable { public: - AccIterator(const Accessible* aRoot, filters::FilterFuncPtr aFilterFunc); + AccIterator(const LocalAccessible* aRoot, filters::FilterFuncPtr aFilterFunc); virtual ~AccIterator(); /** * Return next accessible complying with filter function. Return the first * accessible for the first time. */ - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: AccIterator(); AccIterator(const AccIterator&); AccIterator& operator=(const AccIterator&); struct IteratorState { - explicit IteratorState(const Accessible* aParent, + explicit IteratorState(const LocalAccessible* aParent, IteratorState* mParentState = nullptr); - const Accessible* mParent; + const LocalAccessible* mParent; int32_t mIndex; IteratorState* mParentState; }; filters::FilterFuncPtr mFilterFunc; IteratorState* mState; }; @@ -82,17 +82,17 @@ class RelatedAccIterator : public AccIte RelatedAccIterator(DocAccessible* aDocument, nsIContent* aDependentContent, nsAtom* aRelAttr); virtual ~RelatedAccIterator() {} /** * Return next related accessible for the given dependent accessible. */ - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: RelatedAccIterator(); RelatedAccIterator(const RelatedAccIterator&); RelatedAccIterator& operator=(const RelatedAccIterator&); DocAccessible* mDocument; nsAtom* mRelAttr; @@ -102,52 +102,53 @@ class RelatedAccIterator : public AccIte /** * Used to iterate through HTML labels associated with the given accessible. */ class HTMLLabelIterator : public AccIterable { public: enum LabelFilter { eAllLabels, eSkipAncestorLabel }; - HTMLLabelIterator(DocAccessible* aDocument, const Accessible* aAccessible, + HTMLLabelIterator(DocAccessible* aDocument, + const LocalAccessible* aAccessible, LabelFilter aFilter = eAllLabels); virtual ~HTMLLabelIterator() {} /** * Return next label accessible associated with the given element. */ - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: HTMLLabelIterator(); HTMLLabelIterator(const HTMLLabelIterator&); HTMLLabelIterator& operator=(const HTMLLabelIterator&); - bool IsLabel(Accessible* aLabel); + bool IsLabel(LocalAccessible* aLabel); RelatedAccIterator mRelIter; // XXX: replace it on weak reference (bug 678429), it's safe to use raw // pointer now because iterators life cycle is short. - const Accessible* mAcc; + const LocalAccessible* mAcc; LabelFilter mLabelFilter; }; /** * Used to iterate through HTML outputs associated with the given element. */ class HTMLOutputIterator : public AccIterable { public: HTMLOutputIterator(DocAccessible* aDocument, nsIContent* aElement); virtual ~HTMLOutputIterator() {} /** * Return next output accessible associated with the given element. */ - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: HTMLOutputIterator(); HTMLOutputIterator(const HTMLOutputIterator&); HTMLOutputIterator& operator=(const HTMLOutputIterator&); RelatedAccIterator mRelIter; }; @@ -158,17 +159,17 @@ class HTMLOutputIterator : public AccIte class XULLabelIterator : public AccIterable { public: XULLabelIterator(DocAccessible* aDocument, nsIContent* aElement); virtual ~XULLabelIterator() {} /** * Return next label accessible associated with the given element. */ - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: XULLabelIterator(); XULLabelIterator(const XULLabelIterator&); XULLabelIterator& operator=(const XULLabelIterator&); RelatedAccIterator mRelIter; }; @@ -179,17 +180,17 @@ class XULLabelIterator : public AccItera class XULDescriptionIterator : public AccIterable { public: XULDescriptionIterator(DocAccessible* aDocument, nsIContent* aElement); virtual ~XULDescriptionIterator() {} /** * Return next description accessible associated with the given element. */ - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: XULDescriptionIterator(); XULDescriptionIterator(const XULDescriptionIterator&); XULDescriptionIterator& operator=(const XULDescriptionIterator&); RelatedAccIterator mRelIter; }; @@ -217,17 +218,17 @@ class IDRefsIterator : public AccIterabl /** * Return the element with the given ID. */ static dom::Element* GetElem(nsIContent* aContent, const nsAString& aID); dom::Element* GetElem(const nsDependentSubstring& aID); // AccIterable - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: IDRefsIterator(); IDRefsIterator(const IDRefsIterator&); IDRefsIterator operator=(const IDRefsIterator&); nsString mIDs; nsIContent* mContent; @@ -236,59 +237,59 @@ class IDRefsIterator : public AccIterabl }; /** * Iterator that points to a single accessible returning it on the first call * to Next(). */ class SingleAccIterator : public AccIterable { public: - explicit SingleAccIterator(Accessible* aTarget) : mAcc(aTarget) {} + explicit SingleAccIterator(LocalAccessible* aTarget) : mAcc(aTarget) {} virtual ~SingleAccIterator() {} - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: SingleAccIterator(); SingleAccIterator(const SingleAccIterator&); SingleAccIterator& operator=(const SingleAccIterator&); - RefPtr<Accessible> mAcc; + RefPtr<LocalAccessible> mAcc; }; /** * Used to iterate items of the given item container. */ class ItemIterator : public AccIterable { public: - explicit ItemIterator(const Accessible* aItemContainer) + explicit ItemIterator(const LocalAccessible* aItemContainer) : mContainer(aItemContainer), mAnchor(nullptr) {} virtual ~ItemIterator() {} - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: ItemIterator() = delete; ItemIterator(const ItemIterator&) = delete; ItemIterator& operator=(const ItemIterator&) = delete; - const Accessible* mContainer; - Accessible* mAnchor; + const LocalAccessible* mContainer; + LocalAccessible* mAnchor; }; /** * Used to iterate through XUL tree items of the same level. */ class XULTreeItemIterator : public AccIterable { public: XULTreeItemIterator(const XULTreeAccessible* aXULTree, nsITreeView* aTreeView, int32_t aRowIdx); virtual ~XULTreeItemIterator() {} - virtual Accessible* Next() override; + virtual LocalAccessible* Next() override; private: XULTreeItemIterator() = delete; XULTreeItemIterator(const XULTreeItemIterator&) = delete; XULTreeItemIterator& operator=(const XULTreeItemIterator&) = delete; const XULTreeAccessible* mXULTree; nsITreeView* mTreeView;
--- a/accessible/base/AccessibleOrProxy.cpp +++ b/accessible/base/AccessibleOrProxy.cpp @@ -47,39 +47,39 @@ AccessibleOrProxy AccessibleOrProxy::Par return parent; } // Otherwise this should be the proxy for the tab's top level document. return proxy->OuterDocOfRemoteBrowser(); } AccessibleOrProxy AccessibleOrProxy::ChildAtPoint( - int32_t aX, int32_t aY, Accessible::EWhichChildAtPoint aWhichChild) { + int32_t aX, int32_t aY, LocalAccessible::EWhichChildAtPoint aWhichChild) { if (IsProxy()) { return AsProxy()->ChildAtPoint(aX, aY, aWhichChild); } ProxyAccessible* childDoc = RemoteChildDoc(); if (childDoc) { // This is an OuterDocAccessible. nsIntRect docRect = AsAccessible()->Bounds(); if (!docRect.Contains(aX, aY)) { return nullptr; } - if (aWhichChild == Accessible::eDirectChild) { + if (aWhichChild == LocalAccessible::eDirectChild) { return childDoc; } return childDoc->ChildAtPoint(aX, aY, aWhichChild); } AccessibleOrProxy target = AsAccessible()->ChildAtPoint(aX, aY, aWhichChild); - if (target.IsNull() || aWhichChild == Accessible::eDirectChild) { + if (target.IsNull() || aWhichChild == LocalAccessible::eDirectChild) { return target; } childDoc = target.RemoteChildDoc(); if (childDoc) { - // Accessible::ChildAtPoint stopped at an OuterDocAccessible, since it + // LocalAccessible::ChildAtPoint stopped at an OuterDocAccessible, since it // can't traverse into ProxyAccessibles. Continue the search from childDoc. return childDoc->ChildAtPoint(aX, aY, aWhichChild); } return target; } ProxyAccessible* AccessibleOrProxy::RemoteChildDoc() const { MOZ_ASSERT(!IsNull());
--- a/accessible/base/AccessibleOrProxy.h +++ b/accessible/base/AccessibleOrProxy.h @@ -2,51 +2,51 @@ /* 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_AccessibleOrProxy_h #define mozilla_a11y_AccessibleOrProxy_h -#include "mozilla/a11y/Accessible.h" +#include "mozilla/a11y/LocalAccessible.h" #include "mozilla/a11y/ProxyAccessible.h" #include "mozilla/a11y/Role.h" #include <stdint.h> namespace mozilla { namespace a11y { /** - * This class stores an Accessible* or a ProxyAccessible* in a safe manner + * This class stores a LocalAccessible* or a ProxyAccessible* in a safe manner * with size sizeof(void*). */ class AccessibleOrProxy { public: - MOZ_IMPLICIT AccessibleOrProxy(Accessible* aAcc) + MOZ_IMPLICIT AccessibleOrProxy(LocalAccessible* aAcc) : mBits(reinterpret_cast<uintptr_t>(aAcc)) {} MOZ_IMPLICIT AccessibleOrProxy(ProxyAccessible* aProxy) : mBits(aProxy ? (reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY) : 0) {} MOZ_IMPLICIT AccessibleOrProxy(decltype(nullptr)) : mBits(0) {} MOZ_IMPLICIT AccessibleOrProxy() : mBits(0) {} bool IsProxy() const { return mBits & IS_PROXY; } ProxyAccessible* AsProxy() const { if (IsProxy()) { return reinterpret_cast<ProxyAccessible*>(mBits & ~IS_PROXY); } return nullptr; } bool IsAccessible() const { return !IsProxy(); } - Accessible* AsAccessible() const { + LocalAccessible* AsAccessible() const { if (IsAccessible()) { - return reinterpret_cast<Accessible*>(mBits); + return reinterpret_cast<LocalAccessible*>(mBits); } return nullptr; } bool IsNull() const { return mBits == 0; } uint32_t ChildCount() const { @@ -144,18 +144,18 @@ class AccessibleOrProxy { return AsAccessible()->Role(); } int32_t IndexInParent() const; AccessibleOrProxy Parent() const; - AccessibleOrProxy ChildAtPoint(int32_t aX, int32_t aY, - Accessible::EWhichChildAtPoint aWhichChild); + AccessibleOrProxy ChildAtPoint( + int32_t aX, int32_t aY, LocalAccessible::EWhichChildAtPoint aWhichChild); bool operator!=(const AccessibleOrProxy& aOther) const { return mBits != aOther.mBits; } bool operator==(const AccessibleOrProxy& aOther) const { return mBits == aOther.mBits; }
--- a/accessible/base/DocManager.cpp +++ b/accessible/base/DocManager.cpp @@ -70,24 +70,24 @@ DocAccessible* DocManager::GetDocAccessi DocAccessible* doc = aPresShell->GetDocAccessible(); if (doc) { return doc; } return GetDocAccessible(aPresShell->GetDocument()); } -Accessible* DocManager::FindAccessibleInCache(nsINode* aNode) const { +LocalAccessible* DocManager::FindAccessibleInCache(nsINode* aNode) const { for (auto iter = mDocAccessibleCache.ConstIter(); !iter.Done(); iter.Next()) { DocAccessible* docAccessible = iter.UserData(); NS_ASSERTION(docAccessible, "No doc accessible for the object in doc accessible cache!"); if (docAccessible) { - Accessible* accessible = docAccessible->GetAccessible(aNode); + LocalAccessible* accessible = docAccessible->GetAccessible(aNode); if (accessible) { return accessible; } } } return nullptr; }
--- a/accessible/base/DocManager.h +++ b/accessible/base/DocManager.h @@ -17,17 +17,17 @@ namespace mozilla::dom { class Document; } namespace mozilla { class PresShell; namespace a11y { -class Accessible; +class LocalAccessible; class DocAccessible; class xpcAccessibleDocument; class DocAccessibleParent; /** * Manage the document accessible life cycle. */ class DocManager : public nsIWebProgressListener, @@ -47,17 +47,17 @@ class DocManager : public nsIWebProgress * Return document accessible for the given presshell. */ DocAccessible* GetDocAccessible(const PresShell* aPresShell); /** * Search through all document accessibles for an accessible with the given * unique id. */ - Accessible* FindAccessibleInCache(nsINode* aNode) const; + LocalAccessible* FindAccessibleInCache(nsINode* aNode) const; /** * Called by document accessible when it gets shutdown. * @param aAllowServiceShutdown true to shut down nsAccessibilityService * if it is no longer required, false to prevent it. */ void NotifyOfDocumentShutdown(DocAccessible* aDocument, dom::Document* aDOMDocument,
--- a/accessible/base/EmbeddedObjCollector.cpp +++ b/accessible/base/EmbeddedObjCollector.cpp @@ -1,64 +1,64 @@ /* 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 "EmbeddedObjCollector.h" -#include "Accessible.h" +#include "LocalAccessible.h" using namespace mozilla::a11y; uint32_t EmbeddedObjCollector::Count() { EnsureNGetIndex(nullptr); return mObjects.Length(); } -Accessible* EmbeddedObjCollector::GetAccessibleAt(uint32_t aIndex) { - Accessible* accessible = mObjects.SafeElementAt(aIndex, nullptr); +LocalAccessible* EmbeddedObjCollector::GetAccessibleAt(uint32_t aIndex) { + LocalAccessible* accessible = mObjects.SafeElementAt(aIndex, nullptr); if (accessible) return accessible; return EnsureNGetObject(aIndex); } -Accessible* EmbeddedObjCollector::EnsureNGetObject(uint32_t aIndex) { +LocalAccessible* EmbeddedObjCollector::EnsureNGetObject(uint32_t aIndex) { uint32_t childCount = mRoot->ChildCount(); while (mRootChildIdx < childCount) { - Accessible* child = mRoot->LocalChildAt(mRootChildIdx++); + LocalAccessible* child = mRoot->LocalChildAt(mRootChildIdx++); if (child->IsText()) continue; AppendObject(child); if (mObjects.Length() - 1 == aIndex) return mObjects[aIndex]; } return nullptr; } -int32_t EmbeddedObjCollector::EnsureNGetIndex(Accessible* aAccessible) { +int32_t EmbeddedObjCollector::EnsureNGetIndex(LocalAccessible* aAccessible) { uint32_t childCount = mRoot->ChildCount(); while (mRootChildIdx < childCount) { - Accessible* child = mRoot->LocalChildAt(mRootChildIdx++); + LocalAccessible* child = mRoot->LocalChildAt(mRootChildIdx++); if (child->IsText()) continue; AppendObject(child); if (child == aAccessible) return mObjects.Length() - 1; } return -1; } -int32_t EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible) { +int32_t EmbeddedObjCollector::GetIndexAt(LocalAccessible* aAccessible) { if (aAccessible->mParent != mRoot) return -1; MOZ_ASSERT(!aAccessible->IsProxy()); if (aAccessible->mInt.mIndexOfEmbeddedChild != -1) { return aAccessible->mInt.mIndexOfEmbeddedChild; } return !aAccessible->IsText() ? EnsureNGetIndex(aAccessible) : -1; } -void EmbeddedObjCollector::AppendObject(Accessible* aAccessible) { +void EmbeddedObjCollector::AppendObject(LocalAccessible* aAccessible) { MOZ_ASSERT(!aAccessible->IsProxy()); aAccessible->mInt.mIndexOfEmbeddedChild = mObjects.Length(); mObjects.AppendElement(aAccessible); }
--- a/accessible/base/EmbeddedObjCollector.h +++ b/accessible/base/EmbeddedObjCollector.h @@ -5,64 +5,64 @@ #ifndef mozilla_a11y_EmbeddedObjCollector_h__ #define mozilla_a11y_EmbeddedObjCollector_h__ #include "nsTArray.h" namespace mozilla { namespace a11y { -class Accessible; +class LocalAccessible; /** * Collect embedded objects. Provide quick access to accessible by index and * vice versa. */ class EmbeddedObjCollector final { public: ~EmbeddedObjCollector() {} /** * Return index of the given accessible within the collection. */ - int32_t GetIndexAt(Accessible* aAccessible); + int32_t GetIndexAt(LocalAccessible* aAccessible); /** * Return accessible count within the collection. */ uint32_t Count(); /** * Return an accessible from the collection at the given index. */ - Accessible* GetAccessibleAt(uint32_t aIndex); + LocalAccessible* GetAccessibleAt(uint32_t aIndex); protected: /** * Ensure accessible at the given index is stored and return it. */ - Accessible* EnsureNGetObject(uint32_t aIndex); + LocalAccessible* EnsureNGetObject(uint32_t aIndex); /** * Ensure index for the given accessible is stored and return it. */ - int32_t EnsureNGetIndex(Accessible* aAccessible); + int32_t EnsureNGetIndex(LocalAccessible* aAccessible); - // Make sure it's used by Accessible class only. - explicit EmbeddedObjCollector(Accessible* aRoot) + // Make sure it's used by LocalAccessible class only. + explicit EmbeddedObjCollector(LocalAccessible* aRoot) : mRoot(aRoot), mRootChildIdx(0) {} /** * Append the object to collection. */ - void AppendObject(Accessible* aAccessible); + void AppendObject(LocalAccessible* aAccessible); - friend class Accessible; + friend class LocalAccessible; - Accessible* mRoot; + LocalAccessible* mRoot; uint32_t mRootChildIdx; - nsTArray<Accessible*> mObjects; + nsTArray<LocalAccessible*> mObjects; }; } // namespace a11y } // namespace mozilla #endif
--- a/accessible/base/EventQueue.cpp +++ b/accessible/base/EventQueue.cpp @@ -1,16 +1,16 @@ /* -*- 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 "EventQueue.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "nsEventShell.h" #include "DocAccessible.h" #include "DocAccessibleChild.h" #include "nsAccessibilityService.h" #include "nsTextEquivUtils.h" #ifdef A11Y_LOG # include "Logging.h" #endif @@ -43,32 +43,32 @@ bool EventQueue::PushEvent(AccEvent* aEv (aEvent->mEventType == nsIAccessibleEvent::EVENT_NAME_CHANGE || aEvent->mEventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED || aEvent->mEventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED)) { PushNameOrDescriptionChange(aEvent->mAccessible); } return true; } -bool EventQueue::PushNameOrDescriptionChange(Accessible* aTarget) { - // Fire name/description change event on parent or related Accessible being - // labelled/described given that this event hasn't been coalesced, the +bool EventQueue::PushNameOrDescriptionChange(LocalAccessible* aTarget) { + // Fire name/description change event on parent or related LocalAccessible + // being labelled/described given that this event hasn't been coalesced, the // dependent's name/description was calculated from this subtree, and the // subtree was changed. const bool doName = aTarget->HasNameDependent(); const bool doDesc = aTarget->HasDescriptionDependent(); if (!doName && !doDesc) { return false; } bool pushed = false; bool nameCheckAncestor = true; // Only continue traversing up the tree if it's possible that the parent - // Accessible's name (or an Accessible being labelled by this Accessible or - // an ancestor) can depend on this Accessible's name. - Accessible* parent = aTarget->LocalParent(); + // LocalAccessible's name (or a LocalAccessible being labelled by this + // LocalAccessible or an ancestor) can depend on this LocalAccessible's name. + LocalAccessible* parent = aTarget->LocalParent(); while (parent && nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) { // Test possible name dependent parent. if (doName) { if (nameCheckAncestor && nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeRule)) { nsAutoString name; ENameValueFlag nameFlag = parent->Name(name); @@ -77,26 +77,26 @@ bool EventQueue::PushNameOrDescriptionCh RefPtr<AccEvent> nameChangeEvent = new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent); pushed |= PushEvent(nameChangeEvent); } nameCheckAncestor = false; } Relation rel = parent->RelationByType(RelationType::LABEL_FOR); - while (Accessible* relTarget = rel.Next()) { + while (LocalAccessible* relTarget = rel.Next()) { RefPtr<AccEvent> nameChangeEvent = new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, relTarget); pushed |= PushEvent(nameChangeEvent); } } if (doDesc) { Relation rel = parent->RelationByType(RelationType::DESCRIPTION_FOR); - while (Accessible* relTarget = rel.Next()) { + while (LocalAccessible* relTarget = rel.Next()) { RefPtr<AccEvent> descChangeEvent = new AccEvent( nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE, relTarget); pushed |= PushEvent(descChangeEvent); } } parent = parent->LocalParent(); } @@ -108,17 +108,17 @@ bool EventQueue::PushNameOrDescriptionCh void EventQueue::CoalesceEvents() { NS_ASSERTION(mEvents.Length(), "There should be at least one pending event!"); uint32_t tail = mEvents.Length() - 1; AccEvent* tailEvent = mEvents[tail]; switch (tailEvent->mEventRule) { case AccEvent::eCoalesceReorder: { - DebugOnly<Accessible*> target = tailEvent->mAccessible.get(); + DebugOnly<LocalAccessible*> target = tailEvent->mAccessible.get(); MOZ_ASSERT( target->IsApplication() || target->IsOuterDoc() || target->IsXULTree(), "Only app or outerdoc accessible reorder events are in the queue"); MOZ_ASSERT(tailEvent->GetEventType() == nsIAccessibleEvent::EVENT_REORDER, "only reorder events should be queued"); break; // case eCoalesceReorder } @@ -309,17 +309,17 @@ void EventQueue::ProcessEventQueue() { logging::Address("document", mDocument); logging::MsgEnd(); } #endif for (uint32_t idx = 0; idx < eventCount; idx++) { AccEvent* event = events[idx]; if (event->mEventRule != AccEvent::eDoNotEmit) { - Accessible* target = event->GetAccessible(); + LocalAccessible* target = event->GetAccessible(); if (!target || target->IsDefunct()) continue; // Dispatch the focus event if target is still focused. if (event->mEventType == nsIAccessibleEvent::EVENT_FOCUS) { FocusMgr()->ProcessFocusEvent(event); continue; }
--- a/accessible/base/EventQueue.h +++ b/accessible/base/EventQueue.h @@ -23,17 +23,17 @@ class EventQueue { /** * Put an accessible event into the queue to process it later. */ bool PushEvent(AccEvent* aEvent); /** * Puts name and/or description change events into the queue, if needed. */ - bool PushNameOrDescriptionChange(Accessible* aTarget); + bool PushNameOrDescriptionChange(LocalAccessible* aTarget); /** * Process events from the queue and fires events. */ void ProcessEventQueue(); private: EventQueue(const EventQueue&) = delete;
--- a/accessible/base/EventTree.cpp +++ b/accessible/base/EventTree.cpp @@ -1,16 +1,16 @@ /* -*- 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 "EventTree.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "EmbeddedObjCollector.h" #include "NotificationController.h" #include "nsEventShell.h" #include "DocAccessible.h" #ifdef A11Y_LOG # include "Logging.h" #endif @@ -19,17 +19,17 @@ using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // TreeMutation class EventTree* const TreeMutation::kNoEventTree = reinterpret_cast<EventTree*>(-1); -TreeMutation::TreeMutation(Accessible* aParent, bool aNoEvents) +TreeMutation::TreeMutation(LocalAccessible* aParent, bool aNoEvents) : mParent(aParent), mStartIdx(UINT32_MAX), mStateFlagsCopy(mParent->mStateFlags), mQueueEvents(!aNoEvents) { #ifdef DEBUG mIsDone = false; #endif @@ -42,41 +42,41 @@ TreeMutation::TreeMutation(Accessible* a if (logging::IsEnabled(logging::eVerbose)) { logging::Tree("EVENTS_TREE", "Container tree", mParent->Document(), PrefixLog, static_cast<void*>(this)); } } #endif - mParent->mStateFlags |= Accessible::eKidsMutating; + mParent->mStateFlags |= LocalAccessible::eKidsMutating; } TreeMutation::~TreeMutation() { MOZ_ASSERT(mIsDone, "Done() must be called explicitly"); } -void TreeMutation::AfterInsertion(Accessible* aChild) { +void TreeMutation::AfterInsertion(LocalAccessible* aChild) { MOZ_ASSERT(aChild->LocalParent() == mParent); if (static_cast<uint32_t>(aChild->mIndexInParent) < mStartIdx) { mStartIdx = aChild->mIndexInParent + 1; } if (!mQueueEvents) { return; } RefPtr<AccShowEvent> ev = new AccShowEvent(aChild); DebugOnly<bool> added = Controller()->QueueMutationEvent(ev); MOZ_ASSERT(added); aChild->SetShowEventTarget(true); } -void TreeMutation::BeforeRemoval(Accessible* aChild, bool aNoShutdown) { +void TreeMutation::BeforeRemoval(LocalAccessible* aChild, bool aNoShutdown) { MOZ_ASSERT(aChild->LocalParent() == mParent); if (static_cast<uint32_t>(aChild->mIndexInParent) < mStartIdx) { mStartIdx = aChild->mIndexInParent; } if (!mQueueEvents) { return; @@ -84,77 +84,77 @@ void TreeMutation::BeforeRemoval(Accessi RefPtr<AccHideEvent> ev = new AccHideEvent(aChild, !aNoShutdown); if (Controller()->QueueMutationEvent(ev)) { aChild->SetHideEventTarget(true); } } void TreeMutation::Done() { - MOZ_ASSERT(mParent->mStateFlags & Accessible::eKidsMutating); - mParent->mStateFlags &= ~Accessible::eKidsMutating; + MOZ_ASSERT(mParent->mStateFlags & LocalAccessible::eKidsMutating); + mParent->mStateFlags &= ~LocalAccessible::eKidsMutating; uint32_t length = mParent->mChildren.Length(); #ifdef DEBUG for (uint32_t idx = 0; idx < mStartIdx && idx < length; idx++) { MOZ_ASSERT( mParent->mChildren[idx]->mIndexInParent == static_cast<int32_t>(idx), "Wrong index detected"); } #endif for (uint32_t idx = mStartIdx; idx < length; idx++) { mParent->mChildren[idx]->mInt.mIndexOfEmbeddedChild = -1; } for (uint32_t idx = 0; idx < length; idx++) { - mParent->mChildren[idx]->mStateFlags |= Accessible::eGroupInfoDirty; + mParent->mChildren[idx]->mStateFlags |= LocalAccessible::eGroupInfoDirty; } mParent->mEmbeddedObjCollector = nullptr; - mParent->mStateFlags |= mStateFlagsCopy & Accessible::eKidsMutating; + mParent->mStateFlags |= mStateFlagsCopy & LocalAccessible::eKidsMutating; #ifdef DEBUG mIsDone = true; #endif #ifdef A11Y_LOG if (mQueueEvents && logging::IsEnabled(logging::eEventTree)) { logging::MsgBegin("EVENTS_TREE", "reordering tree after"); logging::AccessibleInfo("reordering for", mParent); Controller()->RootEventTree().Log(); logging::MsgEnd(); } #endif } #ifdef A11Y_LOG -const char* TreeMutation::PrefixLog(void* aData, Accessible* aAcc) { +const char* TreeMutation::PrefixLog(void* aData, LocalAccessible* aAcc) { TreeMutation* thisObj = reinterpret_cast<TreeMutation*>(aData); if (thisObj->mParent == aAcc) { return "_X_"; } const EventTree& ret = thisObj->Controller()->RootEventTree(); if (ret.Find(aAcc)) { return "_с_"; } return ""; } #endif //////////////////////////////////////////////////////////////////////////////// // EventTree -void EventTree::Shown(Accessible* aChild) { +void EventTree::Shown(LocalAccessible* aChild) { RefPtr<AccShowEvent> ev = new AccShowEvent(aChild); Controller(aChild)->WithdrawPrecedingEvents(&ev->mPrecedingEvents); Mutated(ev); } -void EventTree::Hidden(Accessible* aChild, bool aNeedsShutdown) { +void EventTree::Hidden(LocalAccessible* aChild, bool aNeedsShutdown) { RefPtr<AccHideEvent> ev = new AccHideEvent(aChild, aNeedsShutdown); if (!aNeedsShutdown) { Controller(aChild)->StorePrecedingEvent(ev); } Mutated(ev); } void EventTree::Process(const RefPtr<DocAccessible>& aDeathGrip) { @@ -233,17 +233,17 @@ void EventTree::Process(const RefPtr<Doc if (mFireReorder) { nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_REORDER, mContainer); mContainer->Document()->MaybeNotifyOfValueChange(mContainer); } mDependentEvents.Clear(); } -EventTree* EventTree::FindOrInsert(Accessible* aContainer) { +EventTree* EventTree::FindOrInsert(LocalAccessible* aContainer) { if (!mFirst) { mFirst.reset(new EventTree(aContainer, mDependentEvents.IsEmpty())); return mFirst.get(); } EventTree* prevNode = nullptr; EventTree* node = mFirst.get(); do { @@ -253,18 +253,18 @@ EventTree* EventTree::FindOrInsert(Acces "An event target has to be alive"); // Case of same target. if (node->mContainer == aContainer) { return node; } // Check if the given container is contained by a current node - Accessible* top = mContainer ? mContainer : aContainer->Document(); - Accessible* parent = aContainer; + LocalAccessible* top = mContainer ? mContainer : aContainer->Document(); + LocalAccessible* parent = aContainer; while (parent) { // Reached a top, no match for a current event. if (parent == top) { break; } // We got a match. if (parent->LocalParent() == node->mContainer) { @@ -299,17 +299,17 @@ EventTree* EventTree::FindOrInsert(Acces MOZ_ASSERT(parent, "Wrong tree"); } // If the given container contains a current node // then // if show or hide of the given node contains a grand parent of the // current node then ignore the current node and its show and hide events // otherwise ignore the current node, but not its show and hide events - Accessible* curParent = node->mContainer; + LocalAccessible* curParent = node->mContainer; while (curParent && !curParent->IsDoc()) { if (curParent->LocalParent() != aContainer) { curParent = curParent->LocalParent(); continue; } // Insert the tail node into the hierarchy between the current node and // its parent. @@ -323,17 +323,17 @@ EventTree* EventTree::FindOrInsert(Acces // Check if a next node is contained by the given node too, and move them // under the given node if so. prevNode = nodeOwnerRef.get(); node = nodeOwnerRef->mNext.get(); UniquePtr<EventTree>* nodeRef = &nodeOwnerRef->mNext; EventTree* insNode = nodeOwnerRef->mFirst.get(); while (node) { - Accessible* curParent = node->mContainer; + LocalAccessible* curParent = node->mContainer; while (curParent && !curParent->IsDoc()) { if (curParent->LocalParent() != aContainer) { curParent = curParent->LocalParent(); continue; } MOZ_ASSERT(!insNode->mNext); @@ -380,17 +380,17 @@ void EventTree::Clear() { AccHideEvent* ev = downcast_accEvent(mDependentEvents[jdx]); if (ev && ev->NeedsShutdown()) { ev->Document()->ShutdownChildrenInSubtree(ev->mAccessible); } } mDependentEvents.Clear(); } -const EventTree* EventTree::Find(const Accessible* aContainer) const { +const EventTree* EventTree::Find(const LocalAccessible* aContainer) const { const EventTree* et = this; while (et) { if (et->mContainer == aContainer) { return et; } if (et->mFirst) { et = et->mFirst.get(); @@ -458,17 +458,17 @@ void EventTree::Log(uint32_t aLevel) con } #endif void EventTree::Mutated(AccMutationEvent* aEv) { // If shown or hidden node is a root of previously mutated subtree, then // discard those subtree mutations as we are no longer interested in them. UniquePtr<EventTree>* node = &mFirst; while (*node) { - Accessible* cntr = (*node)->mContainer; + LocalAccessible* cntr = (*node)->mContainer; while (cntr != mContainer) { if (cntr == aEv->mAccessible) { #ifdef A11Y_LOG if (logging::IsEnabled(logging::eEventTree)) { logging::MsgBegin("EVENTS_TREE", "Trim subtree"); logging::AccessibleInfo("Show/hide container", aEv->mAccessible); logging::AccessibleInfo("Trimmed subtree root", (*node)->mContainer); logging::MsgEnd();
--- a/accessible/base/EventTree.h +++ b/accessible/base/EventTree.h @@ -2,17 +2,17 @@ /* 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_EventTree_h_ #define mozilla_a11y_EventTree_h_ #include "AccEvent.h" -#include "Accessible.h" +#include "LocalAccessible.h" #include "mozilla/a11y/DocAccessible.h" #include "mozilla/RefPtr.h" #include "mozilla/UniquePtr.h" namespace mozilla { namespace a11y { @@ -24,35 +24,35 @@ class NotificationController; * have an object of this class on the stack when calling methods that mutate * the accessible tree. */ class TreeMutation final { public: static const bool kNoEvents = true; static const bool kNoShutdown = true; - explicit TreeMutation(Accessible* aParent, bool aNoEvents = false); + explicit TreeMutation(LocalAccessible* aParent, bool aNoEvents = false); ~TreeMutation(); - void AfterInsertion(Accessible* aChild); - void BeforeRemoval(Accessible* aChild, bool aNoShutdown = false); + void AfterInsertion(LocalAccessible* aChild); + void BeforeRemoval(LocalAccessible* aChild, bool aNoShutdown = false); void Done(); private: NotificationController* Controller() const { return mParent->Document()->Controller(); } static EventTree* const kNoEventTree; #ifdef A11Y_LOG - static const char* PrefixLog(void* aData, Accessible*); + static const char* PrefixLog(void* aData, LocalAccessible*); #endif - Accessible* mParent; + LocalAccessible* mParent; uint32_t mStartIdx; uint32_t mStateFlagsCopy; /* * True if mutation events should be queued. */ bool mQueueEvents; @@ -66,30 +66,30 @@ class TreeMutation final { */ class EventTree final { public: EventTree() : mFirst(nullptr), mNext(nullptr), mContainer(nullptr), mFireReorder(false) {} - explicit EventTree(Accessible* aContainer, bool aFireReorder) + explicit EventTree(LocalAccessible* aContainer, bool aFireReorder) : mFirst(nullptr), mNext(nullptr), mContainer(aContainer), mFireReorder(aFireReorder) {} ~EventTree() { Clear(); } - void Shown(Accessible* aTarget); - void Hidden(Accessible*, bool); + void Shown(LocalAccessible* aTarget); + void Hidden(LocalAccessible*, bool); /** * Return an event tree node for the given accessible. */ - const EventTree* Find(const Accessible* aContainer) const; + const EventTree* Find(const LocalAccessible* aContainer) const; /** * Add a mutation event to this event tree. */ void Mutated(AccMutationEvent* aEv); #ifdef A11Y_LOG void Log(uint32_t aLevel = UINT32_MAX) const; @@ -99,28 +99,28 @@ class EventTree final { /** * Processes the event queue and fires events. */ void Process(const RefPtr<DocAccessible>& aDeathGrip); /** * Return an event subtree for the given accessible. */ - EventTree* FindOrInsert(Accessible* aContainer); + EventTree* FindOrInsert(LocalAccessible* aContainer); void Clear(); UniquePtr<EventTree> mFirst; UniquePtr<EventTree> mNext; - Accessible* mContainer; + LocalAccessible* mContainer; nsTArray<RefPtr<AccMutationEvent>> mDependentEvents; bool mFireReorder; - static NotificationController* Controller(Accessible* aAcc) { + static NotificationController* Controller(LocalAccessible* aAcc) { return aAcc->Document()->Controller(); } friend class NotificationController; }; } // namespace a11y } // namespace mozilla
--- a/accessible/base/Filters.cpp +++ b/accessible/base/Filters.cpp @@ -1,45 +1,45 @@ /* 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 "Filters.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "nsAccUtils.h" #include "Role.h" #include "States.h" using namespace mozilla::a11y; using namespace mozilla::a11y::filters; -uint32_t filters::GetSelected(Accessible* aAccessible) { +uint32_t filters::GetSelected(LocalAccessible* aAccessible) { if (aAccessible->State() & states::SELECTED) return eMatch | eSkipSubtree; return eSkip; } -uint32_t filters::GetSelectable(Accessible* aAccessible) { +uint32_t filters::GetSelectable(LocalAccessible* aAccessible) { if (aAccessible->InteractiveState() & states::SELECTABLE) { return eMatch | eSkipSubtree; } return eSkip; } -uint32_t filters::GetRow(Accessible* aAccessible) { +uint32_t filters::GetRow(LocalAccessible* aAccessible) { if (aAccessible->IsTableRow()) return eMatch | eSkipSubtree; // Look for rows inside rowgroup or wrapping text containers. a11y::role role = aAccessible->Role(); const nsRoleMapEntry* roleMapEntry = aAccessible->ARIARoleMap(); if (role == roles::GROUPING || (aAccessible->IsGenericHyperText() && !roleMapEntry)) { return eSkip; } return eSkipSubtree; } -uint32_t filters::GetCell(Accessible* aAccessible) { +uint32_t filters::GetCell(LocalAccessible* aAccessible) { return aAccessible->IsTableCell() ? eMatch : eSkipSubtree; }
--- a/accessible/base/Filters.h +++ b/accessible/base/Filters.h @@ -8,39 +8,39 @@ #include <stdint.h> /** * Predefined filters used for nsAccIterator and nsAccCollector. */ namespace mozilla { namespace a11y { -class Accessible; +class LocalAccessible; namespace filters { enum EResult { eSkip = 0, eMatch = 1, eSkipSubtree = 2 }; /** * Return true if the traversed accessible complies with filter. */ -typedef uint32_t (*FilterFuncPtr)(Accessible*); +typedef uint32_t (*FilterFuncPtr)(LocalAccessible*); /** * Matches selected/selectable accessibles in subtree. */ -uint32_t GetSelected(Accessible* aAccessible); -uint32_t GetSelectable(Accessible* aAccessible); +uint32_t GetSelected(LocalAccessible* aAccessible); +uint32_t GetSelectable(LocalAccessible* aAccessible); /** * Matches row accessibles in subtree. */ -uint32_t GetRow(Accessible* aAccessible); +uint32_t GetRow(LocalAccessible* aAccessible); /** * Matches cell accessibles in children. */ -uint32_t GetCell(Accessible* aAccessible); +uint32_t GetCell(LocalAccessible* aAccessible); } // namespace filters } // namespace a11y } // namespace mozilla #endif
--- a/accessible/base/FocusManager.cpp +++ b/accessible/base/FocusManager.cpp @@ -1,15 +1,15 @@ /* 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 "FocusManager.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccIterator.h" #include "DocAccessible-inl.h" #include "nsAccessibilityService.h" #include "nsAccUtils.h" #include "nsEventShell.h" #include "Role.h" #include "nsFocusManager.h" @@ -22,31 +22,31 @@ namespace mozilla { namespace a11y { FocusManager::FocusManager() {} FocusManager::~FocusManager() {} -Accessible* FocusManager::FocusedAccessible() const { +LocalAccessible* FocusManager::FocusedAccessible() const { if (mActiveItem) return mActiveItem; nsINode* focusedNode = FocusedDOMNode(); if (focusedNode) { DocAccessible* doc = GetAccService()->GetDocAccessible(focusedNode->OwnerDoc()); return doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr; } return nullptr; } -bool FocusManager::IsFocused(const Accessible* aAccessible) const { +bool FocusManager::IsFocused(const LocalAccessible* aAccessible) const { if (mActiveItem) return mActiveItem == aAccessible; nsINode* focusedNode = FocusedDOMNode(); if (focusedNode) { // XXX: Before getting an accessible for node having a DOM focus make sure // they belong to the same document because it can trigger unwanted document // accessible creation for temporary about:blank document. Without this // peculiarity we would end up with plain implementation based on @@ -58,36 +58,36 @@ bool FocusManager::IsFocused(const Acces return aAccessible == (doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr); } } return false; } -bool FocusManager::IsFocusWithin(const Accessible* aContainer) const { - Accessible* child = FocusedAccessible(); +bool FocusManager::IsFocusWithin(const LocalAccessible* aContainer) const { + LocalAccessible* child = FocusedAccessible(); while (child) { if (child == aContainer) return true; child = child->LocalParent(); } return false; } FocusManager::FocusDisposition FocusManager::IsInOrContainsFocus( - const Accessible* aAccessible) const { - Accessible* focus = FocusedAccessible(); + const LocalAccessible* aAccessible) const { + LocalAccessible* focus = FocusedAccessible(); if (!focus) return eNone; // If focused. if (focus == aAccessible) return eFocused; // If contains the focus. - Accessible* child = focus->LocalParent(); + LocalAccessible* child = focus->LocalParent(); while (child) { if (child == aAccessible) return eContainsFocus; child = child->LocalParent(); } // If contained by focus. child = aAccessible->LocalParent(); @@ -95,17 +95,17 @@ FocusManager::FocusDisposition FocusMana if (child == focus) return eContainedByFocus; child = child->LocalParent(); } return eNone; } -bool FocusManager::WasLastFocused(const Accessible* aAccessible) const { +bool FocusManager::WasLastFocused(const LocalAccessible* aAccessible) const { return mLastFocus == aAccessible; } void FocusManager::NotifyOfDOMFocus(nsISupports* aTarget) { #ifdef A11Y_LOG if (logging::IsEnabled(logging::eFocus)) { logging::FocusNotificationTarget("DOM focus", "Target", aTarget); } @@ -151,30 +151,31 @@ void FocusManager::NotifyOfDOMBlur(nsISu } document->HandleNotification<FocusManager, nsINode>( this, &FocusManager::ProcessDOMFocus, DOMDoc); } } } -void FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive) { +void FocusManager::ActiveItemChanged(LocalAccessible* aItem, + bool aCheckIfActive) { #ifdef A11Y_LOG if (logging::IsEnabled(logging::eFocus)) { logging::FocusNotificationTarget("active item changed", "Item", aItem); } #endif // Nothing changed, happens for XUL trees and HTML selects. if (aItem && aItem == mActiveItem) return; mActiveItem = nullptr; if (aItem && aCheckIfActive) { - Accessible* widget = aItem->ContainerWidget(); + LocalAccessible* widget = aItem->ContainerWidget(); #ifdef A11Y_LOG if (logging::IsEnabled(logging::eFocus)) logging::ActiveWidget(widget); #endif if (!widget || !widget->IsActiveWidget() || !widget->AreItemsOperable()) { return; } } mActiveItem = aItem; @@ -190,17 +191,17 @@ void FocusManager::ActiveItemChanged(Acc Unused << dap->SendRestoreFocus(); } } } // If active item is changed then fire accessible focus event on it, otherwise // if there's no an active item then fire focus event to accessible having // DOM focus. - Accessible* target = FocusedAccessible(); + LocalAccessible* target = FocusedAccessible(); if (target) { DispatchFocusEvent(target->Document(), target); } } void FocusManager::ForceFocusEvent() { nsINode* focusedNode = FocusedDOMNode(); if (focusedNode) { @@ -209,17 +210,17 @@ void FocusManager::ForceFocusEvent() { if (document) { document->HandleNotification<FocusManager, nsINode>( this, &FocusManager::ProcessDOMFocus, focusedNode); } } } void FocusManager::DispatchFocusEvent(DocAccessible* aDocument, - Accessible* aTarget) { + LocalAccessible* aTarget) { MOZ_ASSERT(aDocument, "No document for focused accessible!"); if (aDocument) { RefPtr<AccEvent> event = new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget, eAutoDetect, AccEvent::eCoalesceOfSameType); aDocument->FireDelayedEvent(event); mLastFocus = aTarget; @@ -235,70 +236,70 @@ void FocusManager::ProcessDOMFocus(nsINo logging::FocusNotificationTarget("process DOM focus", "Target", aTarget); } #endif DocAccessible* document = GetAccService()->GetDocAccessible(aTarget->OwnerDoc()); if (!document) return; - Accessible* target = + LocalAccessible* target = document->GetAccessibleEvenIfNotInMapOrContainer(aTarget); if (target) { // Check if still focused. Otherwise we can end up with storing the active // item for control that isn't focused anymore. nsINode* focusedNode = FocusedDOMNode(); if (!focusedNode) return; - Accessible* DOMFocus = + LocalAccessible* DOMFocus = document->GetAccessibleEvenIfNotInMapOrContainer(focusedNode); if (target != DOMFocus) return; - Accessible* activeItem = target->CurrentItem(); + LocalAccessible* activeItem = target->CurrentItem(); if (activeItem) { mActiveItem = activeItem; target = activeItem; } DispatchFocusEvent(document, target); } } void FocusManager::ProcessFocusEvent(AccEvent* aEvent) { MOZ_ASSERT(aEvent->GetEventType() == nsIAccessibleEvent::EVENT_FOCUS, "Focus event is expected!"); // Emit focus event if event target is the active item. Otherwise then check // if it's still focused and then update active item and emit focus event. - Accessible* target = aEvent->GetAccessible(); + LocalAccessible* target = aEvent->GetAccessible(); MOZ_ASSERT(!target->IsDefunct()); if (target != mActiveItem) { // Check if still focused. Otherwise we can end up with storing the active // item for control that isn't focused anymore. DocAccessible* document = aEvent->Document(); nsINode* focusedNode = FocusedDOMNode(); if (!focusedNode) return; - Accessible* DOMFocus = + LocalAccessible* DOMFocus = document->GetAccessibleEvenIfNotInMapOrContainer(focusedNode); if (target != DOMFocus) return; - Accessible* activeItem = target->CurrentItem(); + LocalAccessible* activeItem = target->CurrentItem(); if (activeItem) { mActiveItem = activeItem; target = activeItem; MOZ_ASSERT(!target->IsDefunct()); } } // Fire menu start/end events for ARIA menus. if (target->IsARIARole(nsGkAtoms::menuitem)) { // The focus was moved into menu. - Accessible* ARIAMenubar = nullptr; - for (Accessible* parent = target->LocalParent(); parent; + LocalAccessible* ARIAMenubar = nullptr; + for (LocalAccessible* parent = target->LocalParent(); parent; parent = parent->LocalParent()) { if (parent->IsARIARole(nsGkAtoms::menubar)) { ARIAMenubar = parent; break; } // Go up in the parent chain of the menu hierarchy. if (!parent->IsARIARole(nsGkAtoms::menuitem) && @@ -356,17 +357,17 @@ void FocusManager::ProcessFocusEvent(Acc return; } // Fire scrolling_start event when the document receives the focus if it has // an anchor jump. If an accessible within the document receive the focus // then null out the anchor jump because it no longer applies. DocAccessible* targetDocument = target->Document(); MOZ_ASSERT(targetDocument); - Accessible* anchorJump = targetDocument->AnchorJump(); + LocalAccessible* anchorJump = targetDocument->AnchorJump(); if (anchorJump) { if (target == targetDocument) { // XXX: bug 625699, note in some cases the node could go away before we // we receive focus event, for example if the node is removed from DOM. nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SCROLLING_START, anchorJump, aEvent->FromUserInput()); } targetDocument->SetAnchorJump(nullptr);
--- a/accessible/base/FocusManager.h +++ b/accessible/base/FocusManager.h @@ -13,41 +13,41 @@ class nsISupports; namespace mozilla { namespace dom { class Document; } namespace a11y { class AccEvent; -class Accessible; +class LocalAccessible; class DocAccessible; /** * Manage the accessible focus. Used to fire and process accessible events. */ class FocusManager { public: virtual ~FocusManager(); /** * Return a focused accessible. */ - Accessible* FocusedAccessible() const; + LocalAccessible* FocusedAccessible() const; /** * Return true if given accessible is focused. */ - bool IsFocused(const Accessible* aAccessible) const; + bool IsFocused(const LocalAccessible* aAccessible) const; /** * Return true if the given accessible is an active item, i.e. an item that * is current within the active widget. */ - inline bool IsActiveItem(const Accessible* aAccessible) { + inline bool IsActiveItem(const LocalAccessible* aAccessible) { return aAccessible == mActiveItem; } /** * Return DOM node having DOM focus. */ nsINode* FocusedDOMNode() const; @@ -56,36 +56,37 @@ class FocusManager { */ inline bool HasDOMFocus(const nsINode* aNode) const { return aNode == FocusedDOMNode(); } /** * Return true if focused accessible is within the given container. */ - bool IsFocusWithin(const Accessible* aContainer) const; + bool IsFocusWithin(const LocalAccessible* aContainer) const; /** * Return whether the given accessible is focused or contains the focus or * contained by focused accessible. */ enum FocusDisposition { eNone, eFocused, eContainsFocus, eContainedByFocus }; - FocusDisposition IsInOrContainsFocus(const Accessible* aAccessible) const; + FocusDisposition IsInOrContainsFocus( + const LocalAccessible* aAccessible) const; /** * Return true if the given accessible was the last accessible focused. * This is useful to detect the case where the last focused accessible was * removed before something else was focused. This can happen in one of two * ways: * 1. The DOM focus was removed. DOM doesn't fire a blur event when this * happens; see bug 559561. * 2. The accessibility focus was an active item (e.g. aria-activedescendant) * and that item was removed. */ - bool WasLastFocused(const Accessible* aAccessible) const; + bool WasLastFocused(const LocalAccessible* aAccessible) const; ////////////////////////////////////////////////////////////////////////////// // Focus notifications and processing (don't use until you know what you do). /** * Called when DOM focus event is fired. */ void NotifyOfDOMFocus(nsISupports* aTarget); @@ -94,27 +95,27 @@ class FocusManager { * Called when DOM blur event is fired. */ void NotifyOfDOMBlur(nsISupports* aTarget); /** * Called when active item is changed. Note: must be called when accessible * tree is up to date. */ - void ActiveItemChanged(Accessible* aItem, bool aCheckIfActive = true); + void ActiveItemChanged(LocalAccessible* aItem, bool aCheckIfActive = true); /** * Dispatch delayed focus event for the current focus accessible. */ void ForceFocusEvent(); /** * Dispatch delayed focus event for the given target. */ - void DispatchFocusEvent(DocAccessible* aDocument, Accessible* aTarget); + void DispatchFocusEvent(DocAccessible* aDocument, LocalAccessible* aTarget); /** * Process DOM focus notification. */ void ProcessDOMFocus(nsINode* aTarget); /** * Process the delayed accessible event. @@ -130,17 +131,17 @@ class FocusManager { FocusManager& operator=(const FocusManager&); /** * Return DOM document having DOM focus. */ dom::Document* FocusedDOMDocument() const; private: - RefPtr<Accessible> mActiveItem; - RefPtr<Accessible> mLastFocus; - RefPtr<Accessible> mActiveARIAMenubar; + RefPtr<LocalAccessible> mActiveItem; + RefPtr<LocalAccessible> mLastFocus; + RefPtr<LocalAccessible> mActiveARIAMenubar; }; } // namespace a11y } // namespace mozilla #endif
--- a/accessible/base/Logging.cpp +++ b/accessible/base/Logging.cpp @@ -1,17 +1,17 @@ /* -*- 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 "Logging.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "AccEvent.h" #include "DocAccessible.h" #include "nsAccessibilityService.h" #include "nsCoreUtils.h" #include "OuterDocAccessible.h" #include "nsDocShellLoadTypes.h" #include "nsIChannel.h" @@ -539,17 +539,17 @@ void logging::DocDestroy(const char* aMs void logging::OuterDocDestroy(OuterDocAccessible* aOuterDoc) { MsgBegin(sDocDestroyTitle, "outerdoc shutdown"); logging::Address("outerdoc", aOuterDoc); MsgEnd(); } void logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, - Accessible* aTarget) { + LocalAccessible* aTarget) { MsgBegin(sFocusTitle, "%s", aMsg); AccessibleNNode(aTargetDescr, aTarget); MsgEnd(); } void logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, nsINode* aTargetNode) { @@ -572,35 +572,35 @@ void logging::FocusNotificationTarget(co static_cast<void*>(aTargetThing)); } } MsgEnd(); } void logging::ActiveItemChangeCausedBy(const char* aCause, - Accessible* aTarget) { + LocalAccessible* aTarget) { SubMsgBegin(); printf(" Caused by: %s\n", aCause); AccessibleNNode("Item", aTarget); SubMsgEnd(); } -void logging::ActiveWidget(Accessible* aWidget) { +void logging::ActiveWidget(LocalAccessible* aWidget) { SubMsgBegin(); AccessibleNNode("Widget", aWidget); printf(" Widget is active: %s, has operable items: %s\n", (aWidget && aWidget->IsActiveWidget() ? "true" : "false"), (aWidget && aWidget->AreItemsOperable() ? "true" : "false")); SubMsgEnd(); } -void logging::FocusDispatched(Accessible* aTarget) { +void logging::FocusDispatched(LocalAccessible* aTarget) { SubMsgBegin(); AccessibleNNode("A11y target", aTarget); SubMsgEnd(); } void logging::SelChange(dom::Selection* aSelection, DocAccessible* aDocument, int16_t aReason) { SelectionType type = aSelection->GetType(); @@ -623,68 +623,70 @@ void logging::SelChange(dom::Selection* } void logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...) { if (IsEnabledAll(logging::eTree | aExtraFlags)) { va_list vl; va_start(vl, aExtraFlags); const char* descr = va_arg(vl, const char*); if (descr) { - Accessible* acc = va_arg(vl, Accessible*); + LocalAccessible* acc = va_arg(vl, LocalAccessible*); MsgBegin("TREE", "%s; doc: %p", aMsg, acc ? acc->Document() : nullptr); AccessibleInfo(descr, acc); while ((descr = va_arg(vl, const char*))) { - AccessibleInfo(descr, va_arg(vl, Accessible*)); + AccessibleInfo(descr, va_arg(vl, LocalAccessible*)); } } else { MsgBegin("TREE", "%s", aMsg); } va_end(vl); MsgEnd(); if (aExtraFlags & eStack) { Stack(); } } } void logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, - const char* aMsg1, Accessible* aAcc, const char* aMsg2, - nsINode* aNode) { + const char* aMsg1, LocalAccessible* aAcc, + const char* aMsg2, nsINode* aNode) { if (IsEnabledAll(logging::eTree | aExtraFlags)) { MsgBegin("TREE", "%s; doc: %p", aMsg, aAcc ? aAcc->Document() : nullptr); AccessibleInfo(aMsg1, aAcc); - Accessible* acc = aAcc ? aAcc->Document()->GetAccessible(aNode) : nullptr; + LocalAccessible* acc = + aAcc ? aAcc->Document()->GetAccessible(aNode) : nullptr; if (acc) { AccessibleInfo(aMsg2, acc); } else { Node(aMsg2, aNode); } MsgEnd(); } } void logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, - Accessible* aParent) { + LocalAccessible* aParent) { if (IsEnabledAll(logging::eTree | aExtraFlags)) { MsgBegin("TREE", "%s; doc: %p", aMsg, aParent->Document()); AccessibleInfo("container", aParent); for (uint32_t idx = 0; idx < aParent->ChildCount(); idx++) { AccessibleInfo("child", aParent->LocalChildAt(idx)); } MsgEnd(); } } -void logging::Tree(const char* aTitle, const char* aMsgText, Accessible* aRoot, - GetTreePrefix aPrefixFunc, void* aGetTreePrefixData) { +void logging::Tree(const char* aTitle, const char* aMsgText, + LocalAccessible* aRoot, GetTreePrefix aPrefixFunc, + void* aGetTreePrefixData) { logging::MsgBegin(aTitle, "%s", aMsgText); nsAutoString level; - Accessible* root = aRoot; + LocalAccessible* root = aRoot; do { const char* prefix = aPrefixFunc ? aPrefixFunc(aGetTreePrefixData, root) : ""; printf("%s", NS_ConvertUTF16toUTF8(level).get()); logging::AccessibleInfo(prefix, root); if (root->LocalFirstChild() && !root->LocalFirstChild()->IsDoc()) { level.AppendLiteral(u" "); root = root->LocalFirstChild(); @@ -775,17 +777,17 @@ void logging::MsgEntry(const char* aEntr vprintf(aEntryText, argptr); va_end(argptr); printf("\n"); } void logging::Text(const char* aText) { printf(" %s\n", aText); } -void logging::Address(const char* aDescr, Accessible* aAcc) { +void logging::Address(const char* aDescr, LocalAccessible* aAcc) { if (!aAcc->IsDoc()) { printf(" %s accessible: %p, node: %p\n", aDescr, static_cast<void*>(aAcc), static_cast<void*>(aAcc->GetNode())); } DocAccessible* doc = aAcc->Document(); dom::Document* docNode = doc->DocumentNode(); printf(" document: %p, node: %p\n", static_cast<void*>(doc), @@ -810,17 +812,17 @@ void logging::Document(DocAccessible* aD printf(" Document: %p, document node: %p\n", static_cast<void*>(aDocument), static_cast<void*>(aDocument->DocumentNode())); printf(" Document "); LogDocURI(aDocument->DocumentNode()); printf("\n"); } -void logging::AccessibleInfo(const char* aDescr, Accessible* aAccessible) { +void logging::AccessibleInfo(const char* aDescr, LocalAccessible* aAccessible) { printf(" %s: %p; ", aDescr, static_cast<void*>(aAccessible)); if (!aAccessible) { printf("\n"); return; } if (aAccessible->IsDefunct()) { printf("defunct\n"); return; @@ -842,17 +844,18 @@ void logging::AccessibleInfo(const char* printf(", idx: %d", aAccessible->IndexInParent()); nsAutoString nodeDesc; DescribeNode(aAccessible->GetNode(), nodeDesc); printf(", node: %s\n", NS_ConvertUTF16toUTF8(nodeDesc).get()); } -void logging::AccessibleNNode(const char* aDescr, Accessible* aAccessible) { +void logging::AccessibleNNode(const char* aDescr, + LocalAccessible* aAccessible) { printf(" %s: %p; ", aDescr, static_cast<void*>(aAccessible)); if (!aAccessible) return; nsAutoString role; GetAccService()->GetStringRole(aAccessible->Role(), role); nsAutoString name; aAccessible->Name(name); @@ -866,17 +869,17 @@ void logging::AccessibleNNode(const char Document(aAccessible->Document()); } void logging::AccessibleNNode(const char* aDescr, nsINode* aNode) { DocAccessible* document = GetAccService()->GetDocAccessible(aNode->OwnerDoc()); if (document) { - Accessible* accessible = document->GetAccessible(aNode); + LocalAccessible* accessible = document->GetAccessible(aNode); if (accessible) { AccessibleNNode(aDescr, accessible); return; } } nsAutoCString nodeDescr("[not accessible] "); nodeDescr.Append(aDescr);
--- a/accessible/base/Logging.h +++ b/accessible/base/Logging.h @@ -21,17 +21,17 @@ namespace mozilla { namespace dom { class Document; class Selection; } // namespace dom namespace a11y { class AccEvent; -class Accessible; +class LocalAccessible; class DocAccessible; class OuterDocAccessible; namespace logging { enum EModules { eDocLoad = 1 << 0, eDocCreate = 1 << 1, @@ -103,56 +103,56 @@ void DocDestroy(const char* aMsg, dom::D * Log the outer document was destroyed. */ void OuterDocDestroy(OuterDocAccessible* OuterDoc); /** * Log the focus notification target. */ void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, - Accessible* aTarget); + LocalAccessible* aTarget); void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, nsINode* aTargetNode); void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, nsISupports* aTargetThing); /** * Log a cause of active item descendant change (submessage). */ -void ActiveItemChangeCausedBy(const char* aMsg, Accessible* aTarget); +void ActiveItemChangeCausedBy(const char* aMsg, LocalAccessible* aTarget); /** * Log the active widget (submessage). */ -void ActiveWidget(Accessible* aWidget); +void ActiveWidget(LocalAccessible* aWidget); /** * Log the focus event was dispatched (submessage). */ -void FocusDispatched(Accessible* aTarget); +void FocusDispatched(LocalAccessible* aTarget); /** * Log the selection change. */ void SelChange(dom::Selection* aSelection, DocAccessible* aDocument, int16_t aReason); /** * Log the given accessible elements info. */ void TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...); void TreeInfo(const char* aMsg, uint32_t aExtraFlags, const char* aMsg1, - Accessible* aAcc, const char* aMsg2, nsINode* aNode); -void TreeInfo(const char* aMsg, uint32_t aExtraFlags, Accessible* aParent); + LocalAccessible* aAcc, const char* aMsg2, nsINode* aNode); +void TreeInfo(const char* aMsg, uint32_t aExtraFlags, LocalAccessible* aParent); /** * Log the accessible/DOM tree. */ -typedef const char* (*GetTreePrefix)(void* aData, Accessible*); -void Tree(const char* aTitle, const char* aMsgText, Accessible* aRoot, +typedef const char* (*GetTreePrefix)(void* aData, LocalAccessible*); +void Tree(const char* aTitle, const char* aMsgText, LocalAccessible* aRoot, GetTreePrefix aPrefixFunc = nullptr, void* aGetTreePrefixData = nullptr); void DOMTree(const char* aTitle, const char* aMsgText, DocAccessible* aDoc); /** * Log the message ('title: text' format) on new line. Print the start and end * boundaries of the message body designated by '{' and '}' (2 spaces indent for * body). @@ -176,33 +176,33 @@ void MsgEntry(const char* aEntryText, .. /** * Log the text, two spaces offset is used. */ void Text(const char* aText); /** * Log the accessible object address as message entry (4 spaces indent). */ -void Address(const char* aDescr, Accessible* aAcc); +void Address(const char* aDescr, LocalAccessible* aAcc); /** * Log the DOM node info as message entry. */ void Node(const char* aDescr, nsINode* aNode); /** * Log the document accessible info as message entry. */ void Document(DocAccessible* aDocument); /** * Log the accessible and its DOM node as a message entry. */ -void AccessibleInfo(const char* aDescr, Accessible* aAccessible); -void AccessibleNNode(const char* aDescr, Accessible* aAccessible); +void AccessibleInfo(const char* aDescr, LocalAccessible* aAccessible); +void AccessibleNNode(const char* aDescr, LocalAccessible* aAccessible); void AccessibleNNode(const char* aDescr, nsINode* aNode); /** * Log the DOM event. */ void DOMEvent(const char* aDescr, nsINode* aOrigTarget, const nsAString& aEventType);
--- a/accessible/base/MarkupMap.h +++ b/accessible/base/MarkupMap.h @@ -2,17 +2,17 @@ /* vim:expandtab:shiftwidth=2:tabstop=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/. */ MARKUPMAP( a, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { // Only some roles truly enjoy life as HTMLLinkAccessibles, for // details see closed bug 494807. const nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aElement); if (roleMapEntry && roleMapEntry->role != roles::NOTHING && roleMapEntry->role != roles::LINK) { return new HyperTextAccessibleWrap(aElement, aContext->Document()); } @@ -27,24 +27,24 @@ MARKUPMAP(acronym, New_HyperText, 0) MARKUPMAP(article, New_HyperText, roles::ARTICLE, Attr(xmlroles, article)) MARKUPMAP(aside, New_HyperText, roles::LANDMARK) MARKUPMAP(blockquote, New_HyperText, roles::BLOCKQUOTE) MARKUPMAP( button, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLButtonAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( caption, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { if (aContext->IsTable()) { dom::HTMLTableElement* tableEl = dom::HTMLTableElement::FromNode(aContext->GetContent()); if (tableEl && tableEl == aElement->GetParent() && tableEl->GetCaption() == aElement) { return new HTMLCaptionAccessible(aElement, aContext->Document()); } } @@ -60,17 +60,17 @@ MARKUPMAP(dd, New_HTMLDtOrDd<HyperTextAc MARKUPMAP(del, New_HyperText, roles::CONTENT_DELETION) MARKUPMAP(details, New_HyperText, roles::DETAILS) MARKUPMAP(dialog, New_HyperText, roles::DIALOG) MARKUPMAP( div, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { // Never create an accessible if we're part of an anonymous // subtree. if (aElement->IsInNativeAnonymousSubtree()) { return nullptr; } // Always create an accessible if the div has an id. if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::id)) { return new HyperTextAccessibleWrap(aElement, aContext->Document()); @@ -134,61 +134,61 @@ MARKUPMAP( } } return nullptr; }, roles::SECTION) MARKUPMAP( dl, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLListAccessible(aElement, aContext->Document()); }, roles::DEFINITION_LIST) MARKUPMAP(dt, New_HTMLDtOrDd<HTMLLIAccessible>, roles::TERM) MARKUPMAP( figcaption, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLFigcaptionAccessible(aElement, aContext->Document()); }, roles::CAPTION) MARKUPMAP( figure, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLFigureAccessible(aElement, aContext->Document()); }, roles::FIGURE, Attr(xmlroles, figure)) MARKUPMAP( fieldset, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLGroupboxAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( form, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLFormAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( footer, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLHeaderOrFooterAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( header, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLHeaderOrFooterAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP(h1, New_HyperText, roles::HEADING) MARKUPMAP(h2, New_HyperText, roles::HEADING) @@ -197,24 +197,24 @@ MARKUPMAP(h3, New_HyperText, roles::HEAD MARKUPMAP(h4, New_HyperText, roles::HEADING) MARKUPMAP(h5, New_HyperText, roles::HEADING) MARKUPMAP(h6, New_HyperText, roles::HEADING) MARKUPMAP( hr, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLHRAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( input, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { // TODO(emilio): This would be faster if it used // HTMLInputElement's already-parsed representation. if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::checkbox, eIgnoreCase)) { return new CheckboxAccessible(aElement, aContext->Document()); } if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::image, eIgnoreCase)) { @@ -237,31 +237,31 @@ MARKUPMAP( return nullptr; }, 0) MARKUPMAP(ins, New_HyperText, roles::CONTENT_INSERTION) MARKUPMAP( label, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLLabelAccessible(aElement, aContext->Document()); }, roles::LABEL) MARKUPMAP( legend, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLLegendAccessible(aElement, aContext->Document()); }, roles::LABEL) MARKUPMAP( li, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { // If list item is a child of accessible list then create an // accessible for it unconditionally by tag name. nsBlockFrame // creates the list item accessible for other elements styled as // list items. if (aContext->IsList() && aContext->GetContent() == aElement->GetParent()) { return new HTMLLIAccessible(aElement, aContext->Document()); } @@ -326,50 +326,50 @@ MARKUPMAP(mover_, New_HyperText, roles:: MARKUPMAP(munderover_, New_HyperText, roles::MATHML_UNDER_OVER, AttrFromDOM(accent_, accent_), AttrFromDOM(accentunder_, accentunder_), AttrFromDOM(align, align)) MARKUPMAP(mmultiscripts_, New_HyperText, roles::MATHML_MULTISCRIPTS) MARKUPMAP( mtable_, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLTableAccessible(aElement, aContext->Document()); }, roles::MATHML_TABLE, AttrFromDOM(align, align), AttrFromDOM(columnlines_, columnlines_), AttrFromDOM(rowlines_, rowlines_)) MARKUPMAP( mlabeledtr_, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLTableRowAccessible(aElement, aContext->Document()); }, roles::MATHML_LABELED_ROW) MARKUPMAP( mtr_, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLTableRowAccessible(aElement, aContext->Document()); }, roles::MATHML_TABLE_ROW) MARKUPMAP( mtd_, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLTableCellAccessible(aElement, aContext->Document()); }, roles::MATHML_CELL) MARKUPMAP(maction_, New_HyperText, roles::MATHML_ACTION, AttrFromDOM(actiontype_, actiontype_), AttrFromDOM(selection_, selection_)) MARKUPMAP( menu, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLListAccessible(aElement, aContext->Document()); }, roles::LIST) MARKUPMAP(merror_, New_HyperText, roles::MATHML_ERROR) MARKUPMAP(mstack_, New_HyperText, roles::MATHML_STACK, AttrFromDOM(align, align), AttrFromDOM(position, position)) @@ -391,70 +391,70 @@ MARKUPMAP(mscarry_, New_HyperText, roles MARKUPMAP(msline_, New_HyperText, roles::MATHML_STACK_LINE, AttrFromDOM(position, position)) MARKUPMAP(nav, New_HyperText, roles::LANDMARK) MARKUPMAP( ol, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLListAccessible(aElement, aContext->Document()); }, roles::LIST) MARKUPMAP( option, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLSelectOptionAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( optgroup, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLSelectOptGroupAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( output, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLOutputAccessible(aElement, aContext->Document()); }, roles::STATUSBAR, Attr(live, polite)) MARKUPMAP(p, nullptr, roles::PARAGRAPH) MARKUPMAP( progress, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLProgressAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP(q, New_HyperText, 0) MARKUPMAP( section, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLSectionAccessible(aElement, aContext->Document()); }, 0) MARKUPMAP( summary, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLSummaryAccessible(aElement, aContext->Document()); }, roles::SUMMARY) MARKUPMAP( table, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { if (aElement->GetPrimaryFrame() && aElement->GetPrimaryFrame()->AccessibleType() != eHTMLTableType) { return new ARIAGridAccessibleWrap(aElement, aContext->Document()); } // Make sure that our children are proper layout table parts for (nsIContent* child = aElement->GetFirstChild(); child; child = child->GetNextSibling()) { @@ -475,17 +475,17 @@ MARKUPMAP( MARKUPMAP(time, New_HyperText, 0, Attr(xmlroles, time), AttrFromDOM(datetime, datetime)) MARKUPMAP(tbody, nullptr, roles::GROUPING) MARKUPMAP( td, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { if (aContext->IsTableRow() && aContext->GetContent() == aElement->GetParent()) { // If HTML:td element is part of its HTML:table, which has CSS // display style other than 'table', then create a generic table // cell accessible, because there's no underlying table layout and // thus native HTML table cell class doesn't work. The same is // true if the cell itself has CSS display:block;. if (!aContext->IsHTMLTableRow() || @@ -502,40 +502,40 @@ MARKUPMAP( return nullptr; }, 0) MARKUPMAP(tfoot, nullptr, roles::GROUPING) MARKUPMAP( th, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { if (aContext->IsTableRow() && aContext->GetContent() == aElement->GetParent()) { if (!aContext->IsHTMLTableRow()) { return new ARIAGridCellAccessibleWrap(aElement, aContext->Document()); } return new HTMLTableHeaderCellAccessibleWrap(aElement, aContext->Document()); } return nullptr; }, 0) MARKUPMAP(thead, nullptr, roles::GROUPING) MARKUPMAP( tr, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { // If HTML:tr element is part of its HTML:table, which has CSS // display style other than 'table', then create a generic table row // accessible, because there's no underlying table layout and thus // native HTML table row class doesn't work. Refer to // CreateAccessibleByFrameType dual logic. - Accessible* table = aContext->IsTable() ? aContext : nullptr; + LocalAccessible* table = aContext->IsTable() ? aContext : nullptr; if (!table && aContext->LocalParent() && aContext->LocalParent()->IsTable()) { table = aContext->LocalParent(); } if (table) { nsIContent* parentContent = aElement->GetParent(); nsIFrame* parentFrame = parentContent->GetPrimaryFrame(); if (parentFrame && !parentFrame->IsTableWrapperFrame()) { @@ -551,19 +551,19 @@ MARKUPMAP( } } return nullptr; }, 0) MARKUPMAP( ul, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLListAccessible(aElement, aContext->Document()); }, roles::LIST) MARKUPMAP( meter, - [](Element* aElement, Accessible* aContext) -> Accessible* { + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { return new HTMLMeterAccessible(aElement, aContext->Document()); }, roles::METER)
--- a/accessible/base/NotificationController.cpp +++ b/accessible/base/NotificationController.cpp @@ -99,17 +99,17 @@ void NotificationController::Shutdown() mTextHash.Clear(); mContentInsertions.Clear(); mNotifications.Clear(); mEvents.Clear(); mRelocations.Clear(); mEventTree.Clear(); } -EventTree* NotificationController::QueueMutation(Accessible* aContainer) { +EventTree* NotificationController::QueueMutation(LocalAccessible* aContainer) { EventTree* tree = mEventTree.FindOrInsert(aContainer); if (tree) { ScheduleProcessing(); } return tree; } bool NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent) { @@ -166,18 +166,18 @@ bool NotificationController::QueueMutati return false; } } // We need to fire a reorder event after all of the events targeted at shown // or hidden children of a container. So either queue a new one, or move an // existing one to the end of the queue if the container already has a // reorder event. - Accessible* target = aEvent->GetAccessible(); - Accessible* container = aEvent->GetAccessible()->LocalParent(); + LocalAccessible* target = aEvent->GetAccessible(); + LocalAccessible* container = aEvent->GetAccessible()->LocalParent(); RefPtr<AccReorderEvent> reorder; if (!container->ReorderEventTarget()) { reorder = new AccReorderEvent(container); container->SetReorderEventTarget(true); mMutationMap.PutEvent(reorder); // Since this is the first child of container that is changing, the name // and/or description of dependent Accessibles may be changing. @@ -311,31 +311,31 @@ void NotificationController::DropMutatio } void NotificationController::CoalesceMutationEvents() { AccTreeMutationEvent* event = mFirstMutationEvent; while (event) { AccTreeMutationEvent* nextEvent = event->NextEvent(); uint32_t eventType = event->GetEventType(); if (event->GetEventType() == nsIAccessibleEvent::EVENT_REORDER) { - Accessible* acc = event->GetAccessible(); + LocalAccessible* acc = event->GetAccessible(); while (acc) { if (acc->IsDoc()) { break; } // if a parent of the reorder event's target is being hidden that // hide event's target must have a parent that is also a reorder event // target. That means we don't need this reorder event. if (acc->HideEventTarget()) { DropMutationEvent(event); break; } - Accessible* parent = acc->LocalParent(); + LocalAccessible* parent = acc->LocalParent(); if (parent->ReorderEventTarget()) { AccReorderEvent* reorder = downcast_accEvent( mMutationMap.GetEvent(parent, EventMap::ReorderEvent)); // We want to make sure that a reorder event comes after any show or // hide events targeted at the children of its target. We keep the // invariant that event generation goes up as you are farther in the // queue, so we want to use the spot of the event with the higher @@ -366,17 +366,17 @@ void NotificationController::CoalesceMut } DropMutationEvent(event); break; } acc = parent; } } else if (eventType == nsIAccessibleEvent::EVENT_SHOW) { - Accessible* parent = event->GetAccessible()->LocalParent(); + LocalAccessible* parent = event->GetAccessible()->LocalParent(); while (parent) { if (parent->IsDoc()) { break; } // if the parent of a show event is being either shown or hidden then // we don't need to fire a show event for a subtree of that change. if (parent->ShowEventTarget() || parent->HideEventTarget()) { @@ -386,17 +386,17 @@ void NotificationController::CoalesceMut parent = parent->LocalParent(); } } else { MOZ_ASSERT(eventType == nsIAccessibleEvent::EVENT_HIDE, "mutation event list has an invalid event"); AccHideEvent* hideEvent = downcast_accEvent(event); - Accessible* parent = hideEvent->LocalParent(); + LocalAccessible* parent = hideEvent->LocalParent(); while (parent) { if (parent->IsDoc()) { break; } if (parent->HideEventTarget()) { DropMutationEvent(event); break; @@ -421,17 +421,17 @@ void NotificationController::CoalesceMut void NotificationController::ScheduleChildDocBinding(DocAccessible* aDocument) { // Schedule child document binding to the tree. mHangingChildDocuments.AppendElement(aDocument); ScheduleProcessing(); } void NotificationController::ScheduleContentInsertion( - Accessible* aContainer, nsTArray<nsCOMPtr<nsIContent>>& aInsertions) { + LocalAccessible* aContainer, nsTArray<nsCOMPtr<nsIContent>>& aInsertions) { if (!aInsertions.IsEmpty()) { mContentInsertions.LookupOrAdd(aContainer)->AppendElements(aInsertions); ScheduleProcessing(); } } void NotificationController::ScheduleProcessing() { // If notification flush isn't planed yet start notification flush @@ -517,25 +517,26 @@ void NotificationController::ProcessMuta AccHideEvent* hideEvent = downcast_accEvent(event); if (hideEvent->NeedsShutdown()) { mDocument->ShutdownChildrenInSubtree(event->mAccessible); } } // Group the show events by the parent of their target. - nsDataHashtable<nsPtrHashKey<Accessible>, nsTArray<AccTreeMutationEvent*>> + nsDataHashtable<nsPtrHashKey<LocalAccessible>, + nsTArray<AccTreeMutationEvent*>> showEvents; for (AccTreeMutationEvent* event = mFirstMutationEvent; event; event = event->NextEvent()) { if (event->GetEventType() != nsIAccessibleEvent::EVENT_SHOW) { continue; } - Accessible* parent = event->GetAccessible()->LocalParent(); + LocalAccessible* parent = event->GetAccessible()->LocalParent(); showEvents.GetOrInsert(parent).AppendElement(event); } // We need to fire show events for the children of an accessible in the order // of their indices at this point. So sort each set of events for the same // container by the index of their target. for (auto iter = showEvents.Iter(); !iter.Done(); iter.Next()) { struct AccIdxComparator { @@ -580,17 +581,17 @@ void NotificationController::ProcessMuta continue; } nsEventShell::FireEvent(event); if (!mDocument) { return; } - Accessible* target = event->GetAccessible(); + LocalAccessible* target = event->GetAccessible(); target->Document()->MaybeNotifyOfValueChange(target); if (!mDocument) { return; } } } //////////////////////////////////////////////////////////////////////////////// @@ -652,17 +653,17 @@ void NotificationController::WillRefresh "Pending content insertions while initial accessible tree " "isn't created!"); } // Process rendered text change notifications. for (auto iter = mTextHash.Iter(); !iter.Done(); iter.Next()) { nsCOMPtrHashKey<nsIContent>* entry = iter.Get(); nsIContent* textNode = entry->GetKey(); - Accessible* textAcc = mDocument->GetAccessible(textNode); + LocalAccessible* textAcc = mDocument->GetAccessible(textNode); // If the text node is not in tree or doesn't have a frame, or placed in // another document, then this case should have been handled already by // content removal notifications. nsINode* containerNode = textNode->GetFlattenedTreeParentNode(); if (!containerNode || textNode->OwnerDoc() != mDocument->DocumentNode()) { MOZ_ASSERT(!textAcc, "Text node was removed but accessible is kept alive!"); @@ -731,17 +732,17 @@ void NotificationController::WillRefresh logging::Node("content", textNode); logging::MsgEnd(); } #endif MOZ_ASSERT(mDocument->AccessibleOrTrueContainer(containerNode), "Text node having rendered text hasn't accessible document!"); - Accessible* container = + LocalAccessible* container = mDocument->AccessibleOrTrueContainer(containerNode, true); if (container) { nsTArray<nsCOMPtr<nsIContent>>* list = mContentInsertions.LookupOrAdd(container); list->AppendElement(textNode); } } } @@ -773,17 +774,17 @@ void NotificationController::WillRefresh if (IPCAccessibilityActive() && !mDocument->IPCDoc()) { childDoc->Shutdown(); continue; } nsIContent* ownerContent = childDoc->DocumentNode()->GetEmbedderElement(); if (ownerContent) { - Accessible* outerDocAcc = mDocument->GetAccessible(ownerContent); + LocalAccessible* outerDocAcc = mDocument->GetAccessible(ownerContent); if (outerDocAcc && outerDocAcc->AppendChild(childDoc)) { if (mDocument->AppendChildDocument(childDoc)) { newChildDocs.AppendElement(std::move(mHangingChildDocuments[idx])); continue; } outerDocAcc->RemoveChild(childDoc); } @@ -856,17 +857,17 @@ void NotificationController::WillRefresh mEventGeneration = 0; // Now that we are done with them get rid of the events we fired. RefPtr<AccTreeMutationEvent> mutEvent = std::move(mFirstMutationEvent); mLastMutationEvent = nullptr; mFirstMutationEvent = nullptr; while (mutEvent) { RefPtr<AccTreeMutationEvent> nextEvent = mutEvent->NextEvent(); - Accessible* target = mutEvent->GetAccessible(); + LocalAccessible* target = mutEvent->GetAccessible(); // We need to be careful here, while it may seem that we can simply 0 all // the pending event bits that is not true. Because accessibles may be // reparented they may be the target of both a hide event and a show event // at the same time. if (mutEvent->GetEventType() == nsIAccessibleEvent::EVENT_SHOW) { target->SetShowEventTarget(false); } @@ -890,17 +891,17 @@ void NotificationController::WillRefresh if (IPCAccessibilityActive()) { size_t newDocCount = newChildDocs.Length(); for (size_t i = 0; i < newDocCount; i++) { DocAccessible* childDoc = newChildDocs[i]; if (childDoc->IsDefunct()) { continue; } - Accessible* parent = childDoc->LocalParent(); + LocalAccessible* parent = childDoc->LocalParent(); DocAccessibleChild* parentIPCDoc = mDocument->IPCDoc(); MOZ_DIAGNOSTIC_ASSERT(parentIPCDoc); uint64_t id = reinterpret_cast<uintptr_t>(parent->UniqueID()); MOZ_DIAGNOSTIC_ASSERT(id); DocAccessibleChild* ipcDoc = childDoc->IPCDoc(); if (ipcDoc) { parentIPCDoc->SendBindChildDoc(ipcDoc, id); continue; @@ -942,17 +943,17 @@ void NotificationController::EventMap::P EventType type = GetEventType(aEvent); uint64_t addr = reinterpret_cast<uintptr_t>(aEvent->GetAccessible()); MOZ_ASSERT((addr & 0x3) == 0, "accessible is not 4 byte aligned"); addr |= type; mTable.Put(addr, RefPtr{aEvent}); } AccTreeMutationEvent* NotificationController::EventMap::GetEvent( - Accessible* aTarget, EventType aType) { + LocalAccessible* aTarget, EventType aType) { uint64_t addr = reinterpret_cast<uintptr_t>(aTarget); MOZ_ASSERT((addr & 0x3) == 0, "target is not 4 byte aligned"); addr |= aType; return mTable.GetWeak(addr); } void NotificationController::EventMap::RemoveEvent(
--- a/accessible/base/NotificationController.h +++ b/accessible/base/NotificationController.h @@ -112,17 +112,17 @@ class NotificationController final : pub ScheduleProcessing(); } } /** * Returns existing event tree for the given the accessible or creates one if * it doesn't exists yet. */ - EventTree* QueueMutation(Accessible* aContainer); + EventTree* QueueMutation(LocalAccessible* aContainer); class MoveGuard final { public: explicit MoveGuard(NotificationController* aController) : mController(aController) { #ifdef DEBUG MOZ_ASSERT(!mController->mMoveGuardOnStack, "Move guard is on stack already!"); @@ -175,23 +175,23 @@ class NotificationController final : pub mTextHash.PutEntry(aTextNode); ScheduleProcessing(); } /** * Pend accessible tree update for content insertion. */ - void ScheduleContentInsertion(Accessible* aContainer, + void ScheduleContentInsertion(LocalAccessible* aContainer, nsTArray<nsCOMPtr<nsIContent>>& aInsertions); /** * Pend an accessible subtree relocation. */ - void ScheduleRelocation(Accessible* aOwner) { + void ScheduleRelocation(LocalAccessible* aOwner) { if (!mRelocations.Contains(aOwner)) { // XXX(Bug 1631371) Check if this should use a fallible operation as it // pretended earlier, or change the return type to void. mRelocations.AppendElement(aOwner); ScheduleProcessing(); } } @@ -346,17 +346,18 @@ class NotificationController final : pub /** * Child documents that needs to be bound to the tree. */ nsTArray<RefPtr<DocAccessible>> mHangingChildDocuments; /** * Pending accessible tree update notifications for content insertions. */ - nsClassHashtable<nsRefPtrHashKey<Accessible>, nsTArray<nsCOMPtr<nsIContent>>> + nsClassHashtable<nsRefPtrHashKey<LocalAccessible>, + nsTArray<nsCOMPtr<nsIContent>>> mContentInsertions; template <class T> class nsCOMPtrHashKey : public PLDHashEntryHdr { public: typedef T* KeyType; typedef const T* KeyTypePointer; @@ -388,17 +389,17 @@ class NotificationController final : pub * Other notifications like DOM events. Don't make this an AutoTArray; we * use SwapElements() on it. */ nsTArray<RefPtr<Notification>> mNotifications; /** * Holds all scheduled relocations. */ - nsTArray<RefPtr<Accessible>> mRelocations; + nsTArray<RefPtr<LocalAccessible>> mRelocations; /** * Holds all mutation events. */ EventTree mEventTree; /** * A temporary collection of hide events that should be fired before related @@ -427,17 +428,17 @@ class NotificationController final : pub public: enum EventType { ShowEvent = 0x0, HideEvent = 0x1, ReorderEvent = 0x2, }; void PutEvent(AccTreeMutationEvent* aEvent); - AccTreeMutationEvent* GetEvent(Accessible* aTarget, EventType aType); + AccTreeMutationEvent* GetEvent(LocalAccessible* aTarget, EventType aType); void RemoveEvent(AccTreeMutationEvent* aEvent); void Clear() { mTable.Clear(); } private: EventType GetEventType(AccTreeMutationEvent* aEvent); nsRefPtrHashtable<nsUint64HashKey, AccTreeMutationEvent> mTable; };
--- a/accessible/base/Pivot.cpp +++ b/accessible/base/Pivot.cpp @@ -1,17 +1,17 @@ /* -*- 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 "Pivot.h" #include "AccIterator.h" -#include "Accessible.h" +#include "LocalAccessible.h" #include "DocAccessible.h" #include "nsAccessibilityService.h" #include "nsAccUtils.h" #include "mozilla/dom/ChildIterator.h" #include "mozilla/dom/Element.h" using namespace mozilla; @@ -152,34 +152,35 @@ AccessibleOrProxy Pivot::SearchForward(A return accOrProxy; } } return AccessibleOrProxy(); } // TODO: This method does not work for proxy accessibles -HyperTextAccessible* Pivot::SearchForText(Accessible* aAnchor, bool aBackward) { +HyperTextAccessible* Pivot::SearchForText(LocalAccessible* aAnchor, + bool aBackward) { if (!mRoot.IsAccessible()) { return nullptr; } - Accessible* accessible = aAnchor; + LocalAccessible* accessible = aAnchor; while (true) { - Accessible* child = nullptr; + LocalAccessible* child = nullptr; while ((child = (aBackward ? accessible->LocalLastChild() : accessible->LocalFirstChild()))) { accessible = child; if (child->IsHyperText()) { return child->AsHyperText(); } } - Accessible* sibling = nullptr; - Accessible* temp = accessible; + LocalAccessible* sibling = nullptr; + LocalAccessible* temp = accessible; do { if (temp == mRoot.AsAccessible()) { break; } // Unlike traditional pre-order traversal we revisit the parent // nodes when we go up the tree. This is because our starting point // may be a subtree or a leaf. If it's parent matches, it should @@ -231,24 +232,25 @@ AccessibleOrProxy Pivot::Last(PivotRule& } // Search backwards from last accessible and find the last occurrence in the // doc return SearchBackward(lastAccOrProxy, aRule, true); } // TODO: This method does not work for proxy accessibles -Accessible* Pivot::NextText(Accessible* aAnchor, int32_t* aStartOffset, - int32_t* aEndOffset, int32_t aBoundaryType) { +LocalAccessible* Pivot::NextText(LocalAccessible* aAnchor, + int32_t* aStartOffset, int32_t* aEndOffset, + int32_t aBoundaryType) { if (!mRoot.IsAccessible()) { return nullptr; } int32_t tempStart = *aStartOffset, tempEnd = *aEndOffset; - Accessible* tempPosition = aAnchor; + LocalAccessible* tempPosition = aAnchor; // if we're starting on a text leaf, translate the offsets to the // HyperTextAccessible parent and start from there. if (aAnchor->IsTextLeaf() && aAnchor->LocalParent() && aAnchor->LocalParent()->IsHyperText()) { HyperTextAccessible* text = aAnchor->LocalParent()->AsHyperText(); tempPosition = text; int32_t childOffset = text->GetChildOffset(aAnchor); @@ -257,17 +259,17 @@ Accessible* Pivot::NextText(Accessible* tempEnd = 0; } tempStart += childOffset; tempEnd += childOffset; } while (true) { MOZ_ASSERT(tempPosition); - Accessible* curPosition = tempPosition; + LocalAccessible* curPosition = tempPosition; HyperTextAccessible* text = nullptr; // Find the nearest text node using a preorder traversal starting from // the current node. if (!(text = tempPosition->AsHyperText())) { text = SearchForText(tempPosition, false); if (!text) { return nullptr; } @@ -294,17 +296,17 @@ Accessible* Pivot::NextText(Accessible* return nullptr; } // If we're currently sitting on a link, try move to either the next // sibling or the parent, whichever is closer to the current end // offset. Otherwise, do a forward search for the next node to land on // (we don't do this in the first case because we don't want to go to the // subtree). - Accessible* sibling = tempPosition->LocalNextSibling(); + LocalAccessible* sibling = tempPosition->LocalNextSibling(); if (tempPosition->IsLink()) { if (sibling && sibling->IsLink()) { tempStart = tempEnd = -1; tempPosition = sibling; } else { tempStart = tempPosition->StartOffset(); tempEnd = tempPosition->EndOffset(); tempPosition = tempPosition->LocalParent(); @@ -344,17 +346,17 @@ Accessible* Pivot::NextText(Accessible* text->TextBeforeOffset(tempEnd, startBoundary, &newStart, &newEnd, unusedText); int32_t potentialStart = newEnd == tempEnd ? newStart : newEnd; tempStart = potentialStart > tempStart ? potentialStart : currentEnd; // The offset range we've obtained might have embedded characters in it, // limit the range to the start of the first occurrence of an embedded // character. - Accessible* childAtOffset = nullptr; + LocalAccessible* childAtOffset = nullptr; for (int32_t i = tempStart; i < tempEnd; i++) { childAtOffset = text->GetChildAtOffset(i); if (childAtOffset && childAtOffset->IsHyperText()) { tempEnd = i; break; } } // If there's an embedded character at the very start of the range, we @@ -371,24 +373,25 @@ Accessible* Pivot::NextText(Accessible* *aEndOffset = tempEnd; MOZ_ASSERT(tempPosition); return tempPosition; } } // TODO: This method does not work for proxy accessibles -Accessible* Pivot::PrevText(Accessible* aAnchor, int32_t* aStartOffset, - int32_t* aEndOffset, int32_t aBoundaryType) { +LocalAccessible* Pivot::PrevText(LocalAccessible* aAnchor, + int32_t* aStartOffset, int32_t* aEndOffset, + int32_t aBoundaryType) { if (!mRoot.IsAccessible()) { return nullptr; } int32_t tempStart = *aStartOffset, tempEnd = *aEndOffset; - Accessible* tempPosition = aAnchor; + LocalAccessible* tempPosition = aAnchor; // if we're starting on a text leaf, translate the offsets to the // HyperTextAccessible parent and start from there. if (aAnchor->IsTextLeaf() && aAnchor->LocalParent() && aAnchor->LocalParent()->IsHyperText()) { HyperTextAccessible* text = aAnchor->LocalParent()->AsHyperText(); tempPosition = text; int32_t childOffset = text->GetChildOffset(aAnchor); @@ -398,17 +401,17 @@ Accessible* Pivot::PrevText(Accessible* } tempStart += childOffset; tempEnd += childOffset; } while (true) { MOZ_ASSERT(tempPosition); - Accessible* curPosition = tempPosition; + LocalAccessible* curPosition = tempPosition; HyperTextAccessible* text; // Find the nearest text node using a reverse preorder traversal starting // from the current node. if (!(text = tempPosition->AsHyperText())) { text = SearchForText(tempPosition, true); if (!text) { return nullptr; } @@ -438,17 +441,17 @@ Accessible* Pivot::PrevText(Accessible* return nullptr; } // If we're currently sitting on a link, try move to either the previous // sibling or the parent, whichever is closer to the current end // offset. Otherwise, do a forward search for the next node to land on // (we don't do this in the first case because we don't want to go to the // subtree). - Accessible* sibling = tempPosition->LocalPrevSibling(); + LocalAccessible* sibling = tempPosition->LocalPrevSibling(); if (tempPosition->IsLink()) { if (sibling && sibling->IsLink()) { HyperTextAccessible* siblingText = sibling->AsHyperText(); tempStart = tempEnd = siblingText ? siblingText->CharacterCount() : -1; tempPosition = sibling; } else { tempStart = tempPosition->StartOffset(); @@ -499,17 +502,17 @@ Accessible* Pivot::PrevText(Accessible* } text->TextAtOffset(tempStart, endBoundary, &newStart, &potentialEnd, unusedText); tempEnd = potentialEnd < tempEnd ? potentialEnd : currentStart; // The offset range we've obtained might have embedded characters in it, // limit the range to the start of the last occurrence of an embedded // character. - Accessible* childAtOffset = nullptr; + LocalAccessible* childAtOffset = nullptr; for (int32_t i = tempEnd - 1; i >= tempStart; i--) { childAtOffset = text->GetChildAtOffset(i); if (childAtOffset && !childAtOffset->IsText()) { tempStart = childAtOffset->EndOffset(); break; } } // If there's an embedded character at the very end of the range, we @@ -528,17 +531,17 @@ Accessible* Pivot::PrevText(Accessible* MOZ_ASSERT(tempPosition); return tempPosition; } } AccessibleOrProxy Pivot::AtPoint(int32_t aX, int32_t aY, PivotRule& aRule) { AccessibleOrProxy match = AccessibleOrProxy(); AccessibleOrProxy child = - mRoot.ChildAtPoint(aX, aY, Accessible::eDeepestChild); + mRoot.ChildAtPoint(aX, aY, LocalAccessible::eDeepestChild); while (!child.IsNull() && (mRoot != child)) { uint16_t filtered = aRule.Match(child); // Ignore any matching nodes that were below this one if (filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) { match = AccessibleOrProxy(); } @@ -594,17 +597,17 @@ uint16_t PivotRoleRule::Match(const Acce } return result; } // LocalAccInSameDocRule uint16_t LocalAccInSameDocRule::Match(const AccessibleOrProxy& aAccOrProxy) { - Accessible* acc = aAccOrProxy.AsAccessible(); + LocalAccessible* acc = aAccOrProxy.AsAccessible(); if (!acc) { return nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE; } if (acc->IsOuterDoc()) { return nsIAccessibleTraversalRule::FILTER_MATCH | nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE; } return nsIAccessibleTraversalRule::FILTER_MATCH;
--- a/accessible/base/Pivot.h +++ b/accessible/base/Pivot.h @@ -9,17 +9,17 @@ #include <stdint.h> #include "Role.h" #include "mozilla/dom/ChildIterator.h" #include "AccessibleOrProxy.h" namespace mozilla { namespace a11y { -class Accessible; +class LocalAccessible; class HyperTextAccessible; class DocAccessible; class PivotRule { public: // A filtering function that returns a bitmask from // nsIAccessibleTraversalRule: FILTER_IGNORE (0x0): Don't match this // accessible. FILTER_MATCH (0x1): Match this accessible FILTER_IGNORE_SUBTREE @@ -51,22 +51,22 @@ class Pivot final { // Return the first accessible within the root that matches the pivot rule. AccessibleOrProxy First(PivotRule& aRule); // Return the last accessible within the root that matches the pivot rule. AccessibleOrProxy Last(PivotRule& aRule); // Return the next range of text according to the boundary type. - Accessible* NextText(Accessible* aAnchor, int32_t* aStartOffset, - int32_t* aEndOffset, int32_t aBoundaryType); + LocalAccessible* NextText(LocalAccessible* aAnchor, int32_t* aStartOffset, + int32_t* aEndOffset, int32_t aBoundaryType); // Return the previous range of text according to the boundary type. - Accessible* PrevText(Accessible* aAnchor, int32_t* aStartOffset, - int32_t* aEndOffset, int32_t aBoundaryType); + LocalAccessible* PrevText(LocalAccessible* aAnchor, int32_t* aStartOffset, + int32_t* aEndOffset, int32_t aBoundaryType); // Return the accessible at the given screen coordinate if it matches the // pivot rule. AccessibleOrProxy AtPoint(int32_t aX, int32_t aY, PivotRule& aRule); private: AccessibleOrProxy AdjustStartPosition(AccessibleOrProxy& aAnchor, PivotRule& aRule, @@ -76,17 +76,17 @@ class Pivot final { AccessibleOrProxy SearchForward(AccessibleOrProxy& aAnchor, PivotRule& aRule, bool aSearchCurrent); // Reverse search in preorder for the first accessible to match the rule. AccessibleOrProxy SearchBackward(AccessibleOrProxy& aAnchor, PivotRule& aRule, bool aSearchCurrent); // Search in preorder for the first text accessible. - HyperTextAccessible* SearchForText(Accessible* aAnchor, bool aBackward); + HyperTextAccessible* SearchForText(LocalAccessible* aAnchor, bool aBackward); AccessibleOrProxy mRoot; }; /** * This rule matches accessibles on a given role, filtering out non-direct * descendants if necessary. */ @@ -98,17 +98,17 @@ class PivotRoleRule : public PivotRule { virtual uint16_t Match(const AccessibleOrProxy& aAccOrProxy) override; protected: role mRole; AccessibleOrProxy mDirectDescendantsFrom; }; /** - * This rule matches any local Accessible (i.e. not ProxyAccessible) in the + * This rule matches any local LocalAccessible (i.e. not ProxyAccessible) in the * same document as the anchor. That is, it includes any descendant * OuterDocAccessible, but not its descendants. */ class LocalAccInSameDocRule : public PivotRule { public: virtual uint16_t Match(const AccessibleOrProxy& aAccOrProxy) override; };
--- a/accessible/base/Relation.h +++ b/accessible/base/Relation.h @@ -19,17 +19,17 @@ namespace a11y { * lazily while enumerating. */ class Relation { public: Relation() : mFirstIter(nullptr), mLastIter(nullptr) {} explicit Relation(AccIterable* aIter) : mFirstIter(aIter), mLastIter(aIter) {} - explicit Relation(Accessible* aAcc) + explicit Relation(LocalAccessible* aAcc) : mFirstIter(nullptr), mLastIter(nullptr) { AppendTarget(aAcc); } Relation(DocAccessible* aDocument, nsIContent* aContent) : mFirstIter(nullptr), mLastIter(nullptr) { AppendTarget(aDocument, aContent); } @@ -54,33 +54,33 @@ class Relation { } mLastIter = aIter; } /** * Append the given accessible to the set of related accessibles. */ - inline void AppendTarget(Accessible* aAcc) { + inline void AppendTarget(LocalAccessible* aAcc) { if (aAcc) AppendIter(new SingleAccIterator(aAcc)); } /** * Append the one accessible for this content node to the set of related * accessibles. */ void AppendTarget(DocAccessible* aDocument, nsIContent* aContent) { if (aContent) AppendTarget(aDocument->GetAccessible(aContent)); } /** * compute and return the next related accessible. */ - inline Accessible* Next() { - Accessible* target = nullptr; + inline LocalAccessible* Next() { + LocalAccessible* target = nullptr; while (mFirstIter && !(target = mFirstIter->Next())) { mFirstIter = std::move(mFirstIter->mNextIter); } if (!mFirstIter) mLastIter = nullptr; return target;
--- a/accessible/base/TextAttrs.cpp +++ b/accessible/base/TextAttrs.cpp @@ -1,16 +1,16 @@ /* -*- 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 "TextAttrs.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "nsAccUtils.h" #include "nsCoreUtils.h" #include "StyleInfo.h" #include "gfxTextRun.h" #include "nsFontMetrics.h" #include "nsLayoutUtils.h" #include "nsContainerFrame.h" @@ -39,26 +39,26 @@ void TextAttrsMgr::GetAttributes(nsIPers ((mOffsetAcc && mOffsetAccIdx != -1 && aStartOffset && aEndOffset) || (!mOffsetAcc && mOffsetAccIdx == -1 && !aStartOffset && !aEndOffset && mIncludeDefAttrs && aAttributes)), "Wrong usage of TextAttrsMgr!"); // Embedded objects are combined into own range with empty attributes set. if (mOffsetAcc && !mOffsetAcc->IsText()) { for (int32_t childIdx = mOffsetAccIdx - 1; childIdx >= 0; childIdx--) { - Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); + LocalAccessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); if (currAcc->IsText()) break; (*aStartOffset)--; } uint32_t childCount = mHyperTextAcc->ChildCount(); for (uint32_t childIdx = mOffsetAccIdx + 1; childIdx < childCount; childIdx++) { - Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); + LocalAccessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); if (currAcc->IsText()) break; (*aEndOffset)++; } return; } @@ -135,17 +135,17 @@ void TextAttrsMgr::GetAttributes(nsIPers GetRange(attrArray, ArrayLength(attrArray), aStartOffset, aEndOffset); } } void TextAttrsMgr::GetRange(TextAttr* aAttrArray[], uint32_t aAttrArrayLen, uint32_t* aStartOffset, uint32_t* aEndOffset) { // Navigate backward from anchor accessible to find start offset. for (int32_t childIdx = mOffsetAccIdx - 1; childIdx >= 0; childIdx--) { - Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); + LocalAccessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); // Stop on embedded accessible since embedded accessibles are combined into // own range. if (!currAcc->IsText()) break; MOZ_ASSERT(nsCoreUtils::GetDOMElementFor(currAcc->GetContent()), "Text accessible has to have an associated DOM element"); @@ -161,17 +161,17 @@ void TextAttrsMgr::GetRange(TextAttr* aA if (offsetFound) break; *(aStartOffset) -= nsAccUtils::TextLength(currAcc); } // Navigate forward from anchor accessible to find end offset. uint32_t childLen = mHyperTextAcc->ChildCount(); for (uint32_t childIdx = mOffsetAccIdx + 1; childIdx < childLen; childIdx++) { - Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); + LocalAccessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx); if (!currAcc->IsText()) break; MOZ_ASSERT(nsCoreUtils::GetDOMElementFor(currAcc->GetContent()), "Text accessible has to have an associated DOM element"); bool offsetFound = false; for (uint32_t attrIdx = 0; attrIdx < aAttrArrayLen; attrIdx++) { TextAttr* textAttr = aAttrArray[attrIdx]; @@ -203,17 +203,17 @@ TextAttrsMgr::LangTextAttr::LangTextAttr if (aElm) { nsCoreUtils::GetLanguageFor(aElm, mRootContent, mNativeValue); mIsDefined = !mNativeValue.IsEmpty(); } } TextAttrsMgr::LangTextAttr::~LangTextAttr() {} -bool TextAttrsMgr::LangTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::LangTextAttr::GetValueFor(LocalAccessible* aAccessible, nsString* aValue) { nsCoreUtils::GetLanguageFor(aAccessible->GetContent(), mRootContent, *aValue); return !aValue->IsEmpty(); } void TextAttrsMgr::LangTextAttr::ExposeValue( nsIPersistentProperties* aAttributes, const nsString& aValue) { nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::language, aValue); @@ -225,17 +225,17 @@ void TextAttrsMgr::LangTextAttr::ExposeV TextAttrsMgr::InvalidTextAttr::InvalidTextAttr(nsIContent* aRootElm, nsIContent* aElm) : TTextAttr<uint32_t>(!aElm), mRootElm(aRootElm) { mIsRootDefined = GetValue(mRootElm, &mRootNativeValue); if (aElm) mIsDefined = GetValue(aElm, &mNativeValue); } -bool TextAttrsMgr::InvalidTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::InvalidTextAttr::GetValueFor(LocalAccessible* aAccessible, uint32_t* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); return elm ? GetValue(elm, aValue) : false; } void TextAttrsMgr::InvalidTextAttr::ExposeValue( nsIPersistentProperties* aAttributes, const uint32_t& aValue) { switch (aValue) { @@ -293,17 +293,17 @@ bool TextAttrsMgr::InvalidTextAttr::GetV TextAttrsMgr::BGColorTextAttr::BGColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame) : TTextAttr<nscolor>(!aFrame), mRootFrame(aRootFrame) { mIsRootDefined = GetColor(mRootFrame, &mRootNativeValue); if (aFrame) mIsDefined = GetColor(aFrame, &mNativeValue); } -bool TextAttrsMgr::BGColorTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::BGColorTextAttr::GetValueFor(LocalAccessible* aAccessible, nscolor* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { return GetColor(frame, aValue); } } @@ -351,17 +351,17 @@ TextAttrsMgr::ColorTextAttr::ColorTextAt mIsRootDefined = true; if (aFrame) { mNativeValue = aFrame->StyleText()->mColor.ToColor(); mIsDefined = true; } } -bool TextAttrsMgr::ColorTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::ColorTextAttr::GetValueFor(LocalAccessible* aAccessible, nscolor* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { if (nsIFrame* frame = elm->GetPrimaryFrame()) { *aValue = frame->StyleText()->mColor.ToColor(); return true; } } @@ -382,17 +382,17 @@ void TextAttrsMgr::ColorTextAttr::Expose TextAttrsMgr::FontFamilyTextAttr::FontFamilyTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame) : TTextAttr<nsString>(!aFrame) { mIsRootDefined = GetFontFamily(aRootFrame, mRootNativeValue); if (aFrame) mIsDefined = GetFontFamily(aFrame, mNativeValue); } -bool TextAttrsMgr::FontFamilyTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::FontFamilyTextAttr::GetValueFor(LocalAccessible* aAccessible, nsString* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { return GetFontFamily(frame, *aValue); } } @@ -429,17 +429,17 @@ TextAttrsMgr::FontSizeTextAttr::FontSize mIsRootDefined = true; if (aFrame) { mNativeValue = aFrame->StyleFont()->mSize.ToAppUnits(); mIsDefined = true; } } -bool TextAttrsMgr::FontSizeTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::FontSizeTextAttr::GetValueFor(LocalAccessible* aAccessible, nscoord* aValue) { nsIContent* el = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (el) { nsIFrame* frame = el->GetPrimaryFrame(); if (frame) { *aValue = frame->StyleFont()->mSize.ToAppUnits(); return true; } @@ -479,17 +479,17 @@ TextAttrsMgr::FontStyleTextAttr::FontSty mIsRootDefined = true; if (aFrame) { mNativeValue = aFrame->StyleFont()->mFont.style; mIsDefined = true; } } -bool TextAttrsMgr::FontStyleTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::FontStyleTextAttr::GetValueFor(LocalAccessible* aAccessible, FontSlantStyle* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = frame->StyleFont()->mFont.style; return true; } @@ -515,17 +515,17 @@ TextAttrsMgr::FontWeightTextAttr::FontWe mIsRootDefined = true; if (aFrame) { mNativeValue = GetFontWeight(aFrame); mIsDefined = true; } } -bool TextAttrsMgr::FontWeightTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::FontWeightTextAttr::GetValueFor(LocalAccessible* aAccessible, FontWeight* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = GetFontWeight(frame); return true; } @@ -569,30 +569,30 @@ FontWeight TextAttrsMgr::FontWeightTextA gfxFontEntry* fontEntry = font->GetFontEntry(); return fontEntry->Weight().Clamp(font->GetStyle()->weight); } //////////////////////////////////////////////////////////////////////////////// // AutoGeneratedTextAttr //////////////////////////////////////////////////////////////////////////////// TextAttrsMgr::AutoGeneratedTextAttr::AutoGeneratedTextAttr( - HyperTextAccessible* aHyperTextAcc, Accessible* aAccessible) + HyperTextAccessible* aHyperTextAcc, LocalAccessible* aAccessible) : TTextAttr<bool>(!aAccessible) { mRootNativeValue = false; mIsRootDefined = false; if (aAccessible) { mIsDefined = mNativeValue = ((aAccessible->NativeRole() == roles::STATICTEXT) || (aAccessible->NativeRole() == roles::LISTITEM_MARKER)); } } -bool TextAttrsMgr::AutoGeneratedTextAttr::GetValueFor(Accessible* aAccessible, - bool* aValue) { +bool TextAttrsMgr::AutoGeneratedTextAttr::GetValueFor( + LocalAccessible* aAccessible, bool* aValue) { return *aValue = (aAccessible->NativeRole() == roles::STATICTEXT); } void TextAttrsMgr::AutoGeneratedTextAttr::ExposeValue( nsIPersistentProperties* aAttributes, const bool& aValue) { nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::auto_generated, aValue ? u"true"_ns : u"false"_ns); } @@ -617,17 +617,17 @@ TextAttrsMgr::TextDecorTextAttr::TextDec mIsRootDefined = mRootNativeValue.IsDefined(); if (aFrame) { mNativeValue = TextDecorValue(aFrame); mIsDefined = mNativeValue.IsDefined(); } } -bool TextAttrsMgr::TextDecorTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::TextDecorTextAttr::GetValueFor(LocalAccessible* aAccessible, TextDecorValue* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = TextDecorValue(frame); return aValue->IsDefined(); } @@ -674,17 +674,17 @@ TextAttrsMgr::TextPosTextAttr::TextPosTe mIsRootDefined = mRootNativeValue != eTextPosNone; if (aFrame) { mNativeValue = GetTextPosValue(aFrame); mIsDefined = mNativeValue != eTextPosNone; } } -bool TextAttrsMgr::TextPosTextAttr::GetValueFor(Accessible* aAccessible, +bool TextAttrsMgr::TextPosTextAttr::GetValueFor(LocalAccessible* aAccessible, TextPosValue* aValue) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent()); if (elm) { nsIFrame* frame = elm->GetPrimaryFrame(); if (frame) { *aValue = GetTextPosValue(frame); return *aValue != eTextPosNone; }
--- a/accessible/base/TextAttrs.h +++ b/accessible/base/TextAttrs.h @@ -15,17 +15,17 @@ class nsIFrame; class nsIPersistentProperties; class nsIContent; class nsDeviceContext; namespace mozilla { namespace a11y { -class Accessible; +class LocalAccessible; class HyperTextAccessible; /** * Used to expose text attributes for the hyper text accessible (see * HyperTextAccessible class). * * @note "invalid: spelling" text attribute is implemented entirely in * HyperTextAccessible class. @@ -49,17 +49,17 @@ class TextAttrsMgr { * @param aIncludeDefAttrs [optional] indicates whether default text * attributes should be included into list of exposed * text attributes * @param oOffsetAcc [optional] offset an accessible the text attributes * should be calculated for * @param oOffsetAccIdx [optional] index in parent of offset accessible */ TextAttrsMgr(HyperTextAccessible* aHyperTextAcc, bool aIncludeDefAttrs, - Accessible* aOffsetAcc, int32_t aOffsetAccIdx) + LocalAccessible* aOffsetAcc, int32_t aOffsetAccIdx) : mOffsetAcc(aOffsetAcc), mHyperTextAcc(aHyperTextAcc), mOffsetAccIdx(aOffsetAccIdx), mIncludeDefAttrs(aIncludeDefAttrs) {} /* * Return text attributes and hyper text offsets where these attributes are * applied. Offsets are calculated in the case of non default attributes. @@ -86,17 +86,17 @@ class TextAttrsMgr { * @param aStartHTOffset [in, out] the start offset * @param aEndHTOffset [in, out] the end offset */ class TextAttr; void GetRange(TextAttr* aAttrArray[], uint32_t aAttrArrayLen, uint32_t* aStartOffset, uint32_t* aEndOffset); private: - Accessible* mOffsetAcc; + LocalAccessible* mOffsetAcc; HyperTextAccessible* mHyperTextAcc; int32_t mOffsetAccIdx; bool mIncludeDefAttrs; protected: /** * Interface class of text attribute class implementations. */ @@ -111,17 +111,17 @@ class TextAttrsMgr { */ virtual void Expose(nsIPersistentProperties* aAttributes, bool aIncludeDefAttrValue) = 0; /** * Return true if the text attribute value on the given element equals with * predefined attribute value. */ - virtual bool Equal(Accessible* aAccessible) = 0; + virtual bool Equal(LocalAccessible* aAccessible) = 0; }; /** * Base class to work with text attributes. See derived classes below. */ template <class T> class TTextAttr : public TextAttr { public: @@ -142,17 +142,17 @@ class TextAttrsMgr { return; } if (aIncludeDefAttrValue && mIsRootDefined) { ExposeValue(aAttributes, mRootNativeValue); } } - virtual bool Equal(Accessible* aAccessible) override { + virtual bool Equal(LocalAccessible* aAccessible) override { T nativeValue; bool isDefined = GetValueFor(aAccessible, &nativeValue); if (!mIsDefined && !isDefined) return true; if (mIsDefined && isDefined) return nativeValue == mNativeValue; if (mIsDefined) return mNativeValue == mRootNativeValue; @@ -161,17 +161,17 @@ class TextAttrsMgr { } protected: // Expose the text attribute with the given value to attribute set. virtual void ExposeValue(nsIPersistentProperties* aAttributes, const T& aValue) = 0; // Return native value for the given DOM element. - virtual bool GetValueFor(Accessible* aAccessible, T* aValue) = 0; + virtual bool GetValueFor(LocalAccessible* aAccessible, T* aValue) = 0; // Indicates if root value should be exposed. bool mGetRootValue; // Native value and flag indicating if the value is defined (initialized in // derived classes). Note, undefined native value means it is inherited // from root. MOZ_INIT_OUTSIDE_CTOR T mNativeValue; @@ -189,17 +189,17 @@ class TextAttrsMgr { class LangTextAttr : public TTextAttr<nsString> { public: LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm, nsIContent* aElm); virtual ~LangTextAttr(); protected: // TextAttr - virtual bool GetValueFor(Accessible* aAccessible, + virtual bool GetValueFor(LocalAccessible* aAccessible, nsString* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue) override; private: nsCOMPtr<nsIContent> mRootContent; }; @@ -213,17 +213,17 @@ class TextAttrsMgr { public: InvalidTextAttr(nsIContent* aRootElm, nsIContent* aElm); virtual ~InvalidTextAttr(){}; protected: enum { eFalse, eGrammar, eSpelling, eTrue }; // TextAttr - virtual bool GetValueFor(Accessible* aAccessible, + virtual bool GetValueFor(LocalAccessible* aAccessible, uint32_t* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const uint32_t& aValue) override; private: bool GetValue(nsIContent* aElm, uint32_t* aValue); nsIContent* mRootElm; }; @@ -233,17 +233,18 @@ class TextAttrsMgr { */ class BGColorTextAttr : public TTextAttr<nscolor> { public: BGColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~BGColorTextAttr() {} protected: // TextAttr - virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue) override; + virtual bool GetValueFor(LocalAccessible* aAccessible, + nscolor* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscolor& aValue) override; private: bool GetColor(nsIFrame* aFrame, nscolor* aColor); nsIFrame* mRootFrame; }; @@ -252,32 +253,33 @@ class TextAttrsMgr { */ class ColorTextAttr : public TTextAttr<nscolor> { public: ColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~ColorTextAttr() {} protected: // TTextAttr - virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue) override; + virtual bool GetValueFor(LocalAccessible* aAccessible, + nscolor* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscolor& aValue) override; }; /** * Class is used for the work with "font-family" text attribute. */ class FontFamilyTextAttr : public TTextAttr<nsString> { public: FontFamilyTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontFamilyTextAttr() {} protected: // TTextAttr - virtual bool GetValueFor(Accessible* aAccessible, + virtual bool GetValueFor(LocalAccessible* aAccessible, nsString* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nsString& aValue) override; private: bool GetFontFamily(nsIFrame* aFrame, nsString& aFamily); }; @@ -286,17 +288,18 @@ class TextAttrsMgr { */ class FontSizeTextAttr : public TTextAttr<nscoord> { public: FontSizeTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontSizeTextAttr() {} protected: // TTextAttr - virtual bool GetValueFor(Accessible* aAccessible, nscoord* aValue) override; + virtual bool GetValueFor(LocalAccessible* aAccessible, + nscoord* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const nscoord& aValue) override; private: nsDeviceContext* mDC; }; /** @@ -304,53 +307,54 @@ class TextAttrsMgr { */ class FontStyleTextAttr : public TTextAttr<mozilla::FontSlantStyle> { public: FontStyleTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontStyleTextAttr() {} protected: // TTextAttr - virtual bool GetValueFor(Accessible* aContent, + virtual bool GetValueFor(LocalAccessible* aContent, mozilla::FontSlantStyle* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const mozilla::FontSlantStyle& aValue) override; }; /** * Class is used for the work with "font-weight" text attribute. */ class FontWeightTextAttr : public TTextAttr<mozilla::FontWeight> { public: FontWeightTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~FontWeightTextAttr() {} protected: // TTextAttr - virtual bool GetValueFor(Accessible* aAccessible, + virtual bool GetValueFor(LocalAccessible* aAccessible, mozilla::FontWeight* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const mozilla::FontWeight& aValue) override; private: mozilla::FontWeight GetFontWeight(nsIFrame* aFrame); }; /** * Class is used for the work with 'auto-generated' text attribute. */ class AutoGeneratedTextAttr : public TTextAttr<bool> { public: AutoGeneratedTextAttr(HyperTextAccessible* aHyperTextAcc, - Accessible* aAccessible); + LocalAccessible* aAccessible); virtual ~AutoGeneratedTextAttr() {} protected: // TextAttr - virtual bool GetValueFor(Accessible* aAccessible, bool* aValue) override; + virtual bool GetValueFor(LocalAccessible* aAccessible, + bool* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const bool& aValue) override; }; /** * TextDecorTextAttr class is used for the work with * "text-line-through-style", "text-line-through-color", * "text-underline-style" and "text-underline-color" text attributes. @@ -389,17 +393,17 @@ class TextAttrsMgr { class TextDecorTextAttr : public TTextAttr<TextDecorValue> { public: TextDecorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~TextDecorTextAttr() {} protected: // TextAttr - virtual bool GetValueFor(Accessible* aAccessible, + virtual bool GetValueFor(LocalAccessible* aAccessible, TextDecorValue* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const TextDecorValue& aValue) override; }; /** * Class is used for the work with "text-position" text attribute. */ @@ -413,17 +417,17 @@ class TextAttrsMgr { class TextPosTextAttr : public TTextAttr<TextPosValue> { public: TextPosTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame); virtual ~TextPosTextAttr() {} protected: // TextAttr - virtual bool GetValueFor(Accessible* aAccessible, + virtual bool GetValueFor(LocalAccessible* aAccessible, TextPosValue* aValue) override; virtual void ExposeValue(nsIPersistentProperties* aAttributes, const TextPosValue& aValue) override; private: TextPosValue GetTextPosValue(nsIFrame* aFrame) const; };
--- a/accessible/base/TextRange-inl.h +++ b/accessible/base/TextRange-inl.h @@ -8,19 +8,19 @@ #define mozilla_a11y_TextRange_inl_h__ #include "TextRange.h" #include "HyperTextAccessible.h" namespace mozilla { namespace a11y { -inline Accessible* TextRange::Container() const { +inline LocalAccessible* TextRange::Container() const { uint32_t pos1 = 0, pos2 = 0; - AutoTArray<Accessible*, 30> parents1, parents2; + AutoTArray<LocalAccessible*, 30> parents1, parents2; return CommonParent(mStartContainer, mEndContainer, &parents1, &pos1, &parents2, &pos2); } } // namespace a11y } // namespace mozilla #endif
--- a/accessible/base/TextRange.cpp +++ b/accessible/base/TextRange.cpp @@ -1,69 +1,69 @@ /* -*- 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 "TextRange-inl.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "HyperTextAccessible-inl.h" #include "mozilla/dom/Selection.h" #include "nsAccUtils.h" namespace mozilla { namespace a11y { //////////////////////////////////////////////////////////////////////////////// // TextPoint bool TextPoint::operator<(const TextPoint& aPoint) const { if (mContainer == aPoint.mContainer) return mOffset < aPoint.mOffset; // Build the chain of parents - Accessible* p1 = mContainer; - Accessible* p2 = aPoint.mContainer; - AutoTArray<Accessible*, 30> parents1, parents2; + LocalAccessible* p1 = mContainer; + LocalAccessible* p2 = aPoint.mContainer; + AutoTArray<LocalAccessible*, 30> parents1, parents2; do { parents1.AppendElement(p1); p1 = p1->LocalParent(); } while (p1); do { parents2.AppendElement(p2); p2 = p2->LocalParent(); } while (p2); // Find where the parent chain differs uint32_t pos1 = parents1.Length(), pos2 = parents2.Length(); for (uint32_t len = std::min(pos1, pos2); len > 0; --len) { - Accessible* child1 = parents1.ElementAt(--pos1); - Accessible* child2 = parents2.ElementAt(--pos2); + LocalAccessible* child1 = parents1.ElementAt(--pos1); + LocalAccessible* child2 = parents2.ElementAt(--pos2); if (child1 != child2) { return child1->IndexInParent() < child2->IndexInParent(); } } if (pos1 != 0) { // If parents1 is a superset of parents2 then mContainer is a // descendant of aPoint.mContainer. The next element down in parents1 // is mContainer's ancestor that is the child of aPoint.mContainer. // We compare its end offset in aPoint.mContainer with aPoint.mOffset. - Accessible* child = parents1.ElementAt(pos1 - 1); + LocalAccessible* child = parents1.ElementAt(pos1 - 1); MOZ_ASSERT(child->LocalParent() == aPoint.mContainer); return child->EndOffset() < static_cast<uint32_t>(aPoint.mOffset); } if (pos2 != 0) { // If parents2 is a superset of parents1 then aPoint.mContainer is a // descendant of mContainer. The next element down in parents2 // is aPoint.mContainer's ancestor that is the child of mContainer. // We compare its start offset in mContainer with mOffset. - Accessible* child = parents2.ElementAt(pos2 - 1); + LocalAccessible* child = parents2.ElementAt(pos2 - 1); MOZ_ASSERT(child->LocalParent() == mContainer); return static_cast<uint32_t>(mOffset) < child->StartOffset(); } NS_ERROR("Broken tree?!"); return false; } @@ -74,110 +74,110 @@ TextRange::TextRange(HyperTextAccessible HyperTextAccessible* aStartContainer, int32_t aStartOffset, HyperTextAccessible* aEndContainer, int32_t aEndOffset) : mRoot(aRoot), mStartContainer(aStartContainer), mEndContainer(aEndContainer), mStartOffset(aStartOffset), mEndOffset(aEndOffset) {} -void TextRange::EmbeddedChildren(nsTArray<Accessible*>* aChildren) const { +void TextRange::EmbeddedChildren(nsTArray<LocalAccessible*>* aChildren) const { if (mStartContainer == mEndContainer) { int32_t startIdx = mStartContainer->GetChildIndexAtOffset(mStartOffset); int32_t endIdx = mStartContainer->GetChildIndexAtOffset(mEndOffset); for (int32_t idx = startIdx; idx <= endIdx; idx++) { - Accessible* child = mStartContainer->LocalChildAt(idx); + LocalAccessible* child = mStartContainer->LocalChildAt(idx); if (!child->IsText()) { aChildren->AppendElement(child); } } return; } - Accessible* p1 = mStartContainer->GetChildAtOffset(mStartOffset); - Accessible* p2 = mEndContainer->GetChildAtOffset(mEndOffset); + LocalAccessible* p1 = mStartContainer->GetChildAtOffset(mStartOffset); + LocalAccessible* p2 = mEndContainer->GetChildAtOffset(mEndOffset); uint32_t pos1 = 0, pos2 = 0; - AutoTArray<Accessible*, 30> parents1, parents2; - Accessible* container = + AutoTArray<LocalAccessible*, 30> parents1, parents2; + LocalAccessible* container = CommonParent(p1, p2, &parents1, &pos1, &parents2, &pos2); // Traverse the tree up to the container and collect embedded objects. for (uint32_t idx = 0; idx < pos1 - 1; idx++) { - Accessible* parent = parents1[idx + 1]; - Accessible* child = parents1[idx]; + LocalAccessible* parent = parents1[idx + 1]; + LocalAccessible* child = parents1[idx]; uint32_t childCount = parent->ChildCount(); for (uint32_t childIdx = child->IndexInParent(); childIdx < childCount; childIdx++) { - Accessible* next = parent->LocalChildAt(childIdx); + LocalAccessible* next = parent->LocalChildAt(childIdx); if (!next->IsText()) { aChildren->AppendElement(next); } } } // Traverse through direct children in the container. int32_t endIdx = parents2[pos2 - 1]->IndexInParent(); int32_t childIdx = parents1[pos1 - 1]->IndexInParent() + 1; for (; childIdx < endIdx; childIdx++) { - Accessible* next = container->LocalChildAt(childIdx); + LocalAccessible* next = container->LocalChildAt(childIdx); if (!next->IsText()) { aChildren->AppendElement(next); } } // Traverse down from the container to end point. for (int32_t idx = pos2 - 2; idx > 0; idx--) { - Accessible* parent = parents2[idx]; - Accessible* child = parents2[idx - 1]; + LocalAccessible* parent = parents2[idx]; + LocalAccessible* child = parents2[idx - 1]; int32_t endIdx = child->IndexInParent(); for (int32_t childIdx = 0; childIdx < endIdx; childIdx++) { - Accessible* next = parent->LocalChildAt(childIdx); + LocalAccessible* next = parent->LocalChildAt(childIdx); if (!next->IsText()) { aChildren->AppendElement(next); } } } } void TextRange::Text(nsAString& aText) const { - Accessible* current = mStartContainer->GetChildAtOffset(mStartOffset); + LocalAccessible* current = mStartContainer->GetChildAtOffset(mStartOffset); uint32_t startIntlOffset = mStartOffset - mStartContainer->GetChildOffset(current); while (current && TextInternal(aText, current, startIntlOffset)) { current = current->LocalParent(); if (!current) break; current = current->LocalNextSibling(); } } void TextRange::Bounds(nsTArray<nsIntRect> aRects) const {} void TextRange::Normalize(ETextUnit aUnit) {} -bool TextRange::Crop(Accessible* aContainer) { +bool TextRange::Crop(LocalAccessible* aContainer) { uint32_t boundaryPos = 0, containerPos = 0; - AutoTArray<Accessible*, 30> boundaryParents, containerParents; + AutoTArray<LocalAccessible*, 30> boundaryParents, containerParents; // Crop the start boundary. - Accessible* container = nullptr; - Accessible* boundary = mStartContainer->GetChildAtOffset(mStartOffset); + LocalAccessible* container = nullptr; + LocalAccessible* boundary = mStartContainer->GetChildAtOffset(mStartOffset); if (boundary != aContainer) { CommonParent(boundary, aContainer, &boundaryParents, &boundaryPos, &containerParents, &containerPos); if (boundaryPos == 0) { if (containerPos != 0) { // The container is contained by the start boundary, reduce the range to // the point starting at the container. aContainer->ToTextPoint(mStartContainer.StartAssignment(), &mStartOffset); - static_cast<Accessible*>(mStartContainer)->AddRef(); + static_cast<LocalAccessible*>(mStartContainer)->AddRef(); } else { // The start boundary and the container are siblings. container = aContainer; } } else if (containerPos != 0) { // The container does not contain the start boundary. boundary = boundaryParents[boundaryPos]; container = containerParents[containerPos]; @@ -211,17 +211,17 @@ bool TextRange::Crop(Accessible* aContai container = nullptr; CommonParent(boundary, aContainer, &boundaryParents, &boundaryPos, &containerParents, &containerPos); if (boundaryPos == 0) { if (containerPos != 0) { aContainer->ToTextPoint(mEndContainer.StartAssignment(), &mEndOffset, false); - static_cast<Accessible*>(mEndContainer)->AddRef(); + static_cast<LocalAccessible*>(mEndContainer)->AddRef(); } else { container = aContainer; } } else if (containerPos != 0) { boundary = boundaryParents[boundaryPos]; container = containerParents[containerPos]; } @@ -230,17 +230,17 @@ bool TextRange::Crop(Accessible* aContai } if (boundary->IndexInParent() < container->IndexInParent()) { return !!(mRoot = nullptr); } if (boundary->IndexInParent() > container->IndexInParent()) { container->ToTextPoint(mEndContainer.StartAssignment(), &mEndOffset, false); - static_cast<Accessible*>(mEndContainer)->AddRef(); + static_cast<LocalAccessible*>(mEndContainer)->AddRef(); } return true; } void TextRange::FindText(const nsAString& aText, EDirection aDirection, nsCaseTreatment aCaseSensitive, TextRange* aFoundRange) const {} @@ -433,17 +433,17 @@ void TextRange::Set(HyperTextAccessible* HyperTextAccessible* aEndContainer, int32_t aEndOffset) { mRoot = aRoot; mStartContainer = aStartContainer; mEndContainer = aEndContainer; mStartOffset = aStartOffset; mEndOffset = aEndOffset; } -bool TextRange::TextInternal(nsAString& aText, Accessible* aCurrent, +bool TextRange::TextInternal(nsAString& aText, LocalAccessible* aCurrent, uint32_t aStartIntlOffset) const { bool moveNext = true; int32_t endIntlOffset = -1; if (aCurrent->LocalParent() == mEndContainer && mEndContainer->GetChildAtOffset(mEndOffset) == aCurrent) { uint32_t currentStartOffset = mEndContainer->GetChildOffset(aCurrent); endIntlOffset = mEndOffset - currentStartOffset; if (endIntlOffset == 0) return false; @@ -452,17 +452,17 @@ bool TextRange::TextInternal(nsAString& } if (aCurrent->IsTextLeaf()) { aCurrent->AppendTextTo(aText, aStartIntlOffset, endIntlOffset - aStartIntlOffset); if (!moveNext) return false; } - Accessible* next = aCurrent->LocalFirstChild(); + LocalAccessible* next = aCurrent->LocalFirstChild(); if (next) { if (!TextInternal(aText, next, 0)) return false; } next = aCurrent->LocalNextSibling(); if (next) { if (!TextInternal(aText, next, 0)) return false; } @@ -470,48 +470,49 @@ bool TextRange::TextInternal(nsAString& return moveNext; } void TextRange::MoveInternal(ETextUnit aUnit, int32_t aCount, HyperTextAccessible& aContainer, int32_t aOffset, HyperTextAccessible* aStopContainer, int32_t aStopOffset) {} -Accessible* TextRange::CommonParent(Accessible* aAcc1, Accessible* aAcc2, - nsTArray<Accessible*>* aParents1, - uint32_t* aPos1, - nsTArray<Accessible*>* aParents2, - uint32_t* aPos2) const { +LocalAccessible* TextRange::CommonParent(LocalAccessible* aAcc1, + LocalAccessible* aAcc2, + nsTArray<LocalAccessible*>* aParents1, + uint32_t* aPos1, + nsTArray<LocalAccessible*>* aParents2, + uint32_t* aPos2) const { if (aAcc1 == aAcc2) { return aAcc1; } MOZ_ASSERT(aParents1->Length() == 0 || aParents2->Length() == 0, "Wrong arguments"); // Build the chain of parents. - Accessible* p1 = aAcc1; - Accessible* p2 = aAcc2; + LocalAccessible* p1 = aAcc1; + LocalAccessible* p2 = aAcc2; do { aParents1->AppendElement(p1); p1 = p1->LocalParent(); } while (p1); do { aParents2->AppendElement(p2); p2 = p2->LocalParent(); } while (p2); // Find where the parent chain differs *aPos1 = aParents1->Length(); *aPos2 = aParents2->Length(); - Accessible* parent = nullptr; + LocalAccessible* parent = nullptr; uint32_t len = 0; for (len = std::min(*aPos1, *aPos2); len > 0; --len) { - Accessible* child1 = aParents1->ElementAt(--(*aPos1)); - Accessible* child2 = aParents2->ElementAt(--(*aPos2)); + LocalAccessible* child1 = aParents1->ElementAt(--(*aPos1)); + LocalAccessible* child2 = aParents2->ElementAt(--(*aPos2)); if (child1 != child2) break; parent = child1; } return parent; }
--- a/accessible/base/TextRange.h +++ b/accessible/base/TextRange.h @@ -17,17 +17,17 @@ class nsIVariant; class nsRange; namespace mozilla { namespace dom { class Selection; } // namespace dom namespace a11y { -class Accessible; +class LocalAccessible; class HyperTextAccessible; /** * A text point (hyper text + offset), represents a boundary of text range. */ struct TextPoint final { TextPoint(HyperTextAccessible* aContainer, int32_t aOffset) : mContainer(aContainer), mOffset(aOffset) {} @@ -83,23 +83,23 @@ class TextRange final { TextPoint StartPoint() const { return TextPoint(mStartContainer, mStartOffset); } TextPoint EndPoint() const { return TextPoint(mEndContainer, mEndOffset); } /** * Return a container containing both start and end points. */ - Accessible* Container() const; + LocalAccessible* Container() const; /** * Return a list of embedded objects enclosed by the text range (includes * partially overlapped objects). */ - void EmbeddedChildren(nsTArray<Accessible*>* aChildren) const; + void EmbeddedChildren(nsTArray<LocalAccessible*>* aChildren) const; /** * Return text enclosed by the range. */ void Text(nsAString& aText) const; /** * Return list of bounding rects of the text range by lines. @@ -127,17 +127,17 @@ class TextRange final { * Move the range points to the closest unit boundaries. */ void Normalize(ETextUnit aUnit); /** * Crops the range if it overlaps the given accessible element boundaries, * returns true if the range was cropped successfully. */ - bool Crop(Accessible* aContainer); + bool Crop(LocalAccessible* aContainer); enum EDirection { eBackward, eForward }; /** * Return range enclosing the found text. */ void FindText(const nsAString& aText, EDirection aDirection, nsCaseTreatment aCaseSensitive, TextRange* aFoundRange) const; @@ -248,32 +248,33 @@ class TextRange final { /** * Text() method helper. * @param aText [in,out] calculated text * @param aCurrent [in] currently traversed node * @param aStartIntlOffset [in] start offset if current node is a text node * @return true if calculation is not finished yet */ - bool TextInternal(nsAString& aText, Accessible* aCurrent, + bool TextInternal(nsAString& aText, LocalAccessible* aCurrent, uint32_t aStartIntlOffset) const; void MoveInternal(ETextUnit aUnit, int32_t aCount, HyperTextAccessible& aContainer, int32_t aOffset, HyperTextAccessible* aStopContainer = nullptr, int32_t aStopOffset = 0); /** * A helper method returning a common parent for two given accessible * elements. */ - Accessible* CommonParent(Accessible* aAcc1, Accessible* aAcc2, - nsTArray<Accessible*>* aParents1, uint32_t* aPos1, - nsTArray<Accessible*>* aParents2, - uint32_t* aPos2) const; + LocalAccessible* CommonParent(LocalAccessible* aAcc1, LocalAccessible* aAcc2, + nsTArray<LocalAccessible*>* aParents1, + uint32_t* aPos1, + nsTArray<LocalAccessible*>* aParents2, + uint32_t* aPos2) const; RefPtr<HyperTextAccessible> mRoot; RefPtr<HyperTextAccessible> mStartContainer; RefPtr<HyperTextAccessible> mEndContainer; int32_t mStartOffset; int32_t mEndOffset; };
--- a/accessible/base/TextUpdater.cpp +++ b/accessible/base/TextUpdater.cpp @@ -1,16 +1,16 @@ /* -*- 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 "TextUpdater.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "DocAccessible-inl.h" #include "TextLeafAccessible.h" #include <algorithm> using namespace mozilla::a11y; void TextUpdater::Run(DocAccessible* aDocument, TextLeafAccessible* aTextLeaf, const nsAString& aNewText) { @@ -30,17 +30,17 @@ void TextUpdater::Run(DocAccessible* aDo if (skipStart != minLen || oldLen != newLen) { TextUpdater updater(aDocument, aTextLeaf); updater.DoUpdate(aNewText, oldText, skipStart); } } void TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText, uint32_t aSkipStart) { - Accessible* parent = mTextLeaf->LocalParent(); + LocalAccessible* parent = mTextLeaf->LocalParent(); if (!parent) return; mHyperText = parent->AsHyperText(); if (!mHyperText) { MOZ_ASSERT_UNREACHABLE("Text leaf parent is not hypertext!"); return; }
--- a/accessible/base/TreeWalker.cpp +++ b/accessible/base/TreeWalker.cpp @@ -1,47 +1,47 @@ /* -*- 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 "TreeWalker.h" -#include "Accessible.h" +#include "LocalAccessible.h" #include "AccIterator.h" #include "nsAccessibilityService.h" #include "DocAccessible.h" #include "mozilla/dom/ChildIterator.h" #include "mozilla/dom/Element.h" using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // TreeWalker //////////////////////////////////////////////////////////////////////////////// -TreeWalker::TreeWalker(Accessible* aContext) +TreeWalker::TreeWalker(LocalAccessible* aContext) : mDoc(aContext->Document()), mContext(aContext), mAnchorNode(nullptr), mARIAOwnsIdx(0), mChildFilter(nsIContent::eSkipPlaceholderContent), mFlags(0), mPhase(eAtStart) { mChildFilter |= nsIContent::eAllChildren; mAnchorNode = mContext->IsDoc() ? mDoc->DocumentNode()->GetRootElement() : mContext->GetContent(); MOZ_COUNT_CTOR(TreeWalker); } -TreeWalker::TreeWalker(Accessible* aContext, nsIContent* aAnchorNode, +TreeWalker::TreeWalker(LocalAccessible* aContext, nsIContent* aAnchorNode, uint32_t aFlags) : mDoc(aContext->Document()), mContext(aContext), mAnchorNode(aAnchorNode), mARIAOwnsIdx(0), mChildFilter(nsIContent::eSkipPlaceholderContent), mFlags(aFlags), mPhase(eAtStart) { @@ -64,25 +64,25 @@ TreeWalker::TreeWalker(DocAccessible* aD mFlags(eWalkCache), mPhase(eAtStart) { MOZ_ASSERT(aAnchorNode, "No anchor node for the accessible tree walker"); MOZ_COUNT_CTOR(TreeWalker); } TreeWalker::~TreeWalker() { MOZ_COUNT_DTOR(TreeWalker); } -Accessible* TreeWalker::Scope(nsIContent* aAnchorNode) { +LocalAccessible* TreeWalker::Scope(nsIContent* aAnchorNode) { Reset(); mAnchorNode = aAnchorNode; mFlags |= eScoped; bool skipSubtree = false; - Accessible* acc = AccessibleFor(aAnchorNode, 0, &skipSubtree); + LocalAccessible* acc = AccessibleFor(aAnchorNode, 0, &skipSubtree); if (acc) { mPhase = eAtEnd; return acc; } return skipSubtree ? nullptr : Next(); } @@ -110,26 +110,26 @@ bool TreeWalker::Seek(nsIContent* aChild continue; } if (!parentNode || !parentNode->IsElement()) { return false; } // If ARIA owned child. - Accessible* child = mDoc->GetAccessible(childNode); + LocalAccessible* child = mDoc->GetAccessible(childNode); if (child && child->IsRelocated()) { MOZ_ASSERT( !(mFlags & eScoped), "Walker should not be scoped when seeking into relocated children"); if (child->LocalParent() != mContext) { return false; } - Accessible* ownedChild = nullptr; + LocalAccessible* ownedChild = nullptr; while ((ownedChild = mDoc->ARIAOwnedAt(mContext, mARIAOwnsIdx++)) && ownedChild != child) { ; } MOZ_ASSERT(ownedChild, "A child has to be in ARIA owned elements"); mPhase = eAtARIAOwns; return true; @@ -146,26 +146,26 @@ bool TreeWalker::Seek(nsIContent* aChild mPhase = eAtDOM; return true; } } while (true); return false; } -Accessible* TreeWalker::Next() { +LocalAccessible* TreeWalker::Next() { if (mStateStack.IsEmpty()) { if (mPhase == eAtEnd) { return nullptr; } if (mPhase == eAtDOM || mPhase == eAtARIAOwns) { if (!(mFlags & eScoped)) { mPhase = eAtARIAOwns; - Accessible* child = mDoc->ARIAOwnedAt(mContext, mARIAOwnsIdx); + LocalAccessible* child = mDoc->ARIAOwnedAt(mContext, mARIAOwnsIdx); if (child) { mARIAOwnsIdx++; return child; } } MOZ_ASSERT(!(mFlags & eScoped) || mPhase != eAtARIAOwns, "Don't walk relocated children in scoped mode"); mPhase = eAtEnd; @@ -180,17 +180,17 @@ Accessible* TreeWalker::Next() { mPhase = eAtDOM; PushState(mAnchorNode, true); } dom::AllChildrenIterator* top = &mStateStack[mStateStack.Length() - 1]; while (top) { while (nsIContent* childNode = top->GetNextChild()) { bool skipSubtree = false; - Accessible* child = AccessibleFor(childNode, mFlags, &skipSubtree); + LocalAccessible* child = AccessibleFor(childNode, mFlags, &skipSubtree); if (child) { return child; } // Walk down the subtree if allowed. if (!skipSubtree && childNode->IsElement()) { top = PushState(childNode, true); } @@ -227,17 +227,17 @@ Accessible* TreeWalker::Next() { // doesn't return it. However this sometimes happens when we're asked for // the nearest accessible to place holder content which we ignore. mAnchorNode = parent; } return Next(); } -Accessible* TreeWalker::Prev() { +LocalAccessible* TreeWalker::Prev() { if (mStateStack.IsEmpty()) { if (mPhase == eAtStart || mPhase == eAtDOM) { mPhase = eAtStart; return nullptr; } if (mPhase == eAtEnd) { if (mFlags & eScoped) { @@ -265,17 +265,18 @@ Accessible* TreeWalker::Prev() { } } dom::AllChildrenIterator* top = &mStateStack[mStateStack.Length() - 1]; while (top) { while (nsIContent* childNode = top->GetPreviousChild()) { // No accessible creation on the way back. bool skipSubtree = false; - Accessible* child = AccessibleFor(childNode, eWalkCache, &skipSubtree); + LocalAccessible* child = + AccessibleFor(childNode, eWalkCache, &skipSubtree); if (child) { return child; } // Walk down into subtree to find accessibles. if (!skipSubtree && childNode->IsElement()) { top = PushState(childNode, false); } @@ -306,21 +307,21 @@ Accessible* TreeWalker::Prev() { mAnchorNode = parent; } mPhase = eAtStart; return nullptr; } -Accessible* TreeWalker::AccessibleFor(nsIContent* aNode, uint32_t aFlags, - bool* aSkipSubtree) { +LocalAccessible* TreeWalker::AccessibleFor(nsIContent* aNode, uint32_t aFlags, + bool* aSkipSubtree) { // Ignore the accessible and its subtree if it was repositioned by means // of aria-owns. - Accessible* child = mDoc->GetAccessible(aNode); + LocalAccessible* child = mDoc->GetAccessible(aNode); if (child) { if (child->IsRelocated()) { *aSkipSubtree = true; return nullptr; } return child; }
--- a/accessible/base/TreeWalker.h +++ b/accessible/base/TreeWalker.h @@ -11,17 +11,17 @@ #include "mozilla/dom/ChildIterator.h" #include "nsCOMPtr.h" class nsIContent; namespace mozilla { namespace a11y { -class Accessible; +class LocalAccessible; class DocAccessible; /** * This class is used to walk the DOM tree to create accessible tree. */ class TreeWalker final { public: enum { @@ -30,41 +30,41 @@ class TreeWalker final { // used to walk the context tree starting from given node eWalkContextTree = 2 | eWalkCache, eScoped = 4 }; /** * Used to navigate and create if needed the accessible children. */ - explicit TreeWalker(Accessible* aContext); + explicit TreeWalker(LocalAccessible* aContext); /** * Used to navigate the accessible children relative to the anchor. * * @param aContext [in] container accessible for the given node, used to * define accessible context * @param aAnchorNode [in] the node the search will be prepared relative to * @param aFlags [in] flags (see enum above) */ - TreeWalker(Accessible* aContext, nsIContent* aAnchorNode, + TreeWalker(LocalAccessible* aContext, nsIContent* aAnchorNode, uint32_t aFlags = eWalkCache); /** * Navigates the accessible children within the anchor node subtree. */ TreeWalker(DocAccessible* aDocument, nsIContent* aAnchorNode); ~TreeWalker(); /** * Resets the walker state, and sets the given node as an anchor. Returns a * first accessible element within the node including the node itself. */ - Accessible* Scope(nsIContent* aAnchorNode); + LocalAccessible* Scope(nsIContent* aAnchorNode); /** * Resets the walker state. */ void Reset() { mPhase = eAtStart; mStateStack.Clear(); mARIAOwnsIdx = 0; @@ -77,32 +77,32 @@ class TreeWalker final { /** * Return the next/prev accessible. * * @note Returned accessible is bound to the document, if the accessible is * rejected during tree creation then the caller should be unbind it * from the document. */ - Accessible* Next(); - Accessible* Prev(); + LocalAccessible* Next(); + LocalAccessible* Prev(); - Accessible* Context() const { return mContext; } + LocalAccessible* Context() const { return mContext; } DocAccessible* Document() const { return mDoc; } private: TreeWalker(); TreeWalker(const TreeWalker&); TreeWalker& operator=(const TreeWalker&); /** * Return an accessible for the given node if any. */ - Accessible* AccessibleFor(nsIContent* aNode, uint32_t aFlags, - bool* aSkipSubtree); + LocalAccessible* AccessibleFor(nsIContent* aNode, uint32_t aFlags, + bool* aSkipSubtree); /** * Create new state for the given node and push it on top of stack / at bottom * of stack. * * @note State stack is used to navigate up/down the DOM subtree during * accessible children search. */ @@ -118,17 +118,17 @@ class TreeWalker final { } /** * Pop state from stack. */ dom::AllChildrenIterator* PopState(); DocAccessible* mDoc; - Accessible* mContext; + LocalAccessible* mContext; nsIContent* mAnchorNode; AutoTArray<dom::AllChildrenIterator, 20> mStateStack; uint32_t mARIAOwnsIdx; int32_t mChildFilter; uint32_t mFlags;
--- a/accessible/base/XULMap.h +++ b/accessible/base/XULMap.h @@ -30,97 +30,106 @@ XULMAP_TYPE(toolbarseparator, XULToolbar XULMAP_TYPE(toolbarspacer, XULToolbarSeparatorAccessible) XULMAP_TYPE(toolbarspring, XULToolbarSeparatorAccessible) XULMAP_TYPE(treecol, XULColumnItemAccessible) XULMAP_TYPE(treecolpicker, XULButtonAccessible) XULMAP_TYPE(treecols, XULTreeColumAccessible) XULMAP_TYPE(toolbar, XULToolbarAccessible) XULMAP_TYPE(toolbarbutton, XULToolbarButtonAccessible) -XULMAP(description, [](Element* aElement, Accessible* aContext) -> Accessible* { - if (aElement->ClassList()->Contains(u"tooltip-label"_ns)) { - return nullptr; - } +XULMAP(description, + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { + if (aElement->ClassList()->Contains(u"tooltip-label"_ns)) { + return nullptr; + } - return new XULLabelAccessible(aElement, aContext->Document()); -}) + return new XULLabelAccessible(aElement, aContext->Document()); + }) -XULMAP(tooltip, [](Element* aElement, Accessible* aContext) -> Accessible* { - nsIFrame* frame = aElement->GetPrimaryFrame(); - if (!frame) { - return nullptr; - } +XULMAP(tooltip, + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { + nsIFrame* frame = aElement->GetPrimaryFrame(); + if (!frame) { + return nullptr; + } - nsMenuPopupFrame* popupFrame = do_QueryFrame(frame); - if (!popupFrame) { - return nullptr; - } + nsMenuPopupFrame* popupFrame = do_QueryFrame(frame); + if (!popupFrame) { + return nullptr; + } - nsPopupState popupState = popupFrame->PopupState(); - if (popupState == ePopupHiding || popupState == ePopupInvisible || - popupState == ePopupClosed) { - return nullptr; - } + nsPopupState popupState = popupFrame->PopupState(); + if (popupState == ePopupHiding || popupState == ePopupInvisible || + popupState == ePopupClosed) { + return nullptr; + } - return new XULTooltipAccessible(aElement, aContext->Document()); -}) + return new XULTooltipAccessible(aElement, aContext->Document()); + }) -XULMAP(label, [](Element* aElement, Accessible* aContext) -> Accessible* { - if (aElement->ClassList()->Contains(u"text-link"_ns)) { - return new XULLinkAccessible(aElement, aContext->Document()); - } - return new XULLabelAccessible(aElement, aContext->Document()); -}) +XULMAP(label, + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { + if (aElement->ClassList()->Contains(u"text-link"_ns)) { + return new XULLinkAccessible(aElement, aContext->Document()); + } + return new XULLabelAccessible(aElement, aContext->Document()); + }) -XULMAP(image, [](Element* aElement, Accessible* aContext) -> Accessible* { - // Don't include nameless images in accessible tree. - if (!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) { - return nullptr; - } +XULMAP(image, + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { + // Don't include nameless images in accessible tree. + if (!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) { + return nullptr; + } - return new ImageAccessibleWrap(aElement, aContext->Document()); -}) + return new ImageAccessibleWrap(aElement, aContext->Document()); + }) -XULMAP(menupopup, [](Element* aElement, Accessible* aContext) { +XULMAP(menupopup, [](Element* aElement, LocalAccessible* aContext) { return CreateMenupopupAccessible(aElement, aContext); }) -XULMAP(panel, [](Element* aElement, Accessible* aContext) -> Accessible* { - static const Element::AttrValuesArray sIgnoreTypeVals[] = { - nsGkAtoms::autocomplete_richlistbox, nsGkAtoms::autocomplete, nullptr}; +XULMAP(panel, + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { + static const Element::AttrValuesArray sIgnoreTypeVals[] = { + nsGkAtoms::autocomplete_richlistbox, nsGkAtoms::autocomplete, + nullptr}; - if (aElement->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, - sIgnoreTypeVals, eIgnoreCase) >= 0) { - return nullptr; - } + if (aElement->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, + sIgnoreTypeVals, eIgnoreCase) >= 0) { + return nullptr; + } - if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus, - nsGkAtoms::_true, eCaseMatters)) { - return new XULAlertAccessible(aElement, aContext->Document()); - } + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus, + nsGkAtoms::_true, eCaseMatters)) { + return new XULAlertAccessible(aElement, aContext->Document()); + } - return new EnumRoleAccessible<roles::PANE>(aElement, aContext->Document()); -}) + return new EnumRoleAccessible<roles::PANE>(aElement, + aContext->Document()); + }) -XULMAP(popup, [](Element* aElement, Accessible* aContext) { +XULMAP(popup, [](Element* aElement, LocalAccessible* aContext) { return CreateMenupopupAccessible(aElement, aContext); }) -XULMAP(tree, [](Element* aElement, Accessible* aContext) -> Accessible* { - nsIContent* child = - nsTreeUtils::GetDescendantChild(aElement, nsGkAtoms::treechildren); - if (!child) return nullptr; +XULMAP(tree, + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { + nsIContent* child = + nsTreeUtils::GetDescendantChild(aElement, nsGkAtoms::treechildren); + if (!child) return nullptr; - nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame()); - if (!treeFrame) return nullptr; + nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame()); + if (!treeFrame) return nullptr; - RefPtr<nsTreeColumns> treeCols = treeFrame->Columns(); - uint32_t count = treeCols->Count(); + RefPtr<nsTreeColumns> treeCols = treeFrame->Columns(); + uint32_t count = treeCols->Count(); - // Outline of list accessible. - if (count == 1) { - return new XULTreeAccessible(aElement, aContext->Document(), treeFrame); - } + // Outline of list accessible. + if (count == 1) { + return new XULTreeAccessible(aElement, aContext->Document(), + treeFrame); + } - // Table or tree table accessible. - return new XULTreeGridAccessibleWrap(aElement, aContext->Document(), - treeFrame); -}) + // Table or tree table accessible. + return new XULTreeGridAccessibleWrap(aElement, aContext->Document(), + treeFrame); + })
--- a/accessible/base/nsAccCache.h +++ b/accessible/base/nsAccCache.h @@ -2,17 +2,17 @@ /* 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 _nsAccCache_H_ #define _nsAccCache_H_ //////////////////////////////////////////////////////////////////////////////// -// Accessible cache utils +// LocalAccessible cache utils //////////////////////////////////////////////////////////////////////////////// template <class T> void UnbindCacheEntriesFromDocument( nsRefPtrHashtable<nsPtrHashKey<const void>, T>& aCache) { for (auto iter = aCache.Iter(); !iter.Done(); iter.Next()) { T* accessible = iter.Data(); MOZ_ASSERT(accessible && !accessible->IsDefunct());
--- a/accessible/base/nsAccUtils.cpp +++ b/accessible/base/nsAccUtils.cpp @@ -1,16 +1,16 @@ /* -*- 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 "nsAccUtils.h" -#include "Accessible-inl.h" +#include "LocalAccessible-inl.h" #include "ARIAMap.h" #include "nsAccessibilityService.h" #include "nsCoreUtils.h" #include "DocAccessible.h" #include "HyperTextAccessible.h" #include "nsIAccessibleTypes.h" #include "Role.h" #include "States.h" @@ -64,32 +64,32 @@ void nsAccUtils::SetAccGroupAttrs(nsIPer SetAccAttr(aAttributes, nsGkAtoms::posinset, value); value.Truncate(); value.AppendInt(aSetSize); SetAccAttr(aAttributes, nsGkAtoms::setsize, value); } } -int32_t nsAccUtils::GetDefaultLevel(const Accessible* aAccessible) { +int32_t nsAccUtils::GetDefaultLevel(const LocalAccessible* aAccessible) { roles::Role role = aAccessible->Role(); if (role == roles::OUTLINEITEM) return 1; if (role == roles::ROW) { - Accessible* parent = aAccessible->LocalParent(); + LocalAccessible* parent = aAccessible->LocalParent(); // It is a row inside flatten treegrid. Group level is always 1 until it // is overriden by aria-level attribute. if (parent && parent->Role() == roles::TREE_TABLE) return 1; } return 0; } -int32_t nsAccUtils::GetARIAOrDefaultLevel(const Accessible* aAccessible) { +int32_t nsAccUtils::GetARIAOrDefaultLevel(const LocalAccessible* aAccessible) { int32_t level = 0; nsCoreUtils::GetUIntAttr(aAccessible->GetContent(), nsGkAtoms::aria_level, &level); if (level != 0) return level; return GetDefaultLevel(aAccessible); } @@ -229,38 +229,39 @@ nsStaticAtom* nsAccUtils::NormalizeARIAT eCaseMatters); // If the token is present, return it, otherwise TRUE as per spec. return (idx >= 0) ? tokens[idx] : nsGkAtoms::_true; } return nullptr; } -Accessible* nsAccUtils::GetSelectableContainer(Accessible* aAccessible, - uint64_t aState) { +LocalAccessible* nsAccUtils::GetSelectableContainer( + LocalAccessible* aAccessible, uint64_t aState) { if (!aAccessible) return nullptr; if (!(aState & states::SELECTABLE)) return nullptr; - Accessible* parent = aAccessible; + LocalAccessible* parent = aAccessible; while ((parent = parent->LocalParent()) && !parent->IsSelect()) { if (parent->Role() == roles::PANE) return nullptr; } return parent; } -bool nsAccUtils::IsDOMAttrTrue(const Accessible* aAccessible, nsAtom* aAttr) { +bool nsAccUtils::IsDOMAttrTrue(const LocalAccessible* aAccessible, + nsAtom* aAttr) { dom::Element* el = aAccessible->Elm(); return el && el->AttrValueIs(kNameSpaceID_None, aAttr, nsGkAtoms::_true, eCaseMatters); } -Accessible* nsAccUtils::TableFor(Accessible* aRow) { +LocalAccessible* nsAccUtils::TableFor(LocalAccessible* aRow) { if (aRow) { - Accessible* table = aRow->LocalParent(); + LocalAccessible* table = aRow->LocalParent(); if (table) { roles::Role tableRole = table->Role(); const nsRoleMapEntry* roleMapEntry = table->ARIARoleMap(); if (tableRole == roles::GROUPING || // if there's a rowgroup. (table->IsGenericHyperText() && !roleMapEntry && !table->IsTable())) { // or there is a wrapping text container table = table->LocalParent(); if (table) tableRole = table->Role(); @@ -274,32 +275,33 @@ Accessible* nsAccUtils::TableFor(Accessi } return nullptr; } HyperTextAccessible* nsAccUtils::GetTextContainer(nsINode* aNode) { // Get text accessible containing the result node. DocAccessible* doc = GetAccService()->GetDocAccessible(aNode->OwnerDoc()); - Accessible* accessible = doc ? doc->GetAccessibleOrContainer(aNode) : nullptr; + LocalAccessible* accessible = + doc ? doc->GetAccessibleOrContainer(aNode) : nullptr; if (!accessible) return nullptr; do { HyperTextAccessible* textAcc = accessible->AsHyperText(); if (textAcc) return textAcc; accessible = accessible->LocalParent(); } while (accessible); return nullptr; } nsIntPoint nsAccUtils::ConvertToScreenCoords(int32_t aX, int32_t aY, uint32_t aCoordinateType, - Accessible* aAccessible) { + LocalAccessible* aAccessible) { nsIntPoint coords(aX, aY); switch (aCoordinateType) { case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE: break; case nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE: { coords += nsCoreUtils::GetScreenCoordsForWindow(aAccessible->GetNode()); @@ -315,17 +317,17 @@ nsIntPoint nsAccUtils::ConvertToScreenCo MOZ_ASSERT_UNREACHABLE("invalid coord type!"); } return coords; } void nsAccUtils::ConvertScreenCoordsTo(int32_t* aX, int32_t* aY, uint32_t aCoordinateType, - Accessible* aAccessible) { + LocalAccessible* aAccessible) { switch (aCoordinateType) { case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE: break; case nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE: { nsIntPoint coords = nsCoreUtils::GetScreenCoordsForWindow(aAccessible->GetNode()); *aX -= coords.x; @@ -340,18 +342,18 @@ void nsAccUtils::ConvertScreenCoordsTo(i break; } default: MOZ_ASSERT_UNREACHABLE("invalid coord type!"); } } -nsIntPoint nsAccUtils::GetScreenCoordsForParent(Accessible* aAccessible) { - Accessible* parent = aAccessible->LocalParent(); +nsIntPoint nsAccUtils::GetScreenCoordsForParent(LocalAccessible* aAccessible) { + LocalAccessible* parent = aAccessible->LocalParent(); if (!parent) return nsIntPoint(0, 0); nsIFrame* parentFrame = parent->GetFrame(); if (!parentFrame) return nsIntPoint(0, 0); nsRect rect = parentFrame->GetScreenRectInAppUnits(); return nsPoint(rect.X(), rect.Y()) .ToNearestPixels(parentFrame->PresContext()->AppUnitsPerDevPixel()); @@ -370,36 +372,36 @@ bool nsAccUtils::GetLiveAttrValue(uint32 return true; } return false; } #ifdef DEBUG -bool nsAccUtils::IsTextInterfaceSupportCorrect(Accessible* aAccessible) { +bool nsAccUtils::IsTextInterfaceSupportCorrect(LocalAccessible* aAccessible) { // Don't test for accessible docs, it makes us create accessibles too // early and fire mutation events before we need to if (aAccessible->IsDoc()) return true; bool foundText = false; uint32_t childCount = aAccessible->ChildCount(); for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) { - Accessible* child = aAccessible->LocalChildAt(childIdx); + LocalAccessible* child = aAccessible->LocalChildAt(childIdx); if (child->IsText()) { foundText = true; break; } } return !foundText || aAccessible->IsHyperText(); } #endif -uint32_t nsAccUtils::TextLength(Accessible* aAccessible) { +uint32_t nsAccUtils::TextLength(LocalAccessible* aAccessible) { if (!aAccessible->IsText()) { return 1; } TextLeafAccessible* textLeaf = aAccessible->AsTextLeaf(); if (textLeaf) return textLeaf->Text().Length(); // For list bullets (or anything other accessible which would compute its own @@ -468,17 +470,17 @@ bool nsAccUtils::PersistentPropertiesToA NS_ENSURE_SUCCESS(rv, false); aAttributes->AppendElement(Attribute(name, value)); } return true; } -bool nsAccUtils::IsARIALive(const Accessible* aAccessible) { +bool nsAccUtils::IsARIALive(const LocalAccessible* aAccessible) { // Get computed aria-live property based on the closest container with the // attribute. Inner nodes override outer nodes within the same // document. // This should be the same as the container-live attribute, but we don't need // the other container-* attributes, so we can't use the same function. nsIContent* ancestor = aAccessible->GetContent(); if (!ancestor) { return false;
--- a/accessible/base/nsAccUtils.h +++ b/accessible/base/nsAccUtils.h @@ -1,17 +1,17 @@ /* -*- 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/. */ #ifndef nsAccUtils_h_ #define nsAccUtils_h_ -#include "mozilla/a11y/Accessible.h" +#include "mozilla/a11y/LocalAccessible.h" #include "mozilla/a11y/DocManager.h" #include "AccessibleOrProxy.h" #include "nsAccessibilityService.h" #include "nsCoreUtils.h" #include "nsIDocShell.h" #include "nsPoint.h" @@ -60,23 +60,23 @@ class nsAccUtils { */ static void SetAccGroupAttrs(nsIPersistentProperties* aAttributes, int32_t aLevel, int32_t aSetSize, int32_t aPosInSet); /** * Get default value of the level for the given accessible. */ - static int32_t GetDefaultLevel(const Accessible* aAcc); + static int32_t GetDefaultLevel(const LocalAccessible* aAcc); /** * Return ARIA level value or the default one if ARIA is missed for the * given accessible. */ - static int32_t GetARIAOrDefaultLevel(const Accessible* aAccessible); + static int32_t GetARIAOrDefaultLevel(const LocalAccessible* aAccessible); /** * Compute group level for nsIDOMXULContainerItemElement node. */ static int32_t GetLevelForXULContainerItem(nsIContent* aContent); /** * Set container-foo live region attributes for the given node. @@ -127,84 +127,84 @@ class nsAccUtils { } /** * Return single or multi selectable container for the given item. * * @param aAccessible [in] the item accessible * @param aState [in] the state of the item accessible */ - static Accessible* GetSelectableContainer(Accessible* aAccessible, - uint64_t aState); + static LocalAccessible* GetSelectableContainer(LocalAccessible* aAccessible, + uint64_t aState); /** * Return a text container accessible for the given node. */ static HyperTextAccessible* GetTextContainer(nsINode* aNode); - static Accessible* TableFor(Accessible* aRow); + static LocalAccessible* TableFor(LocalAccessible* aRow); /** * Return true if the DOM node of a given accessible has a given attribute * with a value of "true". */ - static bool IsDOMAttrTrue(const Accessible* aAccessible, nsAtom* aAttr); + static bool IsDOMAttrTrue(const LocalAccessible* aAccessible, nsAtom* aAttr); /** * Return true if the DOM node of given accessible has aria-selected="true" * attribute. */ - static inline bool IsARIASelected(const Accessible* aAccessible) { + static inline bool IsARIASelected(const LocalAccessible* aAccessible) { return IsDOMAttrTrue(aAccessible, nsGkAtoms::aria_selected); } /** * Return true if the DOM node of given accessible has * aria-multiselectable="true" attribute. */ - static inline bool IsARIAMultiSelectable(const Accessible* aAccessible) { + static inline bool IsARIAMultiSelectable(const LocalAccessible* aAccessible) { return IsDOMAttrTrue(aAccessible, nsGkAtoms::aria_multiselectable); } /** * Converts the given coordinates to coordinates relative screen. * * @param aX [in] the given x coord * @param aY [in] the given y coord * @param aCoordinateType [in] specifies coordinates origin (refer to * nsIAccessibleCoordinateType) * @param aAccessible [in] the accessible if coordinates are given * relative it. * @return converted coordinates */ static nsIntPoint ConvertToScreenCoords(int32_t aX, int32_t aY, uint32_t aCoordinateType, - Accessible* aAccessible); + LocalAccessible* aAccessible); /** * Converts the given coordinates relative screen to another coordinate * system. * * @param aX [in, out] the given x coord * @param aY [in, out] the given y coord * @param aCoordinateType [in] specifies coordinates origin (refer to * nsIAccessibleCoordinateType) * @param aAccessible [in] the accessible if coordinates are given * relative it */ static void ConvertScreenCoordsTo(int32_t* aX, int32_t* aY, uint32_t aCoordinateType, - Accessible* aAccessible); + LocalAccessible* aAccessible); /** * Returns coordinates relative screen for the parent of the given accessible. * * @param [in] aAccessible the accessible */ - static nsIntPoint GetScreenCoordsForParent(Accessible* aAccessible); + static nsIntPoint GetScreenCoordsForParent(LocalAccessible* aAccessible); /** * Get the 'live' or 'container-live' object attribute value from the given * ELiveAttrRule constant. * * @param aRule [in] rule constant (see ELiveAttrRule in nsAccMap.h) * @param aValue [out] object attribute value * @@ -212,23 +212,23 @@ class nsAccUtils { */ static bool GetLiveAttrValue(uint32_t aRule, nsAString& aValue); #ifdef DEBUG /** * Detect whether the given accessible object implements nsIAccessibleText, * when it is text or has text child node. */ - static bool IsTextInterfaceSupportCorrect(Accessible* aAccessible); + static bool IsTextInterfaceSupportCorrect(LocalAccessible* aAccessible); #endif /** * Return text length of the given accessible, return 0 on failure. */ - static uint32_t TextLength(Accessible* aAccessible); + static uint32_t TextLength(LocalAccessible* aAccessible); /** * Transform nsIAccessibleStates constants to internal state constant. */ static inline uint64_t To64State(uint32_t aState1, uint32_t aState2) { return static_cast<uint64_t>(aState1) + (static_cast<uint64_t>(aState2) << 31); } @@ -256,15 +256,15 @@ class nsAccUtils { static bool PersistentPropertiesToArray(nsIPersistentProperties* aProps, nsTArray<Attribute>* aAttributes); /** * Return true if the given accessible is within an ARIA live region; i.e. * the container-live attribute would be something other than "off" or empty. */ - static bool IsARIALive(const Accessible* aAccessible); + static bool IsARIALive(const LocalAccessible* aAccessible); }; } // namespace a11y } // namespace mozilla #endif
--- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -158,41 +158,44 @@ static bool MustSVGElementBeAccessible(n } return false; } /** * Used by XULMap.h to map both menupopup and popup elements */ #ifdef MOZ_XUL -Accessible* CreateMenupopupAccessible(Element* aElement, Accessible* aContext) { +LocalAccessible* CreateMenupopupAccessible(Element* aElement, + LocalAccessible* aContext) { # ifdef MOZ_ACCESSIBILITY_ATK // ATK considers this node to be redundant when within menubars, and it makes // menu navigation with assistive technologies more difficult // XXX In the future we will should this for consistency across the // nsIAccessible implementations on each platform for a consistent scripting // environment, but then strip out redundant accessibles in the AccessibleWrap // class for each platform. nsIContent* parent = aElement->GetParent(); if (parent && parent->IsXULElement(nsGkAtoms::menu)) return nullptr; # endif return new XULMenupopupAccessible(aElement, aContext->Document()); } #endif //////////////////////////////////////////////////////////////////////////////// -// Accessible constructors +// LocalAccessible constructors -static Accessible* New_HyperText(Element* aElement, Accessible* aContext) { +static LocalAccessible* New_HyperText(Element* aElement, + LocalAccessible* aContext) { return new HyperTextAccessibleWrap(aElement, aContext->Document()); } template <typename AccClass> -static Accessible* New_HTMLDtOrDd(Element* aElement, Accessible* aContext) { +static LocalAccessible* New_HTMLDtOrDd(Element* aElement, + LocalAccessible* aContext) { nsIContent* parent = aContext->GetContent(); if (parent->IsHTMLElement(nsGkAtoms::div)) { // It is conforming in HTML to use a div to group dt/dd elements. parent = parent->GetParent(); } if (parent && parent->IsHTMLElement(nsGkAtoms::dl)) { return new AccClass(aElement, aContext->Document()); @@ -225,20 +228,22 @@ static const HTMLMarkupMapInfo sHTMLMark #include "MarkupMap.h" }; #undef MARKUPMAP #ifdef MOZ_XUL # define XULMAP(atom, ...) {nsGkAtoms::atom, __VA_ARGS__}, -# define XULMAP_TYPE(atom, new_type) \ - XULMAP(atom, [](Element* aElement, Accessible* aContext) -> Accessible* { \ - return new new_type(aElement, aContext->Document()); \ - }) +# define XULMAP_TYPE(atom, new_type) \ + XULMAP( \ + atom, \ + [](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* { \ + return new new_type(aElement, aContext->Document()); \ + }) static const XULMarkupMapInfo sXULMarkupMapList[] = { # include "XULMap.h" }; # undef XULMAP_TYPE # undef XULMAP #endif @@ -297,17 +302,17 @@ nsAccessibilityService::ListenersChanged change->GetCountOfEventListenerChangesAffectingAccessibility(&changeCount); NS_ENSURE_SUCCESS(rv, rv); if (changeCount) { Document* ownerDoc = node->OwnerDoc(); DocAccessible* document = GetExistingDocAccessible(ownerDoc); if (document) { - Accessible* acc = document->GetAccessible(node); + LocalAccessible* acc = document->GetAccessible(node); if (!acc && nsCoreUtils::HasClickListener(node)) { // Create an accessible for a inaccessible element having click event // handler. document->ContentInserted(node, node->GetNextSibling()); } else if (acc && acc->IsHTMLLink() && !acc->AsHTMLLink()->IsLinked()) { // Notify of a LINKED state change if an HTML link gets a click // listener but does not have an href attribute. RefPtr<AccEvent> linkedChangeEvent = @@ -344,40 +349,40 @@ void nsAccessibilityService::NotifyOfAnc Document* documentNode = aTargetNode->GetUncomposedDoc(); if (documentNode) { DocAccessible* document = GetDocAccessible(documentNode); if (document) document->SetAnchorJump(aTargetNode); } } void nsAccessibilityService::FireAccessibleEvent(uint32_t aEvent, - Accessible* aTarget) { + LocalAccessible* aTarget) { nsEventShell::FireEvent(aEvent, aTarget); } void nsAccessibilityService::NotifyOfImageSizeAvailable( mozilla::PresShell* aPresShell, nsIContent* aContent) { // If the size of an image is initially unknown, it will have the invisible // state (and a 0 width and height), causing it to be ignored by some screen // readers. Fire a state change event to update any client caches. DocAccessible* document = GetDocAccessible(aPresShell); if (document) { - Accessible* accessible = document->GetAccessible(aContent); + LocalAccessible* accessible = document->GetAccessible(aContent); // The accessible may not be an ImageAccessible if this was previously a // broken image with an alt attribute. In that case, do nothing; the // accessible will be recreated if this becomes a valid image. if (accessible && accessible->IsImage()) { RefPtr<AccEvent> event = new AccStateChangeEvent(accessible, states::INVISIBLE, false); document->FireDelayedEvent(event); } } } -Accessible* nsAccessibilityService::GetRootDocumentAccessible( +LocalAccessible* nsAccessibilityService::GetRootDocumentAccessible( PresShell* aPresShell, bool aCanCreate) { PresShell* presShell = aPresShell; Document* documentNode = aPresShell->GetDocument(); if (documentNode) { nsCOMPtr<nsIDocShellTreeItem> treeItem(documentNode->GetDocShell()); if (treeItem) { nsCOMPtr<nsIDocShellTreeItem> rootTreeItem; treeItem->GetInProcessRootTreeItem(getter_AddRefs(rootTreeItem)); @@ -396,34 +401,34 @@ Accessible* nsAccessibilityService::GetR void nsAccessibilityService::DeckPanelSwitched(PresShell* aPresShell, nsIContent* aDeckNode, nsIFrame* aPrevBoxFrame, nsIFrame* aCurrentBoxFrame) { DocAccessible* document = GetDocAccessible(aPresShell); if (!document) { return; } - // A deck with an Accessible is a tabpanels element. + // A deck with a LocalAccessible is a tabpanels element. const bool isTabPanels = document->HasAccessible(aDeckNode); MOZ_ASSERT(!isTabPanels || aDeckNode->IsXULElement(nsGkAtoms::tabpanels), - "A deck with an Accessible should be a tabpanels element"); + "A deck with a LocalAccessible should be a tabpanels element"); if (aPrevBoxFrame) { nsIContent* panelNode = aPrevBoxFrame->GetContent(); #ifdef A11Y_LOG if (logging::IsEnabled(logging::eTree)) { logging::MsgBegin("TREE", "deck panel unselected"); logging::Node("container", panelNode); logging::Node("content", aDeckNode); logging::MsgEnd(); } #endif if (isTabPanels) { // Tabpanels are accessible even when not selected. - if (Accessible* acc = document->GetAccessible(panelNode)) { + if (LocalAccessible* acc = document->GetAccessible(panelNode)) { RefPtr<AccEvent> event = new AccStateChangeEvent(acc, states::OFFSCREEN, true); document->FireDelayedEvent(event); } } else { document->ContentRemoved(panelNode); } } @@ -435,18 +440,18 @@ void nsAccessibilityService::DeckPanelSw logging::MsgBegin("TREE", "deck panel selected"); logging::Node("container", panelNode); logging::Node("content", aDeckNode); logging::MsgEnd(); } #endif if (isTabPanels) { // Tabpanels are accessible even when not selected, so we don't have to - // insert an Accessible. - if (Accessible* acc = document->GetAccessible(panelNode)) { + // insert a LocalAccessible. + if (LocalAccessible* acc = document->GetAccessible(panelNode)) { RefPtr<AccEvent> event = new AccStateChangeEvent(acc, states::OFFSCREEN, false); document->FireDelayedEvent(event); } } else { document->ContentInserted(panelNode, panelNode->GetNextSibling()); } } @@ -496,17 +501,17 @@ void nsAccessibilityService::ContentRemo logging::Stack(); } #endif } void nsAccessibilityService::TableLayoutGuessMaybeChanged( PresShell* aPresShell, nsIContent* aContent) { if (DocAccessible* document = GetDocAccessible(aPresShell)) { - if (Accessible* accessible = document->GetAccessible(aContent)) { + if (LocalAccessible* accessible = document->GetAccessible(aContent)) { document->FireDelayedEvent( nsIAccessibleEvent::EVENT_TABLE_STYLING_CHANGED, accessible); } } } void nsAccessibilityService::UpdateText(PresShell* aPresShell, nsIContent* aContent) { @@ -514,54 +519,55 @@ void nsAccessibilityService::UpdateText( if (document) document->UpdateText(aContent); } void nsAccessibilityService::TreeViewChanged(PresShell* aPresShell, nsIContent* aContent, nsITreeView* aView) { DocAccessible* document = GetDocAccessible(aPresShell); if (document) { - Accessible* accessible = document->GetAccessible(aContent); + LocalAccessible* accessible = document->GetAccessible(aContent); if (accessible) { XULTreeAccessible* treeAcc = accessible->AsXULTree(); if (treeAcc) treeAcc->TreeViewChanged(aView); } } } void nsAccessibilityService::RangeValueChanged(PresShell* aPresShell, nsIContent* aContent) { DocAccessible* document = GetDocAccessible(aPresShell); if (document) { - Accessible* accessible = document->GetAccessible(aContent); + LocalAccessible* accessible = document->GetAccessible(aContent); if (accessible) { document->FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, accessible); } } } void nsAccessibilityService::UpdateListBullet(PresShell* aPresShell, nsIContent* aHTMLListItemContent, bool aHasBullet) { DocAccessible* document = GetDocAccessible(aPresShell); if (document) { - Accessible* accessible = document->GetAccessible(aHTMLListItemContent); + LocalAccessible* accessible = document->GetAccessible(aHTMLListItemContent); if (accessible) { HTMLLIAccessible* listItem = accessible->AsHTMLListItem(); if (listItem) listItem->UpdateBullet(aHasBullet); } } } void nsAccessibilityService::UpdateImageMap(nsImageFrame* aImageFrame) { PresShell* presShell = aImageFrame->PresShell(); DocAccessible* document = GetDocAccessible(presShell); if (document) { - Accessible* accessible = document->GetAccessible(aImageFrame->GetContent()); + LocalAccessible* accessible = + document->GetAccessible(aImageFrame->GetContent()); if (accessible) { HTMLImageMapAccessible* imageMap = accessible->AsImageMap(); if (imageMap) { imageMap->UpdateChildAreas(); return; } // If image map was initialized after we created an accessible (that'll @@ -571,17 +577,17 @@ void nsAccessibilityService::UpdateImage } } void nsAccessibilityService::UpdateLabelValue(PresShell* aPresShell, nsIContent* aLabelElm, const nsString& aNewValue) { DocAccessible* document = GetDocAccessible(aPresShell); if (document) { - Accessible* accessible = document->GetAccessible(aLabelElm); + LocalAccessible* accessible = document->GetAccessible(aLabelElm); if (accessible) { XULLabelAccessible* xulLabel = accessible->AsXULLabel(); NS_ASSERTION(xulLabel, "UpdateLabelValue was called for wrong accessible!"); if (xulLabel) xulLabel->UpdateLabelValue(aNewValue); } } } @@ -831,19 +837,18 @@ void nsAccessibilityService::GetStringRe } #undef RELATIONTYPE } //////////////////////////////////////////////////////////////////////////////// // nsAccessibilityService public -Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode, - Accessible* aContext, - bool* aIsSubtreeHidden) { +LocalAccessible* nsAccessibilityService::CreateAccessible( + nsINode* aNode, LocalAccessible* aContext, bool* aIsSubtreeHidden) { MOZ_ASSERT(aContext, "No context provided"); MOZ_ASSERT(aNode, "No node to create an accessible for"); MOZ_ASSERT(gConsumers, "No creation after shutdown"); if (aIsSubtreeHidden) *aIsSubtreeHidden = false; DocAccessible* document = aContext->Document(); MOZ_ASSERT(!document->GetAccessible(aNode), @@ -881,17 +886,17 @@ Accessible* nsAccessibilityService::Crea nsIFrame* frame = content->GetPrimaryFrame(); if (!frame || !frame->StyleVisibility()->IsVisible()) { // display:contents element doesn't have a frame, but retains the semantics. // All its children are unaffected. if (nsCoreUtils::IsDisplayContents(content)) { const HTMLMarkupMapInfo* markupMap = mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom()); if (markupMap && markupMap->new_func) { - RefPtr<Accessible> newAcc = + RefPtr<LocalAccessible> newAcc = markupMap->new_func(content->AsElement(), aContext); if (newAcc) { document->BindToDocument(newAcc, aria::GetRoleMap(content->AsElement())); } return newAcc; } return nullptr; @@ -920,17 +925,17 @@ Accessible* nsAccessibilityService::Crea #ifdef DEBUG nsImageFrame* imageFrame = do_QueryFrame(frame); NS_ASSERTION(!imageFrame || !content->IsHTMLElement(nsGkAtoms::area), "Image map manages the area accessible creation!"); #endif // Attempt to create an accessible based on what we know. - RefPtr<Accessible> newAcc; + RefPtr<LocalAccessible> newAcc; // Create accessible for visible text frames. if (content->IsText()) { nsIFrame::RenderedText text = frame->GetRenderedText( 0, UINT32_MAX, nsIFrame::TextOffsetType::OffsetsInContentText, nsIFrame::TrailingWhitespace::DontTrim); // Ignore not rendered text nodes and whitespace text nodes between table // cells. @@ -1261,23 +1266,23 @@ void nsAccessibilityService::Shutdown() if (observerService) { static const char16_t kShutdownIndicator[] = {'0', 0}; observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kShutdownIndicator); } } -already_AddRefed<Accessible> +already_AddRefed<LocalAccessible> nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame, nsIContent* aContent, - Accessible* aContext) { + LocalAccessible* aContext) { DocAccessible* document = aContext->Document(); - RefPtr<Accessible> newAcc; + RefPtr<LocalAccessible> newAcc; switch (aFrame->AccessibleType()) { case eNoType: return nullptr; case eHTMLBRType: newAcc = new HTMLBRAccessible(aContent, document); break; case eHTMLButtonType: newAcc = new HTMLButtonAccessible(aContent, document); @@ -1336,32 +1341,32 @@ nsAccessibilityService::CreateAccessible case eHTMLTableType: if (aContent->IsHTMLElement(nsGkAtoms::table)) { newAcc = new HTMLTableAccessibleWrap(aContent, document); } else { newAcc = new HyperTextAccessibleWrap(aContent, document); } break; case eHTMLTableCellType: - // Accessible HTML table cell should be a child of accessible HTML table - // or its row (CSS HTML tables are polite to the used markup at + // LocalAccessible HTML table cell should be a child of accessible HTML + // table or its row (CSS HTML tables are polite to the used markup at // certain degree). // Otherwise create a generic text accessible to avoid text jamming // when reading by AT. if (aContext->IsHTMLTableRow() || aContext->IsHTMLTable()) { newAcc = new HTMLTableCellAccessibleWrap(aContent, document); } else { newAcc = new HyperTextAccessibleWrap(aContent, document); } break; case eHTMLTableRowType: { - // Accessible HTML table row may be a child of tbody/tfoot/thead of + // LocalAccessible HTML table row may be a child of tbody/tfoot/thead of // accessible HTML table or a direct child of accessible of HTML table. - Accessible* table = aContext->IsTable() ? aContext : nullptr; + LocalAccessible* table = aContext->IsTable() ? aContext : nullptr; if (!table && aContext->LocalParent() && aContext->LocalParent()->IsTable()) { table = aContext->LocalParent(); } if (table) { nsIContent* parentContent = aContent->GetParentOrShadowHostNode()->AsContent(); @@ -1451,33 +1456,33 @@ void nsAccessibilityService::MarkupAttri continue; } nsAccUtils::SetAccAttr(aAttributes, info->name, info->value); } } -Accessible* nsAccessibilityService::AddNativeRootAccessible( +LocalAccessible* nsAccessibilityService::AddNativeRootAccessible( void* aAtkAccessible) { #ifdef MOZ_ACCESSIBILITY_ATK ApplicationAccessible* applicationAcc = ApplicationAcc(); if (!applicationAcc) return nullptr; GtkWindowAccessible* nativeWnd = new GtkWindowAccessible(static_cast<AtkObject*>(aAtkAccessible)); if (applicationAcc->AppendChild(nativeWnd)) return nativeWnd; #endif return nullptr; } void nsAccessibilityService::RemoveNativeRootAccessible( - Accessible* aAccessible) { + LocalAccessible* aAccessible) { #ifdef MOZ_ACCESSIBILITY_ATK ApplicationAccessible* applicationAcc = ApplicationAcc(); if (applicationAcc) applicationAcc->RemoveChild(aAccessible); #endif } bool nsAccessibilityService::HasAccessible(nsINode* aDOMNode) { @@ -1550,17 +1555,17 @@ nsAccessibilityService* GetOrCreateAccSe RefPtr<nsAccessibilityService> service = new nsAccessibilityService(); if (!service->Init()) { service->Shutdown(); return nullptr; } } MOZ_ASSERT(nsAccessibilityService::gAccessibilityService, - "Accessible service is not initialized."); + "LocalAccessible service is not initialized."); nsAccessibilityService::gAccessibilityService->SetConsumers(aNewConsumer); return nsAccessibilityService::gAccessibilityService; } void MaybeShutdownAccService(uint32_t aFormerConsumer) { nsAccessibilityService* accService = nsAccessibilityService::gAccessibilityService;
--- a/accessible/base/nsAccessibilityService.h +++ b/accessible/base/nsAccessibilityService.h @@ -50,18 +50,18 @@ FocusManager* FocusMgr(); SelectionManager* SelectionMgr(); /** * Returns the application accessible. */ ApplicationAccessible* ApplicationAcc(); xpcAccessibleApplication* XPCApplicationAcc(); -typedef Accessible*(New_Accessible)(mozilla::dom::Element* aElement, - Accessible* aContext); +typedef LocalAccessible*(New_Accessible)(mozilla::dom::Element* aElement, + LocalAccessible* aContext); // These fields are not `nsStaticAtom* const` because MSVC doesn't like it. struct MarkupAttrInfo { nsStaticAtom* name; nsStaticAtom* value; nsStaticAtom* DOMAttrName; nsStaticAtom* DOMAttrValue; @@ -95,38 +95,38 @@ EPlatformDisabledState ReadPlatformDisab } // namespace mozilla class nsAccessibilityService final : public mozilla::a11y::DocManager, public mozilla::a11y::FocusManager, public mozilla::a11y::SelectionManager, public nsIListenerChangeListener, public nsIObserver { public: - typedef mozilla::a11y::Accessible Accessible; + typedef mozilla::a11y::LocalAccessible LocalAccessible; typedef mozilla::a11y::DocAccessible DocAccessible; // nsIListenerChangeListener NS_IMETHOD ListenersChanged(nsIArray* aEventChanges) override; protected: ~nsAccessibilityService(); public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIOBSERVER - Accessible* GetRootDocumentAccessible(mozilla::PresShell* aPresShell, - bool aCanCreate); + LocalAccessible* GetRootDocumentAccessible(mozilla::PresShell* aPresShell, + bool aCanCreate); /** * Adds/remove ATK root accessible for gtk+ native window to/from children * of the application accessible. */ - Accessible* AddNativeRootAccessible(void* aAtkAccessible); - void RemoveNativeRootAccessible(Accessible* aRootAccessible); + LocalAccessible* AddNativeRootAccessible(void* aAtkAccessible); + void RemoveNativeRootAccessible(LocalAccessible* aRootAccessible); bool HasAccessible(nsINode* aDOMNode); /** * Get a string equivalent for an accessible role value. */ void GetStringRole(uint32_t aRole, nsAString& aString); @@ -220,17 +220,17 @@ class nsAccessibilityService final : pub */ void PresShellActivated(mozilla::PresShell* aPresShell); /** * Recreate an accessible for the given content node in the presshell. */ void RecreateAccessible(mozilla::PresShell* aPresShell, nsIContent* aContent); - void FireAccessibleEvent(uint32_t aEvent, Accessible* aTarget); + void FireAccessibleEvent(uint32_t aEvent, LocalAccessible* aTarget); /** * Notify accessibility that the size has become available for an image. * This occurs when the size of an image is initially not known, but we've * now loaded enough data to know the size. * Called by layout. */ void NotifyOfImageSizeAvailable(mozilla::PresShell* aPresShell, @@ -246,18 +246,18 @@ class nsAccessibilityService final : pub /** * Creates an accessible for the given DOM node. * * @param aNode [in] the given node * @param aContext [in] context the accessible is created in * @param aIsSubtreeHidden [out, optional] indicates whether the node's * frame and its subtree is hidden */ - Accessible* CreateAccessible(nsINode* aNode, Accessible* aContext, - bool* aIsSubtreeHidden = nullptr); + LocalAccessible* CreateAccessible(nsINode* aNode, LocalAccessible* aContext, + bool* aIsSubtreeHidden = nullptr); mozilla::a11y::role MarkupRole(const nsIContent* aContent) const { const mozilla::a11y::HTMLMarkupMapInfo* markupMap = mHTMLMarkupMap.Get(aContent->NodeInfo()->NameAtom()); return markupMap ? markupMap->role : mozilla::a11y::roles::NOTHING; } /** @@ -319,18 +319,18 @@ class nsAccessibilityService final : pub /** * Shutdowns accessibility service. */ void Shutdown(); /** * Create an accessible whose type depends on the given frame. */ - already_AddRefed<Accessible> CreateAccessibleByFrameType( - nsIFrame* aFrame, nsIContent* aContent, Accessible* aContext); + already_AddRefed<LocalAccessible> CreateAccessibleByFrameType( + nsIFrame* aFrame, nsIContent* aContent, LocalAccessible* aContext); /** * Notify observers about change of the accessibility service's consumers. */ void NotifyOfConsumersChange(); /** * Get a JSON string representing the accessibility service consumers.
--- a/accessible/base/nsAccessiblePivot.cpp +++ b/accessible/base/nsAccessiblePivot.cpp @@ -33,17 +33,17 @@ class RuleCache : public PivotRule { nsCOMPtr<nsIAccessibleTraversalRule> mRule; Maybe<nsTArray<uint32_t>> mAcceptRoles; uint32_t mPreFilter; }; //////////////////////////////////////////////////////////////////////////////// // nsAccessiblePivot -nsAccessiblePivot::nsAccessiblePivot(Accessible* aRoot) +nsAccessiblePivot::nsAccessiblePivot(LocalAccessible* aRoot) : mRoot(aRoot), mModalRoot(nullptr), mPosition(nullptr), mStartOffset(-1), mEndOffset(-1) { NS_ASSERTION(aRoot, "A root accessible is required"); } @@ -80,17 +80,17 @@ nsAccessiblePivot::GetPosition(nsIAccess NS_IF_ADDREF(*aPosition = ToXPC(mPosition)); return NS_OK; } NS_IMETHODIMP nsAccessiblePivot::SetPosition(nsIAccessible* aPosition) { - RefPtr<Accessible> position = nullptr; + RefPtr<LocalAccessible> position = nullptr; if (aPosition) { position = aPosition->ToInternalAccessible(); if (!position || !IsDescendantOf(position, GetActiveRoot())) { return NS_ERROR_INVALID_ARG; } } @@ -111,17 +111,17 @@ nsAccessiblePivot::GetModalRoot(nsIAcces NS_IF_ADDREF(*aModalRoot = ToXPC(mModalRoot)); return NS_OK; } NS_IMETHODIMP nsAccessiblePivot::SetModalRoot(nsIAccessible* aModalRoot) { - Accessible* modalRoot = nullptr; + LocalAccessible* modalRoot = nullptr; if (aModalRoot) { modalRoot = aModalRoot->ToInternalAccessible(); if (!modalRoot || !IsDescendantOf(modalRoot, mRoot)) { return NS_ERROR_INVALID_ARG; } } @@ -158,17 +158,17 @@ nsAccessiblePivot::SetTextRange(nsIAcces NS_ENSURE_TRUE( aStartOffset <= aEndOffset && (aStartOffset >= 0 || (aStartOffset != -1 && aEndOffset != -1)), NS_ERROR_INVALID_ARG); nsCOMPtr<nsIAccessible> xpcAcc = do_QueryInterface(aTextAccessible); NS_ENSURE_ARG(xpcAcc); - RefPtr<Accessible> acc = xpcAcc->ToInternalAccessible(); + RefPtr<LocalAccessible> acc = xpcAcc->ToInternalAccessible(); NS_ENSURE_ARG(acc); HyperTextAccessible* position = acc->AsHyperText(); if (!position || !IsDescendantOf(position, GetActiveRoot())) { return NS_ERROR_INVALID_ARG; } // Make sure the given offsets don't exceed the character count. @@ -194,17 +194,17 @@ NS_IMETHODIMP nsAccessiblePivot::MoveNext(nsIAccessibleTraversalRule* aRule, nsIAccessible* aAnchor, bool aIncludeStart, bool aIsFromUserInput, uint8_t aArgc, bool* aResult) { NS_ENSURE_ARG(aResult); NS_ENSURE_ARG(aRule); *aResult = false; - Accessible* anchor = mPosition; + LocalAccessible* anchor = mPosition; if (aArgc > 0 && aAnchor) anchor = aAnchor->ToInternalAccessible(); if (anchor && (anchor->IsDefunct() || !IsDescendantOf(anchor, GetActiveRoot()))) { return NS_ERROR_NOT_IN_TREE; } Pivot pivot(GetActiveRoot()); @@ -229,17 +229,17 @@ NS_IMETHODIMP nsAccessiblePivot::MovePrevious(nsIAccessibleTraversalRule* aRule, nsIAccessible* aAnchor, bool aIncludeStart, bool aIsFromUserInput, uint8_t aArgc, bool* aResult) { NS_ENSURE_ARG(aResult); NS_ENSURE_ARG(aRule); *aResult = false; - Accessible* anchor = mPosition; + LocalAccessible* anchor = mPosition; if (aArgc > 0 && aAnchor) anchor = aAnchor->ToInternalAccessible(); if (anchor && (anchor->IsDefunct() || !IsDescendantOf(anchor, GetActiveRoot()))) { return NS_ERROR_NOT_IN_TREE; } Pivot pivot(GetActiveRoot()); @@ -262,17 +262,17 @@ nsAccessiblePivot::MovePrevious(nsIAcces NS_IMETHODIMP nsAccessiblePivot::MoveFirst(nsIAccessibleTraversalRule* aRule, bool aIsFromUserInput, uint8_t aArgc, bool* aResult) { NS_ENSURE_ARG(aResult); NS_ENSURE_ARG(aRule); - Accessible* root = GetActiveRoot(); + LocalAccessible* root = GetActiveRoot(); NS_ENSURE_TRUE(root && !root->IsDefunct(), NS_ERROR_NOT_IN_TREE); Pivot pivot(GetActiveRoot()); RuleCache rule(aRule); AccessibleOrProxy newPos = pivot.First(rule); if (!newPos.IsNull() && newPos.IsAccessible()) { *aResult = MovePivotInternal(newPos.AsAccessible(), nsIAccessiblePivot::REASON_FIRST, @@ -288,17 +288,17 @@ nsAccessiblePivot::MoveFirst(nsIAccessib NS_IMETHODIMP nsAccessiblePivot::MoveLast(nsIAccessibleTraversalRule* aRule, bool aIsFromUserInput, uint8_t aArgc, bool* aResult) { NS_ENSURE_ARG(aResult); NS_ENSURE_ARG(aRule); - Accessible* root = GetActiveRoot(); + LocalAccessible* root = GetActiveRoot(); NS_ENSURE_TRUE(root && !root->IsDefunct(), NS_ERROR_NOT_IN_TREE); Pivot pivot(root); RuleCache rule(aRule); AccessibleOrProxy newPos = pivot.Last(rule); if (!newPos.IsNull() && newPos.IsAccessible()) { *aResult = MovePivotInternal(newPos.AsAccessible(), nsIAccessiblePivot::REASON_LAST, @@ -318,21 +318,22 @@ nsAccessiblePivot::MoveNextByText(TextBo bool* aResult) { NS_ENSURE_ARG(aResult); *aResult = false; Pivot pivot(GetActiveRoot()); int32_t newStart = mStartOffset, newEnd = mEndOffset; - Accessible* newPos = pivot.NextText(mPosition, &newStart, &newEnd, aBoundary); + LocalAccessible* newPos = + pivot.NextText(mPosition, &newStart, &newEnd, aBoundary); if (newPos) { *aResult = true; int32_t oldStart = mStartOffset, oldEnd = mEndOffset; - Accessible* oldPos = mPosition; + LocalAccessible* oldPos = mPosition; mStartOffset = newStart; mEndOffset = newEnd; mPosition = newPos; NotifyOfPivotChange(oldPos, oldStart, oldEnd, nsIAccessiblePivot::REASON_NEXT, aBoundary, (aArgc > 0) ? aIsFromUserInput : true); } @@ -345,21 +346,22 @@ nsAccessiblePivot::MovePreviousByText(Te bool* aResult) { NS_ENSURE_ARG(aResult); *aResult = false; Pivot pivot(GetActiveRoot()); int32_t newStart = mStartOffset, newEnd = mEndOffset; - Accessible* newPos = pivot.PrevText(mPosition, &newStart, &newEnd, aBoundary); + LocalAccessible* newPos = + pivot.PrevText(mPosition, &newStart, &newEnd, aBoundary); if (newPos) { *aResult = true; int32_t oldStart = mStartOffset, oldEnd = mEndOffset; - Accessible* oldPos = mPosition; + LocalAccessible* oldPos = mPosition; mStartOffset = newStart; mEndOffset = newEnd; mPosition = newPos; NotifyOfPivotChange(oldPos, oldStart, oldEnd, nsIAccessiblePivot::REASON_PREV, aBoundary, (aArgc > 0) ? aIsFromUserInput : true); } @@ -371,17 +373,17 @@ nsAccessiblePivot::MoveToPoint(nsIAccess int32_t aY, bool aIgnoreNoMatch, bool aIsFromUserInput, uint8_t aArgc, bool* aResult) { NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aRule); *aResult = false; - Accessible* root = GetActiveRoot(); + LocalAccessible* root = GetActiveRoot(); NS_ENSURE_TRUE(root && !root->IsDefunct(), NS_ERROR_NOT_IN_TREE); RuleCache rule(aRule); Pivot pivot(root); AccessibleOrProxy newPos = pivot.AtPoint(aX, aY, rule); if ((!newPos.IsNull() && newPos.IsAccessible()) || !aIgnoreNoMatch) { // TODO does this need a proxy check? @@ -412,42 +414,42 @@ NS_IMETHODIMP nsAccessiblePivot::RemoveObserver(nsIAccessiblePivotObserver* aObserver) { NS_ENSURE_ARG(aObserver); return mObservers.RemoveElement(aObserver) ? NS_OK : NS_ERROR_FAILURE;