accessible/src/mac/RootAccessibleWrap.mm

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/src/mac/RootAccessibleWrap.mm	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; 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 +#include "RootAccessibleWrap.h"
    1.10 +
    1.11 +#include "mozDocAccessible.h"
    1.12 +
    1.13 +#include "nsCOMPtr.h"
    1.14 +#include "nsObjCExceptions.h"
    1.15 +#include "nsIFrame.h"
    1.16 +#include "nsView.h"
    1.17 +#include "nsIWidget.h"
    1.18 +
    1.19 +using namespace mozilla::a11y;
    1.20 +
    1.21 +RootAccessibleWrap::
    1.22 +  RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
    1.23 +                     nsIPresShell* aPresShell) :
    1.24 +  RootAccessible(aDocument, aRootContent, aPresShell)
    1.25 +{
    1.26 +}
    1.27 +
    1.28 +RootAccessibleWrap::~RootAccessibleWrap()
    1.29 +{
    1.30 +}
    1.31 +
    1.32 +Class
    1.33 +RootAccessibleWrap::GetNativeType()
    1.34 +{
    1.35 +  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
    1.36 +
    1.37 +  return [mozRootAccessible class];
    1.38 +
    1.39 +  NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
    1.40 +}
    1.41 +
    1.42 +void
    1.43 +RootAccessibleWrap::GetNativeWidget(void** aOutView)
    1.44 +{
    1.45 +  nsIFrame *frame = GetFrame();
    1.46 +  if (frame) {
    1.47 +    nsView *view = frame->GetViewExternal();
    1.48 +    if (view) {
    1.49 +      nsIWidget *widget = view->GetWidget();
    1.50 +      if (widget) {
    1.51 +        *aOutView = (void**)widget->GetNativeData (NS_NATIVE_WIDGET);
    1.52 +        NS_ASSERTION (*aOutView, 
    1.53 +                      "Couldn't get the native NSView parent we need to connect the accessibility hierarchy!");
    1.54 +      }
    1.55 +    }
    1.56 +  }
    1.57 +}

mercurial