Closed Bug 1694865 Opened 4 years ago Closed 4 years ago

Separate Windows MSAA implementation into its own class hierarchy

Categories

(Core :: Disability Access APIs, task)

Desktop
Windows
task

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

Crash Data

Attachments

(25 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Currently, MSAA and IA2 are implemented by inheritance into AccessibleWrap and friends. Although other OS do use the Wrap classes to provide some platform specific functionality, Windows is the only platform to implement all of the actual OS calls in the Wrap classes. While this has worked well enough until now, it becomes problematic in our aim to unify local and remote accessibles because we need both local and remote to use the MSAA/IA2 code.

If it were just AccessibleWrap, we could probably solve this by making AccessibleWrap a subclass of Accessible (instead of LocalAccessible). We'd then have LocalAccessible and RemoteAccessible subclass AccessibleWrap. However, this becomes problematic for HyperTextAccessible, TableAccessible, etc., since they will eventually be base interfaces supported by both local and remote.

Eventually, we also won't need the MSAA stuff in the content process. While having it there doesn't really do any harm, it's pointless and confusing.

So, we are going to create a separate class hierarchy: MsaaAccessible, MsaaDocAccessible, etc. These will only inherit the COM interfaces, not Gecko classes. There will be pointers to move between the two.

Blocks: 1695116

This simply adds the new MsaaAccessible class, moves the inheritance of ia2Accessible, etc. to that class, and makes AccessibleWrap inherit from MsaaAccessible.

Once MsaaAccessible is no longer inherited into AccessibleWrap, we'll null the AccessibleWrap pointer when the AccessibleWrap shuts down.
At that point, MsaaAccessible won't deal with defunct AccessibleWraps.
Prepare for this by removing defunct special cases from most callers.

Rather than static_casting this, there is now a LocalAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
For LocalAccessibles other than this, rather than static_casting, GetNativeInterface is now used.
Finally, ia2AccessibleValue::QueryInterface was adjusted to AddRef the queried interface on this, not the AccessibleWrap.

Rather than static_casting this, there is now an ImageAcc/TextAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
For LocalAccessibles other than this, rather than static_casting, GetNativeInterface is now used.
ia2AccessibleText was calling AccessibleWrap::ConvertToIA2Attributes, but this is actually declared in ia2Accessible, so we just add the necessary include and change the call.

For now, we can't use MsaaAccessible::LocalAcc() because these are inherited into multiple Wrap classes, but we don't know which at runtime.
However, we can still prepare by creating a Table/CellAcc() method which can be easily replaced once we kill the Wrap inheritance.
For LocalAccessibles other than this, rather than static_casting, GetNativeInterface is now used.

For now, ApplicationAccessibleWrap inherits from the new class.
ApplicationAccessible calls are made via an AppAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.

For now, DocAccessibleWrap inherits from MsaaDocAccessible and MsaaDocAccessible inherits from DocAccessible.
DocAccessible calls are made via a DocAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.

For now, RootAccessibleWrap inherits from MsaaRootAccessible and MsaaRootAccessible inherits from RootAccessible.
RootAccessible calls are made via a RootAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.

For now, XULMenuitemAccessibleWrap inherits from MsaaXULMenuitemAccessible and MsaaXULMenuitemAccessible inherits from XULMenuitemAccessible.
Accessible calls are made via MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.

This is necessary to enable COM objects which aggregate AccessibleWrap/DocAccessibleWrap to aggregate MsaaAccessible/MsaaDocAccessible instead.
Ultimately, the IUnknown implementation will be moved out of AccessibleWrap altogether and into MsaaAccessible, but we can't do that yet.
Even though MsaaDocAccessible indirectly inherits from MsaaAccessible, we have to override QueryInterface due to the naming conflict with nsISupports.

These objects need to aggregate the primary COM object (MsaaAccessible).
Once the IUnknown implementation moves out of AccessibleWrap, it won't be possible to aggregate *AccessibleWrap any more.

It now aggregates MsaaAccessible and uses GetNativeInterface when returning accessibles to clients.

In this patch, these new functions just static_cast, but they'll soon be returning a different object.

Until now, our a11y COM implementation has relied on AddRef and Release from nsISupports, but this soon won't be possible.
Instead, MsaaAccessible will implement its own reference counting using DECL_IUNKNOWN.

DECL_IUNKNOWN previously declared AddRef and Release as final.
This doesn't work for MsaaAccessible because there is an aggregatable subclass (MsaaRootAccessible) and because some subclasses will inherit additional interfaces (ia2AccessibleApplication, etc.).

When subclasses inherit additional interfaces, they inherit an additional IUnknown, so the compiler doesn't know which AddRef/Release to call.
To support this, IMPL_IUNKNOWN_REFCOUNTING_INHERITED HAS BEEN ADDED to specify which base class implements reference counting.

It now uses GetNativeInterface when returning IAccessibles to clients.

  1. ia2AccessibleApplication is instantiated for ApplicationAccessible, so it now inherits from MsaaAccessible.
  2. ia2AccessibleHypertext is instantiated for HyperTextAccessible, so it now inherits from MsaaAccessible.
  3. ia2AccessibleImage is instantiated for ImageAccessible, so it inherits from MsaaAccessible.
  4. ia2AccessibleTable is instantiated for TableAccessible, so it inherits from ia2AccessibleHypertext (since most TableAccessible implementations implement HyperTextAccessible).
  5. ia2AccessibleTableCell is instantiated for TableCellAccessible, so it inherits from ia2AccessibleHypertext (since most TableCellAccessible implementations implement HyperTextAccessible).
  6. All of the above override QueryInterface as appropriate, replacing the QueryInterface implementations from all *AccessibleWrap classes.
  7. The ARIAGridAccessibleWrap, HTMLTableAccessibleWrap, ImageAccessibleWrap, XULListboxAccessibleWrap and XULTreeGridAccessibleWrap classes previously served only to host ia2AccessibleImage, ia2AccessibleTable, etc. Since these ia2 classes are now instantiated via MsaaAccessible, these Wrap classes have been removed and replaced with aliases.
  8. The QueryInterface handling for ISimpleDOMText has been moved into MsaaAccessible. Since this was the only purpose of TextLeafAccessibleWrap, this too has been removed and replaced with an alias.
  9. AccessibleWrap now holds a strong reference to MsaaAccessible and MsaaAccessible holds a weak reference to AccessibleWrap.
  10. An MsaaAccessible (or derived class) is instantiated by MsaaAccessible::Create.
  11. MsaaAccessible now implements its own COM reference counting using DECL_IUNKNOWN, since it does not need nsISupports (XPCOM).
Blocks: 1706851
Blocks: 1706854
Keywords: leave-open
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9d27bb4a4ab4 part 1: Create new skeleton MsaaAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/f283f3cf03cf part 2: Add missing includes and forward declarations to fix build errors when unified build order is changed in subsequent patches. r=morgan https://hg.mozilla.org/integration/autoland/rev/ba238a1e12df part 3: Move id management to MsaaAccessible. r=morgan https://hg.mozilla.org/integration/autoland/rev/5dcd83a1c82c part 4: Move foundational helper functions for retrieving descendant accessibles to MsaaAccessible. r=morgan https://hg.mozilla.org/integration/autoland/rev/86c1ddcc8e31 part 5: Move shutdown code into MsaaAccessible. r=morgan https://hg.mozilla.org/integration/autoland/rev/7c345ab7e3be part 6: Move event firing code to MsaaAccessible. r=morgan
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7dfb88fc34a1 part 7: Move all IAccessible and IDispatch methods to MsaaAccessible. r=morgan https://hg.mozilla.org/integration/autoland/rev/40c7e0bcfcfd part 8: Remove some dead code from AccessibleWrap. r=morgan https://hg.mozilla.org/integration/autoland/rev/acafc5835608 part 9: Make MsaaAccessible::LocalAcc return null if defunct. r=morgan https://hg.mozilla.org/integration/autoland/rev/461b46e1a2cb part 10: Prepare ia2Accessible/Action/Component/Hyperlink/Relation/Value to not rely on AccessibleWrap inheritance. r=morgan https://hg.mozilla.org/integration/autoland/rev/309f737d3bc3 part 11: Prepare ia2AccessibleEditableText/Hypertext/Image/Text to not rely on AccessibleWrap inheritance. r=morgan https://hg.mozilla.org/integration/autoland/rev/53ed762843ec part 12: Prepare ia2AccessibleTable/TableCell to not rely on AccessibleWrap inheritance. r=morgan
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/62137fbc81cf part 13: Move COM IAccessibleApplication implementation to new ia2AccessibleApplication class. r=morgan https://hg.mozilla.org/integration/autoland/rev/61aad68338f7 part 14: Move DocAccessibleWrap's MSAA overrides to a new MsaaDocAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/70b71a350151 part 15: Move RootAccessibleWrap's MSAA overrides and other COM stuff to a new MsaaRootAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/702b601cc6fc part 16: Move XULMenuitemAccessibleWrap's MSAA overrides to a new MsaaXULMenuitemAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/3ea7b46bb4f8 part 17: Transitional implementation of IUnknown in MsaaAccessible/MsaaDocAccessible which delegates to AccessibleWrap. r=morgan https://hg.mozilla.org/integration/autoland/rev/1a948c0ec982 part 18: Make EnumVariant, GeckoCustom and sdn*Accessible classes aggregate MsaaAccessible/MsaaDocAccessible instead of AccessibleWrap/DocAccessibleWrap. r=morgan
Crash Signature: [@ mozilla::a11y::ia2AccessibleHyperlink::QueryInterface] [@ mozilla::a11y::MsaaAccessible::get_accValue] [@ mozilla::a11y::MsaaAccessible::get_accDescription]
Attachment #9217387 - Attachment description: Bug 1694865 part 12: Prepare ia2AccessibleTable/TableCell to not rely on AccessibleWrap inheritance. → Bug 1694865 part 11: Prepare ia2AccessibleTable/TableCell to not rely on AccessibleWrap inheritance.
Attachment #9217388 - Attachment description: Bug 1694865 part 13: Move COM IAccessibleApplication implementation to new ia2AccessibleApplication class. → Bug 1694865 part 12: Move COM IAccessibleApplication implementation to new ia2AccessibleApplication class.
Attachment #9217389 - Attachment description: Bug 1694865 part 14: Move DocAccessibleWrap's MSAA overrides to a new MsaaDocAccessible class. → Bug 1694865 part 13: Move DocAccessibleWrap's MSAA overrides to a new MsaaDocAccessible class.
Attachment #9217390 - Attachment description: Bug 1694865 part 15: Move RootAccessibleWrap's MSAA overrides and other COM stuff to a new MsaaRootAccessible class. → Bug 1694865 part 14: Move RootAccessibleWrap's MSAA overrides and other COM stuff to a new MsaaRootAccessible class.
Attachment #9217391 - Attachment description: Bug 1694865 part 16: Move XULMenuitemAccessibleWrap's MSAA overrides to a new MsaaXULMenuitemAccessible class. → Bug 1694865 part 15: Move XULMenuitemAccessibleWrap's MSAA overrides to a new MsaaXULMenuitemAccessible class.
Attachment #9217392 - Attachment description: Bug 1694865 part 17: Transitional implementation of IUnknown in MsaaAccessible/MsaaDocAccessible which delegates to AccessibleWrap. → Bug 1694865 part 16: Transitional implementation of IUnknown in MsaaAccessible/MsaaDocAccessible which delegates to AccessibleWrap.
Attachment #9217396 - Attachment description: Bug 1694865 part 21: Add various functions to get an MsaaAccessible/MsaaDocAccessible and use them where appropriate. → Bug 1694865 part 17: Add various functions to get an MsaaAccessible/MsaaDocAccessible and use them where appropriate.
Attachment #9217386 - Attachment description: Bug 1694865 part 11: Prepare ia2AccessibleEditableText/Hypertext/Image/Text to not rely on AccessibleWrap inheritance. → Bug 1694865 part 18: Prepare ia2AccessibleEditableText/Hypertext/Image/Text to not rely on AccessibleWrap inheritance.
Attachment #9217393 - Attachment description: Bug 1694865 part 18: Make EnumVariant, GeckoCustom and sdn*Accessible classes aggregate MsaaAccessible/MsaaDocAccessible instead of AccessibleWrap/DocAccessibleWrap. → Bug 1694865 part 19: Make EnumVariant, GeckoCustom and sdn*Accessible classes aggregate MsaaAccessible/MsaaDocAccessible instead of AccessibleWrap/DocAccessibleWrap.
Attachment #9217394 - Attachment description: Bug 1694865 part 19: Change ServiceProvider to not rely on AccessibleWrap inheritance. → Bug 1694865 part 20: Change ServiceProvider to not rely on AccessibleWrap inheritance.
Attachment #9217395 - Attachment description: Bug 1694865 part 20: Move QueryInterface implementation from AccessibleWrap to MsaaAccessible. → Bug 1694865 part 21: Move QueryInterface implementation from AccessibleWrap to MsaaAccessible.
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/de1f048e7f59 part 7: Move all IAccessible and IDispatch methods to MsaaAccessible. r=morgan https://hg.mozilla.org/integration/autoland/rev/d88639c490d2 part 8: Remove some dead code from AccessibleWrap. r=morgan https://hg.mozilla.org/integration/autoland/rev/16e294b866a6 part 9: Make MsaaAccessible::LocalAcc return null if defunct. r=morgan https://hg.mozilla.org/integration/autoland/rev/d215650648ea part 10: Prepare ia2Accessible/Action/Component/Hyperlink/Relation/Value to not rely on AccessibleWrap inheritance. r=morgan https://hg.mozilla.org/integration/autoland/rev/eaee7f4386eb part 11: Prepare ia2AccessibleTable/TableCell to not rely on AccessibleWrap inheritance. r=morgan https://hg.mozilla.org/integration/autoland/rev/5a74388d847a part 12: Move COM IAccessibleApplication implementation to new ia2AccessibleApplication class. r=morgan
Flags: needinfo?(jteh)
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eb4b8e688202 part 13: Move DocAccessibleWrap's MSAA overrides to a new MsaaDocAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/f967d16a75ae part 14: Move RootAccessibleWrap's MSAA overrides and other COM stuff to a new MsaaRootAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/bec6aca2ad6a part 15: Move XULMenuitemAccessibleWrap's MSAA overrides to a new MsaaXULMenuitemAccessible class. r=morgan https://hg.mozilla.org/integration/autoland/rev/262aaf0142f7 part 16: Transitional implementation of IUnknown in MsaaAccessible/MsaaDocAccessible which delegates to AccessibleWrap. r=morgan https://hg.mozilla.org/integration/autoland/rev/ae2dd5aeb7bf part 17: Add various functions to get an MsaaAccessible/MsaaDocAccessible and use them where appropriate. r=morgan https://hg.mozilla.org/integration/autoland/rev/0d57c4867cea part 18: Prepare ia2AccessibleEditableText/Hypertext/Image/Text to not rely on AccessibleWrap inheritance. r=morgan
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a53fb045a8e3 part 19: Make EnumVariant, GeckoCustom and sdn*Accessible classes aggregate MsaaAccessible/MsaaDocAccessible instead of AccessibleWrap/DocAccessibleWrap. r=morgan https://hg.mozilla.org/integration/autoland/rev/63f10db368c8 part 20: Change ServiceProvider to not rely on AccessibleWrap inheritance. r=morgan https://hg.mozilla.org/integration/autoland/rev/81587e0240ca part 21: Move QueryInterface implementation from AccessibleWrap to MsaaAccessible. r=morgan https://hg.mozilla.org/integration/autoland/rev/40805a1f2c1e part 22: Change LazyInstantiator to aggregate MsaaRootAccessible instead of RootAccessibleWrap. r=morgan https://hg.mozilla.org/integration/autoland/rev/893c83f82c16 part 23: Support inheritance/overriding of reference counting in IUnknownImpl. r=morgan https://hg.mozilla.org/integration/autoland/rev/f478ad97306a part 24: Change uiaRawElmProvider to not rely on AccessibleWrap inheritance. r=morgan
Keywords: leave-open
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4173ffb5fcb9 part 25: Remove inheritance of Msaa*Accessible/ia2*Accessible into *AccessibleWrap! r=morgan
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
Regressions: 1709250
Regressions: 1709594
Regressions: 1709987
Depends on: 1710212
Regressions: 1710212
Blocks: 1710983
Regressions: 1716549
Regressions: 1713126
Regressions: 1711439
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: