Bug 1727373 - Add state change info in event logging. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D123529
This commit is contained in:
Eitan Isaacson 2021-08-24 23:49:59 +00:00
Родитель d86987c6d7
Коммит 5cbfe86b54
2 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -773,6 +773,9 @@ already_AddRefed<DOMStringList> nsAccessibilityService::GetStringStates(
if (aStates & states::SENSITIVE) {
stringStates->Add(u"sensitive"_ns);
}
if (aStates & states::EXPANDABLE) {
stringStates->Add(u"expandable"_ns);
}
if (aStates & states::PINNED) {
stringStates->Add(u"pinned"_ns);
}

Просмотреть файл

@ -10,6 +10,7 @@
#include "AccAttributes.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/DOMStringList.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -36,6 +37,15 @@ void nsEventShell::FireEvent(AccEvent* aEvent) {
nsAutoString type;
GetAccService()->GetStringEventType(aEvent->GetEventType(), type);
logging::MsgEntry("type: %s", NS_ConvertUTF16toUTF8(type).get());
if (aEvent->GetEventType() == nsIAccessibleEvent::EVENT_STATE_CHANGE) {
AccStateChangeEvent* event = downcast_accEvent(aEvent);
RefPtr<dom::DOMStringList> stringStates =
GetAccService()->GetStringStates(event->GetState());
nsAutoString state;
stringStates->Item(0, state);
logging::MsgEntry("state: %s = %s", NS_ConvertUTF16toUTF8(state).get(),
event->IsStateEnabled() ? "true" : "false");
}
logging::AccessibleInfo("target", aEvent->GetAccessible());
logging::MsgEnd();
}