LCOV - code coverage report
Current view: directory - accessible/src/xforms - nsXFormsFormControlsAccessible.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 247 0 0.0 %
Date: 2012-06-02 Functions: 64 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) 2006
      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 "nsXFormsFormControlsAccessible.h"
      40                 : 
      41                 : #include "nsTextEquivUtils.h"
      42                 : #include "Role.h"
      43                 : #include "States.h"
      44                 : 
      45                 : using namespace mozilla::a11y;
      46                 : 
      47                 : ////////////////////////////////////////////////////////////////////////////////
      48                 : // nsXFormsLabelAccessible
      49                 : ////////////////////////////////////////////////////////////////////////////////
      50                 : 
      51               0 : nsXFormsLabelAccessible::
      52                 :   nsXFormsLabelAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
      53               0 :   nsXFormsAccessible(aContent, aDoc)
      54                 : {
      55               0 : }
      56                 : 
      57                 : role
      58               0 : nsXFormsLabelAccessible::NativeRole()
      59                 : {
      60               0 :   return roles::LABEL;
      61                 : }
      62                 : 
      63                 : nsresult
      64               0 : nsXFormsLabelAccessible::GetNameInternal(nsAString& aName)
      65                 : {
      66                 :   // XXX Correct name calculation for this, see bug 453594.
      67               0 :   return NS_OK;
      68                 : }
      69                 : 
      70                 : void
      71               0 : nsXFormsLabelAccessible::Description(nsString& aDescription)
      72                 : {
      73                 :   nsTextEquivUtils::
      74                 :     GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
      75               0 :                            aDescription);
      76               0 : }
      77                 : 
      78                 : 
      79                 : ////////////////////////////////////////////////////////////////////////////////
      80                 : // nsXFormsOutputAccessible
      81                 : ////////////////////////////////////////////////////////////////////////////////
      82                 : 
      83               0 : nsXFormsOutputAccessible::
      84                 :   nsXFormsOutputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
      85               0 :   nsXFormsAccessible(aContent, aDoc)
      86                 : {
      87               0 : }
      88                 : 
      89                 : role
      90               0 : nsXFormsOutputAccessible::NativeRole()
      91                 : {
      92               0 :   return roles::STATICTEXT;
      93                 : }
      94                 : 
      95                 : 
      96                 : ////////////////////////////////////////////////////////////////////////////////
      97                 : // nsXFormsTriggerAccessible
      98                 : ////////////////////////////////////////////////////////////////////////////////
      99                 : 
     100               0 : nsXFormsTriggerAccessible::
     101                 :   nsXFormsTriggerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     102               0 :   nsXFormsAccessible(aContent, aDoc)
     103                 : {
     104               0 : }
     105                 : 
     106                 : role
     107               0 : nsXFormsTriggerAccessible::NativeRole()
     108                 : {
     109               0 :   return roles::PUSHBUTTON;
     110                 : }
     111                 : 
     112                 : NS_IMETHODIMP
     113               0 : nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
     114                 : {
     115               0 :   aValue.Truncate();
     116               0 :   return NS_OK;
     117                 : }
     118                 : 
     119                 : PRUint8
     120               0 : nsXFormsTriggerAccessible::ActionCount()
     121                 : {
     122               0 :   return 1;
     123                 : }
     124                 : 
     125                 : NS_IMETHODIMP
     126               0 : nsXFormsTriggerAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
     127                 : {
     128               0 :   if (aIndex == eAction_Click) {
     129               0 :     aName.AssignLiteral("press");
     130               0 :     return NS_OK;
     131                 :   }
     132               0 :   return NS_ERROR_INVALID_ARG;
     133                 : }
     134                 : 
     135                 : NS_IMETHODIMP
     136               0 : nsXFormsTriggerAccessible::DoAction(PRUint8 aIndex)
     137                 : {
     138               0 :   if (aIndex != eAction_Click)
     139               0 :     return NS_ERROR_INVALID_ARG;
     140                 : 
     141               0 :   DoCommand();
     142               0 :   return NS_OK;
     143                 : }
     144                 : 
     145                 : 
     146                 : ////////////////////////////////////////////////////////////////////////////////
     147                 : // nsXFormsInputAccessible
     148                 : ////////////////////////////////////////////////////////////////////////////////
     149                 : 
     150               0 : nsXFormsInputAccessible::
     151                 :   nsXFormsInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     152               0 :   nsXFormsEditableAccessible(aContent, aDoc)
     153                 : {
     154               0 : }
     155                 : 
     156               0 : NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
     157                 : 
     158                 : role
     159               0 : nsXFormsInputAccessible::NativeRole()
     160                 : {
     161               0 :   return roles::ENTRY;
     162                 : }
     163                 : 
     164                 : PRUint8
     165               0 : nsXFormsInputAccessible::ActionCount()
     166                 : {
     167               0 :   return 1;
     168                 : }
     169                 : 
     170                 : NS_IMETHODIMP
     171               0 : nsXFormsInputAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
     172                 : {
     173               0 :   if (aIndex != eAction_Click)
     174               0 :     return NS_ERROR_INVALID_ARG;
     175                 : 
     176               0 :   aName.AssignLiteral("activate");
     177               0 :   return NS_OK;
     178                 : }
     179                 : 
     180                 : NS_IMETHODIMP
     181               0 : nsXFormsInputAccessible::DoAction(PRUint8 aIndex)
     182                 : {
     183               0 :   if (aIndex != eAction_Click)
     184               0 :     return NS_ERROR_INVALID_ARG;
     185                 : 
     186               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     187               0 :   return sXFormsService->Focus(DOMNode);
     188                 : }
     189                 : 
     190                 : 
     191                 : ////////////////////////////////////////////////////////////////////////////////
     192                 : // nsXFormsInputBooleanAccessible
     193                 : ////////////////////////////////////////////////////////////////////////////////
     194                 : 
     195               0 : nsXFormsInputBooleanAccessible::
     196                 :   nsXFormsInputBooleanAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     197               0 :   nsXFormsAccessible(aContent, aDoc)
     198                 : {
     199               0 : }
     200                 : 
     201                 : role
     202               0 : nsXFormsInputBooleanAccessible::NativeRole()
     203                 : {
     204               0 :   return roles::CHECKBUTTON;
     205                 : }
     206                 : 
     207                 : PRUint64
     208               0 : nsXFormsInputBooleanAccessible::NativeState()
     209                 : {
     210               0 :   PRUint64 state = nsXFormsAccessible::NativeState();
     211                 : 
     212               0 :   nsAutoString value;
     213               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     214               0 :   nsresult rv = sXFormsService->GetValue(DOMNode, value);
     215               0 :   NS_ENSURE_SUCCESS(rv, state);
     216                 : 
     217               0 :   if (value.EqualsLiteral("true"))
     218               0 :     state |= states::CHECKED;
     219                 : 
     220               0 :   return state;
     221                 : }
     222                 : 
     223                 : PRUint8
     224               0 : nsXFormsInputBooleanAccessible::ActionCount()
     225                 : {
     226               0 :   return 1;
     227                 : }
     228                 : 
     229                 : NS_IMETHODIMP
     230               0 : nsXFormsInputBooleanAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
     231                 : {
     232               0 :   if (aIndex != eAction_Click)
     233               0 :     return NS_ERROR_INVALID_ARG;
     234                 : 
     235               0 :   nsAutoString value;
     236               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     237               0 :   nsresult rv = sXFormsService->GetValue(DOMNode, value);
     238               0 :   NS_ENSURE_SUCCESS(rv, rv);
     239                 : 
     240               0 :   if (value.EqualsLiteral("true"))
     241               0 :     aName.AssignLiteral("uncheck");
     242                 :   else
     243               0 :     aName.AssignLiteral("check");
     244                 : 
     245               0 :   return NS_OK;
     246                 : }
     247                 : 
     248                 : NS_IMETHODIMP
     249               0 : nsXFormsInputBooleanAccessible::DoAction(PRUint8 aIndex)
     250                 : {
     251               0 :   if (aIndex != eAction_Click)
     252               0 :     return NS_ERROR_INVALID_ARG;
     253                 : 
     254               0 :   DoCommand();
     255               0 :   return NS_OK;
     256                 : }
     257                 : 
     258                 : 
     259                 : ////////////////////////////////////////////////////////////////////////////////
     260                 : // nsXFormsInputDateAccessible
     261                 : ////////////////////////////////////////////////////////////////////////////////
     262                 : 
     263               0 : nsXFormsInputDateAccessible::
     264                 :   nsXFormsInputDateAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     265               0 :   nsXFormsContainerAccessible(aContent, aDoc)
     266                 : {
     267               0 : }
     268                 : 
     269                 : role
     270               0 : nsXFormsInputDateAccessible::NativeRole()
     271                 : {
     272               0 :   return roles::DROPLIST;
     273                 : }
     274                 : 
     275                 : 
     276                 : ////////////////////////////////////////////////////////////////////////////////
     277                 : // nsXFormsSecretAccessible
     278                 : ////////////////////////////////////////////////////////////////////////////////
     279                 : 
     280               0 : nsXFormsSecretAccessible::
     281                 :   nsXFormsSecretAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     282               0 :   nsXFormsInputAccessible(aContent, aDoc)
     283                 : {
     284               0 : }
     285                 : 
     286                 : role
     287               0 : nsXFormsSecretAccessible::NativeRole()
     288                 : {
     289               0 :   return roles::PASSWORD_TEXT;
     290                 : }
     291                 : 
     292                 : PRUint64
     293               0 : nsXFormsSecretAccessible::NativeState()
     294                 : {
     295               0 :   return nsXFormsInputAccessible::NativeState() | states::PROTECTED;
     296                 : }
     297                 : 
     298                 : NS_IMETHODIMP
     299               0 : nsXFormsSecretAccessible::GetValue(nsAString& aValue)
     300                 : {
     301               0 :   return NS_ERROR_FAILURE;
     302                 : }
     303                 : 
     304                 : 
     305                 : ////////////////////////////////////////////////////////////////////////////////
     306                 : // nsXFormsRangeAccessible
     307                 : ////////////////////////////////////////////////////////////////////////////////
     308                 : 
     309               0 : nsXFormsRangeAccessible::
     310                 :   nsXFormsRangeAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     311               0 :   nsXFormsAccessible(aContent, aDoc)
     312                 : {
     313               0 : }
     314                 : 
     315                 : role
     316               0 : nsXFormsRangeAccessible::NativeRole()
     317                 : {
     318               0 :   return roles::SLIDER;
     319                 : }
     320                 : 
     321                 : PRUint64
     322               0 : nsXFormsRangeAccessible::NativeState()
     323                 : {
     324               0 :   PRUint64 state = nsXFormsAccessible::NativeState();
     325                 : 
     326               0 :   PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
     327               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     328               0 :   nsresult rv = sXFormsService->IsInRange(DOMNode, &isInRange);
     329               0 :   NS_ENSURE_SUCCESS(rv, state);
     330                 : 
     331               0 :   if (isInRange == nsIXFormsUtilityService::STATE_OUT_OF_RANGE)
     332               0 :     state |= states::INVALID;
     333                 : 
     334               0 :   return state;
     335                 : }
     336                 : 
     337                 : NS_IMETHODIMP
     338               0 : nsXFormsRangeAccessible::GetMaximumValue(double *aMaximumValue)
     339                 : {
     340               0 :   NS_ENSURE_ARG_POINTER(aMaximumValue);
     341                 : 
     342               0 :   nsAutoString value;
     343               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     344               0 :   nsresult rv = sXFormsService->GetRangeEnd(DOMNode, value);
     345               0 :   NS_ENSURE_SUCCESS(rv, rv);
     346                 : 
     347               0 :   PRInt32 error = NS_OK;
     348               0 :   *aMaximumValue = value.ToDouble(&error);
     349               0 :   return error;
     350                 : }
     351                 : 
     352                 : NS_IMETHODIMP
     353               0 : nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue)
     354                 : {
     355               0 :   NS_ENSURE_ARG_POINTER(aMinimumValue);
     356                 : 
     357               0 :   nsAutoString value;
     358               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     359               0 :   nsresult rv = sXFormsService->GetRangeStart(DOMNode, value);
     360               0 :   NS_ENSURE_SUCCESS(rv, rv);
     361                 : 
     362               0 :   PRInt32 error = NS_OK;
     363               0 :   *aMinimumValue = value.ToDouble(&error);
     364               0 :   return error;
     365                 : }
     366                 : 
     367                 : NS_IMETHODIMP
     368               0 : nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement)
     369                 : {
     370               0 :   NS_ENSURE_ARG_POINTER(aMinimumIncrement);
     371                 : 
     372               0 :   nsAutoString value;
     373               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     374               0 :   nsresult rv = sXFormsService->GetRangeStep(DOMNode, value);
     375               0 :   NS_ENSURE_SUCCESS(rv, rv);
     376                 : 
     377               0 :   PRInt32 error = NS_OK;
     378               0 :   *aMinimumIncrement = value.ToDouble(&error);
     379               0 :   return error;
     380                 : }
     381                 : 
     382                 : NS_IMETHODIMP
     383               0 : nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue)
     384                 : {
     385               0 :   NS_ENSURE_ARG_POINTER(aCurrentValue);
     386                 : 
     387               0 :   nsAutoString value;
     388               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     389               0 :   nsresult rv = sXFormsService->GetValue(DOMNode, value);
     390               0 :   NS_ENSURE_SUCCESS(rv, rv);
     391                 : 
     392               0 :   PRInt32 error = NS_OK;
     393               0 :   *aCurrentValue = value.ToDouble(&error);
     394               0 :   return error;
     395                 : }
     396                 : 
     397                 : 
     398                 : ////////////////////////////////////////////////////////////////////////////////
     399                 : // nsXFormsSelectAccessible
     400                 : ////////////////////////////////////////////////////////////////////////////////
     401                 : 
     402               0 : nsXFormsSelectAccessible::
     403                 :   nsXFormsSelectAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     404               0 :   nsXFormsContainerAccessible(aContent, aDoc)
     405                 : {
     406               0 : }
     407                 : 
     408                 : PRUint64
     409               0 : nsXFormsSelectAccessible::NativeState()
     410                 : {
     411               0 :   PRUint64 state = nsXFormsContainerAccessible::NativeState();
     412                 : 
     413               0 :   PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
     414               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     415               0 :   nsresult rv = sXFormsService->IsInRange(DOMNode, &isInRange);
     416               0 :   NS_ENSURE_SUCCESS(rv, state);
     417                 : 
     418               0 :   if (isInRange == nsIXFormsUtilityService::STATE_OUT_OF_RANGE)
     419               0 :     state |= states::INVALID;
     420                 : 
     421               0 :   return state;
     422                 : }
     423                 : 
     424                 : 
     425                 : ////////////////////////////////////////////////////////////////////////////////
     426                 : // nsXFormsChoicesAccessible
     427                 : ////////////////////////////////////////////////////////////////////////////////
     428                 : 
     429               0 : nsXFormsChoicesAccessible::
     430                 :   nsXFormsChoicesAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     431               0 :   nsXFormsAccessible(aContent, aDoc)
     432                 : {
     433               0 : }
     434                 : 
     435                 : role
     436               0 : nsXFormsChoicesAccessible::NativeRole()
     437                 : {
     438               0 :   return roles::GROUPING;
     439                 : }
     440                 : 
     441                 : NS_IMETHODIMP
     442               0 : nsXFormsChoicesAccessible::GetValue(nsAString& aValue)
     443                 : {
     444               0 :   aValue.Truncate();
     445               0 :   return NS_OK;
     446                 : }
     447                 : 
     448                 : void
     449               0 : nsXFormsChoicesAccessible::CacheChildren()
     450                 : {
     451               0 :   CacheSelectChildren();
     452               0 : }
     453                 : 
     454                 : 
     455                 : ////////////////////////////////////////////////////////////////////////////////
     456                 : // nsXFormsSelectFullAccessible
     457                 : ////////////////////////////////////////////////////////////////////////////////
     458                 : 
     459               0 : nsXFormsSelectFullAccessible::
     460                 :   nsXFormsSelectFullAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     461               0 :   nsXFormsSelectableAccessible(aContent, aDoc)
     462                 : {
     463               0 : }
     464                 : 
     465                 : role
     466               0 : nsXFormsSelectFullAccessible::NativeRole()
     467                 : {
     468               0 :   return roles::GROUPING;
     469                 : }
     470                 : 
     471                 : void
     472               0 : nsXFormsSelectFullAccessible::CacheChildren()
     473                 : {
     474               0 :   CacheSelectChildren();
     475               0 : }
     476                 : 
     477                 : 
     478                 : ////////////////////////////////////////////////////////////////////////////////
     479                 : // nsXFormsItemCheckgroupAccessible
     480                 : ////////////////////////////////////////////////////////////////////////////////
     481                 : 
     482               0 : nsXFormsItemCheckgroupAccessible::
     483                 :   nsXFormsItemCheckgroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     484               0 :   nsXFormsSelectableItemAccessible(aContent, aDoc)
     485                 : {
     486               0 : }
     487                 : 
     488                 : role
     489               0 : nsXFormsItemCheckgroupAccessible::NativeRole()
     490                 : {
     491               0 :   return roles::CHECKBUTTON;
     492                 : }
     493                 : 
     494                 : PRUint64
     495               0 : nsXFormsItemCheckgroupAccessible::NativeState()
     496                 : {
     497               0 :   PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
     498                 : 
     499               0 :   if (IsSelected())
     500               0 :     state |= states::CHECKED;
     501                 : 
     502               0 :   return state;
     503                 : }
     504                 : 
     505                 : NS_IMETHODIMP
     506               0 : nsXFormsItemCheckgroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
     507                 : {
     508               0 :   if (aIndex != eAction_Click)
     509               0 :     return NS_ERROR_INVALID_ARG;
     510                 : 
     511               0 :   if (IsSelected())
     512               0 :     aName.AssignLiteral("uncheck");
     513                 :   else
     514               0 :     aName.AssignLiteral("check");
     515                 : 
     516               0 :   return NS_OK;
     517                 : }
     518                 : 
     519                 : 
     520                 : ////////////////////////////////////////////////////////////////////////////////
     521                 : // nsXFormsItemRadiogroupAccessible
     522                 : ////////////////////////////////////////////////////////////////////////////////
     523                 : 
     524               0 : nsXFormsItemRadiogroupAccessible::
     525                 :   nsXFormsItemRadiogroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     526               0 :   nsXFormsSelectableItemAccessible(aContent, aDoc)
     527                 : {
     528               0 : }
     529                 : 
     530                 : role
     531               0 : nsXFormsItemRadiogroupAccessible::NativeRole()
     532                 : {
     533               0 :   return roles::RADIOBUTTON;
     534                 : }
     535                 : 
     536                 : PRUint64
     537               0 : nsXFormsItemRadiogroupAccessible::NativeState()
     538                 : {
     539               0 :   PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
     540                 : 
     541               0 :   if (IsSelected())
     542               0 :     state |= states::CHECKED;
     543                 : 
     544               0 :   return state;
     545                 : }
     546                 : 
     547                 : NS_IMETHODIMP
     548               0 : nsXFormsItemRadiogroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
     549                 : {
     550               0 :   if (aIndex != eAction_Click)
     551               0 :     return NS_ERROR_INVALID_ARG;
     552                 : 
     553               0 :   aName.AssignLiteral("select");
     554               0 :   return NS_OK;
     555                 : }
     556                 : 
     557                 : 
     558                 : ////////////////////////////////////////////////////////////////////////////////
     559                 : // nsXFormsSelectComboboxAccessible
     560                 : ////////////////////////////////////////////////////////////////////////////////
     561                 : 
     562               0 : nsXFormsSelectComboboxAccessible::
     563                 :   nsXFormsSelectComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     564               0 :   nsXFormsSelectableAccessible(aContent, aDoc)
     565                 : {
     566               0 : }
     567                 : 
     568                 : role
     569               0 : nsXFormsSelectComboboxAccessible::NativeRole()
     570                 : {
     571               0 :   return roles::COMBOBOX;
     572                 : }
     573                 : 
     574                 : PRUint64
     575               0 : nsXFormsSelectComboboxAccessible::NativeState()
     576                 : {
     577               0 :   PRUint64 state = nsXFormsSelectableAccessible::NativeState();
     578                 : 
     579               0 :   bool isOpen = false;
     580               0 :   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
     581               0 :   nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
     582               0 :   NS_ENSURE_SUCCESS(rv, state);
     583                 : 
     584               0 :   if (isOpen)
     585               0 :     state |= states::EXPANDED;
     586                 :   else
     587               0 :     state |= states::COLLAPSED;
     588                 : 
     589               0 :   return state | states::HASPOPUP | states::FOCUSABLE;
     590                 : }
     591                 : 
     592                 : bool
     593               0 : nsXFormsSelectComboboxAccessible::CanHaveAnonChildren()
     594                 : {
     595               0 :   return true;
     596                 : }
     597                 : 
     598                 : 
     599                 : ////////////////////////////////////////////////////////////////////////////////
     600                 : // nsXFormsItemComboboxAccessible
     601                 : ////////////////////////////////////////////////////////////////////////////////
     602                 : 
     603               0 : nsXFormsItemComboboxAccessible::
     604                 :   nsXFormsItemComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     605               0 :   nsXFormsSelectableItemAccessible(aContent, aDoc)
     606                 : {
     607               0 : }
     608                 : 
     609                 : role
     610               0 : nsXFormsItemComboboxAccessible::NativeRole()
     611                 : {
     612               0 :   return roles::LISTITEM;
     613                 : }
     614                 : 
     615                 : PRUint64
     616               0 : nsXFormsItemComboboxAccessible::NativeState()
     617                 : {
     618               0 :   PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
     619                 : 
     620               0 :   if (state & states::UNAVAILABLE)
     621               0 :     return state;
     622                 : 
     623               0 :   state |= states::SELECTABLE;
     624               0 :   if (IsSelected())
     625               0 :     state |= states::SELECTED;
     626                 : 
     627               0 :   return state;
     628                 : }
     629                 : 
     630                 : NS_IMETHODIMP
     631               0 : nsXFormsItemComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
     632                 : {
     633               0 :   if (aIndex != eAction_Click)
     634               0 :     return NS_ERROR_INVALID_ARG;
     635                 : 
     636               0 :   aName.AssignLiteral("select");
     637               0 :   return NS_OK;
     638                 : }
     639                 : 

Generated by: LCOV version 1.7