/* -*- Mode: C++; tab-width: 2; 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/. */
Accessible* Pivot::SearchBackward(Accessible* aAnchor, PivotRule& aRule, bool aSearchCurrent) { // Initial position could be unset, in that case return null. if (!aAnchor) { return nullptr;
}
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH) { return acc;
}
}
acc = parent; if (!acc) { break;
}
filtered = aRule.Match(acc);
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH) { return acc;
}
}
return nullptr;
}
Accessible* Pivot::SearchForward(Accessible* aAnchor, PivotRule& aRule, bool aSearchCurrent) { // Initial position could be not set, in that case begin search from root.
Accessible* acc = aAnchor ? aAnchor : mRoot;
// Ignore any matching nodes that were below this one if (filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) {
match = nullptr;
}
// Match if no node below this is a match if ((filtered & nsIAccessibleTraversalRule::FILTER_MATCH) && !match) {
LayoutDeviceIntRect childRect = child->IsLocal()
? child->AsLocal()->Bounds()
: child->AsRemote()->Bounds(); // Double-check child's bounds since the deepest child may have been out // of bounds. This assures we don't return a false positive. if (childRect.Contains(aX, aY)) {
match = child;
}
}
uint16_t PivotRoleRule::Match(Accessible* aAcc) {
uint16_t result = nsIAccessibleTraversalRule::FILTER_IGNORE;
if (nsAccUtils::MustPrune(aAcc)) {
result |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}
if (mDirectDescendantsFrom && (aAcc != mDirectDescendantsFrom)) { // If we've specified mDirectDescendantsFrom, we should ignore // non-direct descendants of from the specified AoP. Because // pivot performs a preorder traversal, the first aAcc // object(s) that don't equal mDirectDescendantsFrom will be // mDirectDescendantsFrom's children. We'll process them, but ignore // their subtrees thereby processing direct descendants of // mDirectDescendantsFrom only.
result |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}
if (aAcc && aAcc->Role() == mRole) {
result |= nsIAccessibleTraversalRule::FILTER_MATCH;
}
uint16_t PivotRadioNameRule::Match(Accessible* aAcc) {
uint16_t result = nsIAccessibleTraversalRule::FILTER_IGNORE;
RemoteAccessible* remote = aAcc->AsRemote(); if (!remote) { // We need the cache to be able to fetch the name attribute below. return result;
}
if (nsAccUtils::MustPrune(aAcc) || aAcc->IsOuterDoc()) {
result |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}
if (remote->IsHTMLRadioButton()) {
nsString currName = remote->GetCachedHTMLNameAttribute(); if (!currName.IsEmpty() && mName.Equals(currName)) {
result |= nsIAccessibleTraversalRule::FILTER_MATCH;
}
}
return result;
}
// MustPruneSameDocRule
uint16_t MustPruneSameDocRule::Match(Accessible* aAcc) { if (!aAcc) { return nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}
if (nsAccUtils::MustPrune(aAcc) || aAcc->IsOuterDoc()) { return nsIAccessibleTraversalRule::FILTER_MATCH |
nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}
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.