Bug 1373739 - Make macOS compatible with the headless WPT changes. r?bdahl draft
authorMichael Smith <michael@spinda.net>
Fri, 28 Jul 2017 23:20:21 -0700
changeset 620655 a88cd6078e0601b324480035211aec524b3b9e49
parent 620654 41e873dc73c139333469f5ed204222bf4f09de5b
child 620656 4ecf4d499ea9de4f03c5e249202415b6df885f85
push id72121
push userbmo:lists@spinda.net
push dateThu, 03 Aug 2017 18:54:01 +0000
reviewersbdahl
bugs1373739
milestone56.0a1
Bug 1373739 - Make macOS compatible with the headless WPT changes. r?bdahl MozReview-Commit-ID: BeDPpG6G6Iy
accessible/mac/AccessibleWrap.mm
widget/PlatformWidgetTypes.ipdlh
--- a/accessible/mac/AccessibleWrap.mm
+++ b/accessible/mac/AccessibleWrap.mm
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DocAccessible.h"
 #include "nsObjCExceptions.h"
 
 #include "Accessible-inl.h"
 #include "nsAccUtils.h"
 #include "Role.h"
+#include "gfxPlatform.h"
 
 #import "mozAccessible.h"
 #import "mozActionElements.h"
 #import "mozHTMLAccessible.h"
 #import "mozTableAccessible.h"
 #import "mozTextAccessible.h"
 
 using namespace mozilla;
@@ -181,16 +182,22 @@ AccessibleWrap::AncestorIsFlat()
   return false;
 }
 
 void
 a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
+  // Under headless mode we don't have access to a native window, so we skip
+  // dispatching native events.
+  if (gfxPlatform::IsHeadless()) {
+    return;
+  }
+
   switch (aEventType) {
     case nsIAccessibleEvent::EVENT_FOCUS:
       [aNativeAcc didReceiveFocus];
       break;
     case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
     case nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE:
       [aNativeAcc valueDidChange];
       break;
--- a/widget/PlatformWidgetTypes.ipdlh
+++ b/widget/PlatformWidgetTypes.ipdlh
@@ -12,15 +12,10 @@ include HeadlessWidgetTypes;
 namespace mozilla {
 namespace widget {
 
 union CompositorWidgetInitData
 {
   HeadlessCompositorWidgetInitData;
 };
 
-struct HeadlessCompositorWidgetInitData
-{
-  LayoutDeviceIntSize InitialClientSize;
-};
-
 } // namespace widget
 } // namespace mozilla