2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-02 04:30:29 -07:00
|
|
|
#include "HTMLElementAccessibles.h"
|
2010-03-16 23:02:28 -07:00
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
#include "DocAccessible.h"
|
2010-09-21 08:05:31 -07:00
|
|
|
#include "nsAccUtils.h"
|
2013-09-10 15:18:59 -07:00
|
|
|
#include "nsIPersistentProperties2.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsTextEquivUtils.h"
|
2011-08-09 18:44:00 -07:00
|
|
|
#include "Relation.h"
|
2012-01-11 19:07:35 -08:00
|
|
|
#include "Role.h"
|
2011-04-09 16:38:06 -07:00
|
|
|
#include "States.h"
|
2010-03-16 23:02:28 -07:00
|
|
|
|
2013-09-19 14:51:58 -07:00
|
|
|
#include "mozilla/dom/HTMLLabelElement.h"
|
|
|
|
|
2011-07-27 05:43:01 -07:00
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
2009-10-21 21:45:52 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-02 04:30:29 -07:00
|
|
|
// HTMLHRAccessible
|
2009-10-21 21:45:52 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
role
|
2012-06-02 04:30:29 -07:00
|
|
|
HTMLHRAccessible::NativeRole()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
return roles::SEPARATOR;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-06-11 01:23:18 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-02 04:30:29 -07:00
|
|
|
// HTMLBRAccessible
|
2010-06-11 01:23:18 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
role
|
2012-06-02 04:30:29 -07:00
|
|
|
HTMLBRAccessible::NativeRole()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
return roles::WHITESPACE;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t
|
2012-06-02 04:30:29 -07:00
|
|
|
HTMLBRAccessible::NativeState()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-04-11 23:18:42 -07:00
|
|
|
return states::READONLY;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-10-13 21:18:39 -07:00
|
|
|
ENameValueFlag
|
|
|
|
HTMLBRAccessible::NativeName(nsString& aName)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-01-04 07:02:17 -08:00
|
|
|
aName = static_cast<char16_t>('\n'); // Newline char
|
2012-10-13 21:18:39 -07:00
|
|
|
return eNameOK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2009-10-21 21:45:52 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-02 04:30:29 -07:00
|
|
|
// HTMLLabelAccessible
|
2009-10-21 21:45:52 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2008-02-22 01:52:01 -08:00
|
|
|
|
2012-06-02 04:30:29 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(HTMLLabelAccessible, HyperTextAccessible)
|
2010-06-11 01:23:18 -07:00
|
|
|
|
2012-10-13 21:18:39 -07:00
|
|
|
ENameValueFlag
|
|
|
|
HTMLLabelAccessible::NativeName(nsString& aName)
|
2009-02-18 23:06:14 -08:00
|
|
|
{
|
2012-10-13 21:18:39 -07:00
|
|
|
nsTextEquivUtils::GetNameFromSubtree(this, aName);
|
2012-10-16 23:38:16 -07:00
|
|
|
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-09-19 14:51:58 -07:00
|
|
|
Relation
|
2013-10-19 11:19:50 -07:00
|
|
|
HTMLLabelAccessible::RelationByType(RelationType aType)
|
2013-09-19 14:51:58 -07:00
|
|
|
{
|
|
|
|
Relation rel = AccessibleWrap::RelationByType(aType);
|
2013-10-19 11:19:50 -07:00
|
|
|
if (aType == RelationType::LABEL_FOR) {
|
2013-09-19 14:51:58 -07:00
|
|
|
nsRefPtr<dom::HTMLLabelElement> label = dom::HTMLLabelElement::FromContent(mContent);
|
|
|
|
rel.AppendTarget(mDoc, label->GetControl());
|
|
|
|
}
|
|
|
|
|
|
|
|
return rel;
|
|
|
|
}
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
role
|
2012-06-02 04:30:29 -07:00
|
|
|
HTMLLabelAccessible::NativeRole()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
return roles::LABEL;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-09-21 08:05:31 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsHTMLOuputAccessible
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-06-02 04:30:29 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(HTMLOutputAccessible, HyperTextAccessible)
|
2010-09-21 08:05:31 -07:00
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
Relation
|
2013-10-19 11:19:50 -07:00
|
|
|
HTMLOutputAccessible::RelationByType(RelationType aType)
|
2010-09-21 08:05:31 -07:00
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
Relation rel = AccessibleWrap::RelationByType(aType);
|
2013-10-19 11:19:50 -07:00
|
|
|
if (aType == RelationType::CONTROLLED_BY)
|
2012-03-22 22:26:52 -07:00
|
|
|
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for));
|
2010-09-21 08:05:31 -07:00
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
return rel;
|
2010-09-21 08:05:31 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
role
|
2012-06-02 04:30:29 -07:00
|
|
|
HTMLOutputAccessible::NativeRole()
|
2010-09-21 08:05:31 -07:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
return roles::SECTION;
|
2010-09-21 08:05:31 -07:00
|
|
|
}
|
|
|
|
|
2012-10-19 00:15:23 -07:00
|
|
|
already_AddRefed<nsIPersistentProperties>
|
|
|
|
HTMLOutputAccessible::NativeAttributes()
|
2010-09-21 08:05:31 -07:00
|
|
|
{
|
2012-10-19 00:15:23 -07:00
|
|
|
nsCOMPtr<nsIPersistentProperties> attributes =
|
|
|
|
AccessibleWrap::NativeAttributes();
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::live,
|
2010-09-21 08:05:31 -07:00
|
|
|
NS_LITERAL_STRING("polite"));
|
2012-06-02 04:30:29 -07:00
|
|
|
|
2012-10-19 00:15:23 -07:00
|
|
|
return attributes.forget();
|
2010-09-21 08:05:31 -07:00
|
|
|
}
|
|
|
|
|