mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1251712 - propagate a context flag for alerts, r=davdib
This commit is contained in:
parent
ea242908b9
commit
535060484a
@ -43,7 +43,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
kGenericAccType,
|
||||
eAlert,
|
||||
kNoReqStates
|
||||
},
|
||||
{ // alertdialog
|
||||
|
@ -68,20 +68,21 @@ enum AccType {
|
||||
* type, the same accessible class can have several types.
|
||||
*/
|
||||
enum AccGenericType {
|
||||
eAutoComplete = 1 << 0,
|
||||
eAutoCompletePopup = 1 << 1,
|
||||
eButton = 1 << 2,
|
||||
eCombobox = 1 << 3,
|
||||
eDocument = 1 << 4,
|
||||
eHyperText = 1 << 5,
|
||||
eLandmark = 1 << 6,
|
||||
eList = 1 << 7,
|
||||
eListControl = 1 << 8,
|
||||
eMenuButton = 1 << 9,
|
||||
eSelect = 1 << 10,
|
||||
eTable = 1 << 11,
|
||||
eTableCell = 1 << 12,
|
||||
eTableRow = 1 << 13,
|
||||
eAlert = 1 << 0,
|
||||
eAutoComplete = 1 << 1,
|
||||
eAutoCompletePopup = 1 << 2,
|
||||
eButton = 1 << 3,
|
||||
eCombobox = 1 << 4,
|
||||
eDocument = 1 << 5,
|
||||
eHyperText = 1 << 6,
|
||||
eLandmark = 1 << 7,
|
||||
eList = 1 << 8,
|
||||
eListControl = 1 << 9,
|
||||
eMenuButton = 1 << 10,
|
||||
eSelect = 1 << 11,
|
||||
eTable = 1 << 12,
|
||||
eTableCell = 1 << 13,
|
||||
eTableRow = 1 << 14,
|
||||
|
||||
eLastAccGenericType = eTableRow
|
||||
};
|
||||
|
@ -1982,6 +1982,10 @@ Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
|
||||
|
||||
if (mParent->IsARIAHidden() || aria::HasDefinedARIAHidden(mContent))
|
||||
SetARIAHidden(true);
|
||||
|
||||
mContextFlags |=
|
||||
static_cast<uint32_t>((mParent->IsAlert() ||
|
||||
mParent->IsInsideAlert())) & eInsideAlert;
|
||||
}
|
||||
|
||||
// Accessible protected
|
||||
@ -1999,7 +2003,7 @@ Accessible::UnbindFromParent()
|
||||
|
||||
delete mBits.groupInfo;
|
||||
mBits.groupInfo = nullptr;
|
||||
mContextFlags &= ~eHasNameDependentParent;
|
||||
mContextFlags &= ~eHasNameDependentParent & ~eInsideAlert;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -568,6 +568,8 @@ public:
|
||||
return mContent->IsAnyOfHTMLElements(nsGkAtoms::abbr, nsGkAtoms::acronym);
|
||||
}
|
||||
|
||||
bool IsAlert() const { return HasGenericType(eAlert); }
|
||||
|
||||
bool IsApplication() const { return mType == eApplicationType; }
|
||||
ApplicationAccessible* AsApplication();
|
||||
|
||||
@ -946,6 +948,11 @@ public:
|
||||
bool IsARIAHidden() const { return mContextFlags & eARIAHidden; }
|
||||
void SetARIAHidden(bool aIsDefined);
|
||||
|
||||
/**
|
||||
* Return true if the element is inside an alert.
|
||||
*/
|
||||
bool IsInsideAlert() const { return mContextFlags & eInsideAlert; }
|
||||
|
||||
protected:
|
||||
virtual ~Accessible();
|
||||
|
||||
@ -1034,8 +1041,9 @@ protected:
|
||||
enum ContextFlags {
|
||||
eHasNameDependentParent = 1 << 0, // Parent's name depends on this accessible.
|
||||
eARIAHidden = 1 << 1,
|
||||
eInsideAlert = 1 << 2,
|
||||
|
||||
eLastContextFlag = eARIAHidden
|
||||
eLastContextFlag = eInsideAlert
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -1141,9 +1149,9 @@ protected:
|
||||
|
||||
static const uint8_t kChildrenFlagsBits = 2;
|
||||
static const uint8_t kStateFlagsBits = 11;
|
||||
static const uint8_t kContextFlagsBits = 2;
|
||||
static const uint8_t kContextFlagsBits = 3;
|
||||
static const uint8_t kTypeBits = 6;
|
||||
static const uint8_t kGenericTypesBits = 14;
|
||||
static const uint8_t kGenericTypesBits = 15;
|
||||
|
||||
/**
|
||||
* Keep in sync with ChildrenFlags, StateFlags, ContextFlags, and AccTypes.
|
||||
|
@ -1764,22 +1764,16 @@ DocAccessible::UpdateTreeOnInsertion(Accessible* aContainer)
|
||||
|
||||
// Check to see if change occurred inside an alert, and fire an EVENT_ALERT
|
||||
// if it did.
|
||||
if (!(updateFlags & eAlertAccessible)) {
|
||||
// XXX: tree traversal is perf issue, accessible should know if they are
|
||||
// children of alert accessible to avoid this.
|
||||
if (!(updateFlags & eAlertAccessible) &&
|
||||
(aContainer->IsAlert() || aContainer->IsInsideAlert())) {
|
||||
Accessible* ancestor = aContainer;
|
||||
while (ancestor) {
|
||||
if (ancestor->ARIARole() == roles::ALERT) {
|
||||
do {
|
||||
if (ancestor->IsAlert()) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
|
||||
break;
|
||||
}
|
||||
|
||||
// Don't climb above this document.
|
||||
if (ancestor == this)
|
||||
break;
|
||||
|
||||
ancestor = ancestor->Parent();
|
||||
}
|
||||
while ((ancestor = ancestor->Parent()));
|
||||
}
|
||||
|
||||
MaybeNotifyOfValueChange(aContainer);
|
||||
|
@ -19,6 +19,7 @@ XULAlertAccessible::
|
||||
XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
AccessibleWrap(aContent, aDoc)
|
||||
{
|
||||
mGenericTypes |= eAlert;
|
||||
}
|
||||
|
||||
XULAlertAccessible::~XULAlertAccessible()
|
||||
|
Loading…
Reference in New Issue
Block a user