widget/windows/winrt/UIAAccessibilityBridge.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/windows/winrt/UIAAccessibilityBridge.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#if defined(ACCESSIBILITY)
    1.10 +
    1.11 +#include "UIAAccessibilityBridge.h"
    1.12 +#include "MetroUtils.h"
    1.13 +
    1.14 +#include <OAIdl.h>
    1.15 +
    1.16 +#include "nsIAccessibleEvent.h"
    1.17 +#include "nsIAccessibleEditableText.h"
    1.18 +#include "nsIPersistentProperties2.h"
    1.19 +
    1.20 +// generated
    1.21 +#include "UIABridge.h"
    1.22 +
    1.23 +#include <wrl/implements.h>
    1.24 +
    1.25 +using namespace mozilla::a11y;
    1.26 +
    1.27 +namespace mozilla {
    1.28 +namespace widget {
    1.29 +namespace winrt {
    1.30 +
    1.31 +using namespace Microsoft::WRL;
    1.32 +
    1.33 +NS_IMPL_ISUPPORTS(AccessibilityBridge, nsIObserver)
    1.34 +
    1.35 +nsresult
    1.36 +AccessibilityBridge::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData)
    1.37 +{
    1.38 +  nsCOMPtr<nsIAccessibleEvent> ev = do_QueryInterface(aSubject);
    1.39 +  if (!ev) {
    1.40 +    return NS_OK;
    1.41 +  }
    1.42 +
    1.43 +  uint32_t eventType = 0;
    1.44 +  ev->GetEventType(&eventType);
    1.45 +  if (eventType == nsIAccessibleEvent::EVENT_FOCUS) {
    1.46 +    Microsoft::WRL::ComPtr<IUIABridge> bridgePtr;
    1.47 +    mBridge.As(&bridgePtr);
    1.48 +    if (bridgePtr) {
    1.49 +      bridgePtr->FocusChangeEvent();
    1.50 +    }
    1.51 +  }
    1.52 +
    1.53 +  return NS_OK;
    1.54 +}
    1.55 +
    1.56 +} } }
    1.57 +
    1.58 +#endif // ACCESSIBILITY

mercurial