Bug 1386836: Add a nsACString overload to nsAccessibilityService::GetStringEventType; r=surkov
authorAaron Klotz <aklotz@mozilla.com>
Wed, 02 Aug 2017 15:39:51 -0600
changeset 373428 99837e8b5a692ac96257d2bae03a3867c4c80e7e
parent 373427 f3d9c8c76813e8119fe9e4bd1e46046e6e0f28c3
child 373429 1d042bcb2632ea6a38fa08dbe21a6e8a0ee46961
child 373533 9a678b3efcd23bbe3a62b76c8113384ec7714cec
push id32302
push userkwierso@gmail.com
push dateTue, 08 Aug 2017 22:14:39 +0000
treeherdermozilla-central@1d042bcb2632 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1386836
milestone57.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
Bug 1386836: Add a nsACString overload to nsAccessibilityService::GetStringEventType; r=surkov MozReview-Commit-ID: 9hMC54ki37e
accessible/base/nsAccessibilityService.cpp
accessible/base/nsAccessibilityService.h
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -925,16 +925,31 @@ nsAccessibilityService::GetStringEventTy
     aString.AssignLiteral("unknown");
     return;
   }
 
   CopyUTF8toUTF16(kEventTypeNames[aEventType], aString);
 }
 
 void
+nsAccessibilityService::GetStringEventType(uint32_t aEventType,
+                                           nsACString& aString)
+{
+  MOZ_ASSERT(nsIAccessibleEvent::EVENT_LAST_ENTRY == ArrayLength(kEventTypeNames),
+             "nsIAccessibleEvent constants are out of sync to kEventTypeNames");
+
+  if (aEventType >= ArrayLength(kEventTypeNames)) {
+    aString.AssignLiteral("unknown");
+    return;
+  }
+
+  aString = nsDependentCString(kEventTypeNames[aEventType]);
+}
+
+void
 nsAccessibilityService::GetStringRelationType(uint32_t aRelationType,
                                               nsAString& aString)
 {
   NS_ENSURE_TRUE_VOID(aRelationType <= static_cast<uint32_t>(RelationType::LAST));
 
 #define RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type) \
   case RelationType::geckoType: \
     aString.AssignLiteral(geckoTypeName); \
--- a/accessible/base/nsAccessibilityService.h
+++ b/accessible/base/nsAccessibilityService.h
@@ -119,16 +119,21 @@ public:
                        nsISupports **aStringStates);
 
   /**
    * Get a string equivalent for an accessible event value.
    */
   void GetStringEventType(uint32_t aEventType, nsAString& aString);
 
   /**
+   * Get a string equivalent for an accessible event value.
+   */
+  void GetStringEventType(uint32_t aEventType, nsACString& aString);
+
+  /**
    * Get a string equivalent for an accessible relation type.
    */
   void GetStringRelationType(uint32_t aRelationType, nsAString& aString);
 
   // nsAccesibilityService
   /**
    * Notification used to update the accessible tree when deck panel is
    * switched.