/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */
if (aAttribute == nsGkAtoms::label) {
dom::Element* elm = Elm(); if (!nsAccUtils::HasARIAAttr(elm, nsGkAtoms::aria_labelledby) &&
!nsAccUtils::HasARIAAttr(elm, nsGkAtoms::aria_label)) {
mDoc->FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
}
}
}
uint64_t HTMLSelectOptionAccessible::NativeState() const { // As a HTMLSelectOptionAccessible we can have the following states: // SELECTABLE, SELECTED, FOCUSED, FOCUSABLE, OFFSCREEN // Upcall to LocalAccessible, but skip HyperTextAccessible impl // because we don't want EDITABLE or SELECTABLE_TEXT
uint64_t state = LocalAccessible::NativeState();
LocalAccessible* select = GetSelect(); if (!select) return state;
uint64_t selectState = select->State(); if (selectState & states::INVISIBLE) return state;
// Are we selected?
HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent); bool selected = option && option->Selected(); if (selected) state |= states::SELECTED;
if (selectState & states::OFFSCREEN) {
state |= states::OFFSCREEN;
} elseif (selectState & states::COLLAPSED) { // <select> is COLLAPSED: add OFFSCREEN, if not the currently // visible option if (!selected) {
state |= states::OFFSCREEN; // Ensure the invisible state is removed. Otherwise, group info will skip // this option. Furthermore, this gets cached and this doesn't get // invalidated even once the select is expanded.
state &= ~states::INVISIBLE;
} else { // Clear offscreen and invisible for currently showing option
state &= ~(states::OFFSCREEN | states::INVISIBLE);
state |= selectState & states::OPAQUE1;
}
} else { // XXX list frames are weird, don't rely on LocalAccessible's general // visibility implementation unless they get reimplemented in layout
state &= ~states::OFFSCREEN; // <select> is not collapsed: compare bounds to calculate OFFSCREEN
LocalAccessible* listAcc = LocalParent(); if (listAcc) {
LayoutDeviceIntRect optionRect = Bounds();
LayoutDeviceIntRect listRect = listAcc->Bounds(); if (optionRect.Y() < listRect.Y() ||
optionRect.YMost() > listRect.YMost()) {
state |= states::OFFSCREEN;
}
}
}
uint64_t HTMLComboboxAccessible::NativeState() const { // As a HTMLComboboxAccessible we can have the following states: // FOCUSED, FOCUSABLE, HASPOPUP, EXPANDED, COLLAPSED // Get focus status from base class
uint64_t state = LocalAccessible::NativeState();
nsComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame()); if (comboFrame && comboFrame->IsDroppedDown()) {
state |= states::EXPANDED;
} else {
state |= states::COLLAPSED;
}
state |= states::HASPOPUP; return state;
}
void HTMLComboboxAccessible::Description(nsString& aDescription) const {
aDescription.Truncate(); // First check to see if combo box itself has a description, perhaps through // tooltip (title attribute) or via aria-describedby
LocalAccessible::Description(aDescription); if (!aDescription.IsEmpty()) return;
// Otherwise use description of selected option.
LocalAccessible* option = SelectedOption(); if (option) option->Description(aDescription);
}
void HTMLComboboxAccessible::Value(nsString& aValue) const { // Use accessible name of selected option.
LocalAccessible* option = SelectedOption(); if (option) option->Name(aValue);
}
role HTMLComboboxListAccessible::NativeRole() const { return roles::COMBOBOX_LIST;
}
uint64_t HTMLComboboxListAccessible::NativeState() const { // As a HTMLComboboxListAccessible we can have the following states: // FOCUSED, FOCUSABLE, FLOATING, INVISIBLE // Get focus status from base class
uint64_t state = LocalAccessible::NativeState();
nsComboboxControlFrame* comboFrame = do_QueryFrame(mParent->GetFrame()); if (comboFrame && comboFrame->IsDroppedDown()) {
state |= states::FLOATING;
} else {
state |= states::INVISIBLE;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.