Bug 1867811 - Expose EXPANDED state for element with popovertarget. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D196541
This commit is contained in:
@@ -93,6 +93,10 @@
|
||||
#include "mozilla/dom/ElementBinding.h"
|
||||
#include "mozilla/dom/ElementInternals.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
# include "nsAccessibilityService.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@@ -2853,14 +2857,28 @@ void nsGenericHTMLFormControlElementWithState::HandlePopoverTargetAction() {
|
||||
|
||||
bool canHide = action == PopoverTargetAction::Hide ||
|
||||
action == PopoverTargetAction::Toggle;
|
||||
bool shouldHide = canHide && target->IsPopoverOpen();
|
||||
bool canShow = action == PopoverTargetAction::Show ||
|
||||
action == PopoverTargetAction::Toggle;
|
||||
bool shouldShow = canShow && !target->IsPopoverOpen();
|
||||
|
||||
if (canHide && target->IsPopoverOpen()) {
|
||||
if (shouldHide) {
|
||||
target->HidePopover(IgnoreErrors());
|
||||
} else if (canShow && !target->IsPopoverOpen()) {
|
||||
} else if (shouldShow) {
|
||||
target->ShowPopoverInternal(this, IgnoreErrors());
|
||||
}
|
||||
#ifdef ACCESSIBILITY
|
||||
// Notify the accessibility service about the change.
|
||||
if (shouldHide || shouldShow) {
|
||||
if (RefPtr<Document> doc = GetComposedDoc()) {
|
||||
if (PresShell* presShell = doc->GetPresShell()) {
|
||||
if (nsAccessibilityService* accService = GetAccService()) {
|
||||
accService->PopovertargetMaybeChanged(presShell, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsGenericHTMLFormControlElementWithState::GetInvokeAction(
|
||||
|
||||
Reference in New Issue
Block a user