bug 1301148 - add custom gecko interface r=aklotz, mshal
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Mon, 14 Nov 2016 04:14:29 -0500
changeset 375412 8fb5cdbd3d10f442d298d16a6b6af019aec5dc60
parent 375411 7f805db8e59e60c357a771f4a4abd189571c62c7
child 375413 01d2197f9141a5bac61340059b387472b60bf515
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz, mshal
bugs1301148
milestone53.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 1301148 - add custom gecko interface r=aklotz, mshal
accessible/interfaces/gecko/IGeckoCustom.idl
accessible/interfaces/gecko/Makefile.in
accessible/interfaces/gecko/moz.build
accessible/interfaces/moz.build
accessible/windows/msaa/AccessibleWrap.cpp
accessible/windows/msaa/GeckoCustom.cpp
accessible/windows/msaa/GeckoCustom.h
accessible/windows/msaa/moz.build
toolkit/library/moz.build
toolkit/library/xulrunner.rc
new file mode 100644
--- /dev/null
+++ b/accessible/interfaces/gecko/IGeckoCustom.idl
@@ -0,0 +1,23 @@
+/* -*- 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/. */
+
+import "objidl.idl";
+import "oaidl.idl";
+
+[object, uuid(7510360f-cdae-4de9-88c8-d167eda62afc)]
+interface IGeckoCustom : IUnknown
+{
+}
+
+
+[
+    uuid(55769d85-f830-4d76-9e39-3670914a28f7),
+    helpstring("private custom gecko interfaces")
+]
+library IGeckoCustom
+{
+  interface IGeckoCustom;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/interfaces/gecko/Makefile.in
@@ -0,0 +1,31 @@
+# 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/.
+
+GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
+
+MIDL_GENERATED_FILES = \
+	IGeckoCustom.h \
+	IGeckoCustom_p.c \
+	IGeckoCustom_i.c \
+	$(NULL)
+
+$(MIDL_GENERATED_FILES): done_gen
+
+done_gen: IGeckoCustom.idl
+	$(MIDL) $(MIDL_FLAGS) -I $(srcdir) -Oicf $(srcdir)/IGeckoCustom.idl
+	touch $@
+
+export:: done_gen
+
+midl_exports := \
+    IGeckoCustom.h \
+    IGeckoCustom_i.c \
+    $(NULL)
+
+INSTALL_TARGETS += midl_exports
+midl_exports_FILES := $(midl_exports)
+midl_exports_DEST = $(DIST)/include
+midl_exports_TARGET := midl
+
+export:: midl
new file mode 100644
--- /dev/null
+++ b/accessible/interfaces/gecko/moz.build
@@ -0,0 +1,25 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+SOURCES += [
+    '!dlldata.c',
+    '!IGeckoCustom_i.c',
+    '!IGeckoCustom_p.c',
+]
+
+GENERATED_FILES += [
+    'IGeckoCustom.tlb',
+]
+
+FINAL_LIBRARY = 'xul'
+
+# The Windows MIDL code generator creates things like:
+#
+#   #endif !_MIDL_USE_GUIDDEF_
+#
+# which clang-cl complains about.  MSVC doesn't, so turn this warning off.
+if CONFIG['CLANG_CL']:
+    CFLAGS += ['-Wno-extra-tokens']
--- a/accessible/interfaces/moz.build
+++ b/accessible/interfaces/moz.build
@@ -1,16 +1,16 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows' and CONFIG['COMPILE_ENVIRONMENT']:
-    DIRS += ['msaa', 'ia2']
+    DIRS += ['gecko', 'msaa', 'ia2']
 
 XPIDL_SOURCES += [
     'nsIAccessibilityService.idl',
     'nsIAccessible.idl',
     'nsIAccessibleApplication.idl',
     'nsIAccessibleCaretMoveEvent.idl',
     'nsIAccessibleDocument.idl',
     'nsIAccessibleEditableText.idl',
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -6,16 +6,17 @@
 
 #include "AccessibleWrap.h"
 #include "Accessible-inl.h"
 
 #include "Compatibility.h"
 #include "DocAccessible-inl.h"
 #include "mozilla/a11y/DocAccessibleParent.h"
 #include "EnumVariant.h"
+#include "GeckoCustom.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsIAccessibleEvent.h"
 #include "nsWinUtils.h"
 #include "mozilla/a11y/ProxyAccessible.h"
 #include "ProxyWrappers.h"
 #include "ServiceProvider.h"
 #include "Relation.h"
@@ -152,16 +153,22 @@ AccessibleWrap::QueryInterface(REFIID ii
   }
 
   if (nullptr == *ppv && !IsProxy()) {
     HRESULT hr = ia2AccessibleValue::QueryInterface(iid, ppv);
     if (SUCCEEDED(hr))
       return hr;
   }
 
+  if (!*ppv && iid == IID_IGeckoCustom) {
+    RefPtr<GeckoCustom> gkCrap = new GeckoCustom(this);
+    gkCrap.forget(ppv);
+    return S_OK;
+  }
+
   if (nullptr == *ppv)
     return E_NOINTERFACE;
 
   (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
new file mode 100644
--- /dev/null
+++ b/accessible/windows/msaa/GeckoCustom.cpp
@@ -0,0 +1,14 @@
+/* -*- 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 "GeckoCustom.h"
+
+using namespace mozilla;
+using namespace mozilla::a11y;
+
+IMPL_IUNKNOWN_QUERY_HEAD(GeckoCustom)
+IMPL_IUNKNOWN_QUERY_IFACE(IGeckoCustom)
+IMPL_IUNKNOWN_QUERY_TAIL_AGGREGATED(mAcc)
new file mode 100644
--- /dev/null
+++ b/accessible/windows/msaa/GeckoCustom.h
@@ -0,0 +1,45 @@
+/* -*- 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/. */
+
+#ifndef mozilla_a11y_GeckoCustom_h_
+#define mozilla_a11y_GeckoCustom_h_
+
+#include "AccessibleWrap.h"
+#include "IUnknownImpl.h"
+#include "IGeckoCustom.h"
+
+namespace mozilla {
+namespace a11y {
+
+/**
+ * a dumpster to put things exposed by the xpcom API but not a windows platform
+ * API for the purposes of testing.
+ */
+class GeckoCustom final : public IGeckoCustom
+{
+public:
+  explicit GeckoCustom(AccessibleWrap* aAcc) : mAcc(aAcc) {}
+
+  // IUnknown
+  DECL_IUNKNOWN
+
+private:
+  GeckoCustom() = delete;
+  GeckoCustom& operator =(const GeckoCustom&) = delete;
+  GeckoCustom(const GeckoCustom&) = delete;
+  GeckoCustom(GeckoCustom&&) = delete;
+  GeckoCustom& operator=(GeckoCustom&&) = delete;
+
+  ~GeckoCustom() { }
+
+protected:
+  RefPtr<AccessibleWrap> mAcc;
+};
+
+} // a11y namespace
+} // mozilla namespace
+
+#endif
--- a/accessible/windows/msaa/moz.build
+++ b/accessible/windows/msaa/moz.build
@@ -18,16 +18,17 @@ EXPORTS.mozilla.a11y += [
 
 UNIFIED_SOURCES += [
     'AccessibleWrap.cpp',
     'ApplicationAccessibleWrap.cpp',
     'ARIAGridAccessibleWrap.cpp',
     'Compatibility.cpp',
     'DocAccessibleWrap.cpp',
     'EnumVariant.cpp',
+    'GeckoCustom.cpp',
     'HTMLTableAccessibleWrap.cpp',
     'HTMLWin32ObjectAccessible.cpp',
     'HyperTextAccessibleWrap.cpp',
     'ImageAccessibleWrap.cpp',
     'IUnknownImpl.cpp',
     'MsaaIdGenerator.cpp',
     'nsWinUtils.cpp',
     'Platform.cpp',
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -42,16 +42,19 @@ def Libxul(name):
         DELAYLOAD_DLLS += ['msdmo.dll']
 
     if CONFIG['OS_ARCH'] == 'WINNT':
         DELAYLOAD_DLLS += [
             'api-ms-win-core-winrt-l1-1-0.dll',
             'api-ms-win-core-winrt-string-l1-1-0.dll',
         ]
 
+    if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['ACCESSIBILITY']:
+        LOCAL_INCLUDES += ['!/accessible/interfaces/gecko/']
+
     if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
         LOCAL_INCLUDES += [
             '/widget/windows',
             '/xpcom/base',
         ]
         # config/version.mk says $(srcdir)/$(RCINCLUDE), and this needs to
         # be valid in both toolkit/library and toolkit/library/gtest.
         # Eventually, the make backend would do its own path canonicalization
--- a/toolkit/library/xulrunner.rc
+++ b/toolkit/library/xulrunner.rc
@@ -1,5 +1,8 @@
 /* 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 "widget.rc"
+#ifdef ACCESSIBILITY
+1 typelib IGeckoCustom.tlb
+#endif