LCOV - code coverage report
Current view: directory - accessible/src/xpcom - nsAccEvent.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 102 0 0.0 %
Date: 2012-06-02 Functions: 42 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Mozilla Foundation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #include "nsAccEvent.h"
      40                 : #include "nsAccUtils.h"
      41                 : #include "nsDocAccessible.h"
      42                 : 
      43                 : ////////////////////////////////////////////////////////////////////////////////
      44                 : // nsAccEvent
      45                 : ////////////////////////////////////////////////////////////////////////////////
      46                 : 
      47               0 : NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
      48                 : 
      49                 : NS_IMETHODIMP
      50               0 : nsAccEvent::GetIsFromUserInput(bool* aIsFromUserInput)
      51                 : {
      52               0 :   *aIsFromUserInput = mEvent->IsFromUserInput();
      53               0 :   return NS_OK;
      54                 : }
      55                 : 
      56                 : NS_IMETHODIMP
      57               0 : nsAccEvent::GetEventType(PRUint32* aEventType)
      58                 : {
      59               0 :   *aEventType = mEvent->GetEventType();
      60               0 :   return NS_OK;
      61                 : }
      62                 : 
      63                 : NS_IMETHODIMP
      64               0 : nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
      65                 : {
      66               0 :   NS_ENSURE_ARG_POINTER(aAccessible);
      67               0 :   *aAccessible = nsnull;
      68                 : 
      69               0 :   NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
      70               0 :   return NS_OK;
      71                 : }
      72                 : 
      73                 : NS_IMETHODIMP
      74               0 : nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
      75                 : {
      76               0 :   NS_ENSURE_ARG_POINTER(aDOMNode);
      77               0 :   *aDOMNode = nsnull;
      78                 : 
      79               0 :   nsINode* node = mEvent->GetNode();
      80               0 :   if (node)
      81               0 :     CallQueryInterface(node, aDOMNode);
      82                 : 
      83               0 :   return NS_OK;
      84                 : }
      85                 : 
      86                 : NS_IMETHODIMP
      87               0 : nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument** aDocAccessible)
      88                 : {
      89               0 :   NS_ENSURE_ARG_POINTER(aDocAccessible);
      90                 : 
      91               0 :   NS_IF_ADDREF(*aDocAccessible = mEvent->GetDocAccessible());
      92               0 :   return NS_OK;
      93                 : }
      94                 : 
      95                 : 
      96                 : ////////////////////////////////////////////////////////////////////////////////
      97                 : // nsAccStateChangeEvent
      98                 : ////////////////////////////////////////////////////////////////////////////////
      99                 : 
     100               0 : NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
     101                 :                              nsIAccessibleStateChangeEvent)
     102                 : 
     103                 : NS_IMETHODIMP
     104               0 : nsAccStateChangeEvent::GetState(PRUint32* aState)
     105                 : {
     106               0 :   NS_ENSURE_ARG_POINTER(aState);
     107                 : 
     108               0 :   PRUint32 state1 = 0, state2 = 0;
     109               0 :   PRUint64 state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
     110               0 :   nsAccUtils::To32States(state, &state1, &state2);
     111                 : 
     112               0 :   *aState = state1 | state2; // only one state is not 0
     113               0 :   return NS_OK;
     114                 : }
     115                 : 
     116                 : NS_IMETHODIMP
     117               0 : nsAccStateChangeEvent::IsExtraState(bool* aIsExtraState)
     118                 : {
     119               0 :   NS_ENSURE_ARG_POINTER(aIsExtraState);
     120                 : 
     121               0 :   PRUint32 state1 = 0, state2 = 0;
     122               0 :   PRUint64 state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
     123               0 :   nsAccUtils::To32States(state, &state1, &state2);
     124                 : 
     125               0 :   *aIsExtraState = (state2 != 0);
     126               0 :   return NS_OK;
     127                 : }
     128                 : 
     129                 : NS_IMETHODIMP
     130               0 : nsAccStateChangeEvent::IsEnabled(bool* aIsEnabled)
     131                 : {
     132               0 :   NS_ENSURE_ARG_POINTER(aIsEnabled);
     133               0 :   *aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
     134               0 :   return NS_OK;
     135                 : }
     136                 : 
     137                 : ////////////////////////////////////////////////////////////////////////////////
     138                 : // nsAccTextChangeEvent
     139                 : ////////////////////////////////////////////////////////////////////////////////
     140                 : 
     141               0 : NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
     142                 :                              nsIAccessibleTextChangeEvent)
     143                 : 
     144                 : NS_IMETHODIMP
     145               0 : nsAccTextChangeEvent::GetStart(PRInt32* aStart)
     146                 : {
     147               0 :   NS_ENSURE_ARG_POINTER(aStart);
     148               0 :   *aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
     149               0 :   return NS_OK;
     150                 : }
     151                 : 
     152                 : NS_IMETHODIMP
     153               0 : nsAccTextChangeEvent::GetLength(PRUint32* aLength)
     154                 : {
     155               0 :   NS_ENSURE_ARG_POINTER(aLength);
     156               0 :   *aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
     157               0 :   return NS_OK;
     158                 : }
     159                 : 
     160                 : NS_IMETHODIMP
     161               0 : nsAccTextChangeEvent::IsInserted(bool* aIsInserted)
     162                 : {
     163               0 :   NS_ENSURE_ARG_POINTER(aIsInserted);
     164               0 :   *aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
     165               0 :   return NS_OK;
     166                 : }
     167                 : 
     168                 : NS_IMETHODIMP
     169               0 : nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
     170                 : {
     171               0 :   static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
     172               0 :   return NS_OK;
     173                 : }
     174                 : 
     175                 : 
     176                 : ////////////////////////////////////////////////////////////////////////////////
     177                 : // nsAccHideEvent
     178                 : ////////////////////////////////////////////////////////////////////////////////
     179                 : 
     180               0 : NS_IMPL_ISUPPORTS_INHERITED1(nsAccHideEvent, nsAccEvent,
     181                 :                              nsIAccessibleHideEvent)
     182                 : 
     183                 : NS_IMETHODIMP
     184               0 : nsAccHideEvent::GetTargetParent(nsIAccessible** aAccessible)
     185                 : {
     186               0 :   NS_ENSURE_ARG_POINTER(aAccessible);
     187                 : 
     188               0 :   NS_IF_ADDREF(*aAccessible =
     189               0 :     static_cast<AccHideEvent*>(mEvent.get())->TargetParent());
     190               0 :   return NS_OK;
     191                 : }
     192                 : 
     193                 : NS_IMETHODIMP
     194               0 : nsAccHideEvent::GetTargetNextSibling(nsIAccessible** aAccessible)
     195                 : {
     196               0 :   NS_ENSURE_ARG_POINTER(aAccessible);
     197                 : 
     198               0 :   NS_IF_ADDREF(*aAccessible =
     199               0 :     static_cast<AccHideEvent*>(mEvent.get())->TargetNextSibling());
     200               0 :   return NS_OK;
     201                 : }
     202                 : 
     203                 : NS_IMETHODIMP
     204               0 : nsAccHideEvent::GetTargetPrevSibling(nsIAccessible** aAccessible)
     205                 : {
     206               0 :   NS_ENSURE_ARG_POINTER(aAccessible);
     207                 : 
     208               0 :   NS_IF_ADDREF(*aAccessible =
     209               0 :     static_cast<AccHideEvent*>(mEvent.get())->TargetPrevSibling());
     210               0 :   return NS_OK;
     211                 : }
     212                 : 
     213                 : 
     214                 : ////////////////////////////////////////////////////////////////////////////////
     215                 : // nsAccCaretMoveEvent
     216                 : ////////////////////////////////////////////////////////////////////////////////
     217                 : 
     218               0 : NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
     219                 :                              nsIAccessibleCaretMoveEvent)
     220                 : 
     221                 : NS_IMETHODIMP
     222               0 : nsAccCaretMoveEvent::GetCaretOffset(PRInt32 *aCaretOffset)
     223                 : {
     224               0 :   NS_ENSURE_ARG_POINTER(aCaretOffset);
     225                 : 
     226               0 :   *aCaretOffset = static_cast<AccCaretMoveEvent*>(mEvent.get())->GetCaretOffset();
     227               0 :   return NS_OK;
     228                 : }
     229                 : 
     230                 : ////////////////////////////////////////////////////////////////////////////////
     231                 : // nsAccTableChangeEvent
     232                 : ////////////////////////////////////////////////////////////////////////////////
     233                 : 
     234               0 : NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
     235                 :                              nsIAccessibleTableChangeEvent)
     236                 : 
     237                 : NS_IMETHODIMP
     238               0 : nsAccTableChangeEvent::GetRowOrColIndex(PRInt32 *aRowOrColIndex)
     239                 : {
     240               0 :   NS_ENSURE_ARG_POINTER(aRowOrColIndex);
     241                 : 
     242                 :   *aRowOrColIndex =
     243               0 :     static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
     244               0 :   return NS_OK;
     245                 : }
     246                 : 
     247                 : NS_IMETHODIMP
     248               0 : nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
     249                 : {
     250               0 :   NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
     251                 : 
     252               0 :   *aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
     253               0 :   return NS_OK;
     254                 : }
     255                 : 
     256                 : ////////////////////////////////////////////////////////////////////////////////
     257                 : // nsAccVirtualCursorChangeEvent
     258                 : ////////////////////////////////////////////////////////////////////////////////
     259                 : 
     260               0 : NS_IMPL_ISUPPORTS_INHERITED1(nsAccVirtualCursorChangeEvent, nsAccEvent,
     261                 :                              nsIAccessibleVirtualCursorChangeEvent)
     262                 : 
     263                 : NS_IMETHODIMP
     264               0 : nsAccVirtualCursorChangeEvent::GetOldAccessible(nsIAccessible** aOldAccessible)
     265                 : {
     266               0 :   NS_ENSURE_ARG_POINTER(aOldAccessible);
     267                 : 
     268                 :   *aOldAccessible =
     269               0 :     static_cast<AccVCChangeEvent*>(mEvent.get())->OldAccessible();
     270               0 :   NS_IF_ADDREF(*aOldAccessible);
     271               0 :   return NS_OK;
     272                 : }
     273                 : 
     274                 : NS_IMETHODIMP
     275               0 : nsAccVirtualCursorChangeEvent::GetOldStartOffset(PRInt32* aOldStartOffset)
     276                 : {
     277               0 :   NS_ENSURE_ARG_POINTER(aOldStartOffset);
     278                 : 
     279                 :   *aOldStartOffset =
     280               0 :     static_cast<AccVCChangeEvent*>(mEvent.get())->OldStartOffset();
     281               0 :   return NS_OK;
     282                 : }
     283                 : 
     284                 : NS_IMETHODIMP
     285               0 : nsAccVirtualCursorChangeEvent::GetOldEndOffset(PRInt32* aOldEndOffset)
     286                 : {
     287               0 :   NS_ENSURE_ARG_POINTER(aOldEndOffset);
     288                 : 
     289                 :   *aOldEndOffset =
     290               0 :     static_cast<AccVCChangeEvent*>(mEvent.get())->OldEndOffset();
     291               0 :   return NS_OK;
     292                 : }

Generated by: LCOV version 1.7