Bug 1479642: Make Windows XULMenuitemAccessibleWrap::Name const so it overrides AccessibleWrap::Name. r=surkov a=lizzard
authorJames Teh <jteh@mozilla.com>
Tue, 31 Jul 2018 11:22:59 +1000
changeset 478266 d3320ef71ef2f89fdee994272383f4ea7b2124a0
parent 478265 07f7e41737eb3e874f3b26190333de4ce62bdb3e
child 478267 b1ca612ffb07f244735f83df37947652de43a6bf
push id9596
push userdluca@mozilla.com
push dateMon, 06 Aug 2018 08:24:12 +0000
treeherdermozilla-beta@d3320ef71ef2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, lizzard
bugs1479642, 1438193
milestone62.0
Bug 1479642: Make Windows XULMenuitemAccessibleWrap::Name const so it overrides AccessibleWrap::Name. r=surkov a=lizzard This again exposes the accelerator (e.g. Ctrl+T for New Tab) for menu items via IAccessible::accName on windows. Bug 1438193 made Accessible::Name const. On Windows, XULMenuitemAccessibleWrap::Name is overridden to append the accelerator to the name. Unfortunately, this override was missed when converting Name to const (and wasn't a compile error because it didn't use the override keyword). As such, this override stopped being called; we always called the const version, since that's the one inherited into AccessibleWrap. Making this const causes this override to be called. MozReview-Commit-ID: 7Gb199mzhHa
accessible/windows/msaa/XULMenuAccessibleWrap.cpp
accessible/windows/msaa/XULMenuAccessibleWrap.h
--- a/accessible/windows/msaa/XULMenuAccessibleWrap.cpp
+++ b/accessible/windows/msaa/XULMenuAccessibleWrap.cpp
@@ -14,17 +14,17 @@ using namespace mozilla::a11y;
 
 XULMenuitemAccessibleWrap::
   XULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
   XULMenuitemAccessible(aContent, aDoc)
 {
 }
 
 ENameValueFlag
-XULMenuitemAccessibleWrap::Name(nsString& aName)
+XULMenuitemAccessibleWrap::Name(nsString& aName) const
 {
   // XXX This should be done in MSAA's get_accName() so that Accessible::Name()]
   // provides the same results on all platforms
   XULMenuitemAccessible::Name(aName);
   if (aName.IsEmpty())
     return eNameOK;
 
   nsAutoString accel;
--- a/accessible/windows/msaa/XULMenuAccessibleWrap.h
+++ b/accessible/windows/msaa/XULMenuAccessibleWrap.h
@@ -13,15 +13,15 @@ namespace a11y {
 
 class XULMenuitemAccessibleWrap : public XULMenuitemAccessible
 {
 public:
   XULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~XULMenuitemAccessibleWrap() {}
 
   // nsIAccessible
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif