This source file includes following definitions.
- setElement
- actionElement
- isEnabled
- isVisible
- isOffScreen
- isSelected
- setSelected
- canSetSelectedAttribute
- computeAccessibilityIsIgnored
- elementRect
- stringValue
#include "config.h"
#include "core/accessibility/AXMenuListOption.h"
#include "core/html/HTMLOptionElement.h"
namespace WebCore {
using namespace HTMLNames;
AXMenuListOption::AXMenuListOption()
{
}
void AXMenuListOption::setElement(HTMLElement* element)
{
ASSERT_ARG(element, isHTMLOptionElement(element));
m_element = element;
}
Element* AXMenuListOption::actionElement() const
{
return m_element.get();
}
bool AXMenuListOption::isEnabled() const
{
return !toHTMLOptionElement(m_element)->ownElementDisabled();
}
bool AXMenuListOption::isVisible() const
{
if (!m_parent)
return false;
return !m_parent->isOffScreen() || isSelected();
}
bool AXMenuListOption::isOffScreen() const
{
return !isVisible();
}
bool AXMenuListOption::isSelected() const
{
return toHTMLOptionElement(m_element)->selected();
}
void AXMenuListOption::setSelected(bool b)
{
if (!canSetSelectedAttribute())
return;
toHTMLOptionElement(m_element)->setSelected(b);
}
bool AXMenuListOption::canSetSelectedAttribute() const
{
return isEnabled();
}
bool AXMenuListOption::computeAccessibilityIsIgnored() const
{
return accessibilityIsIgnoredByDefault();
}
LayoutRect AXMenuListOption::elementRect() const
{
AXObject* parent = parentObject();
ASSERT(parent->isMenuListPopup());
AXObject* grandparent = parent->parentObject();
ASSERT(grandparent->isMenuList());
return grandparent->elementRect();
}
String AXMenuListOption::stringValue() const
{
return toHTMLOptionElement(m_element)->text();
}
}