Fire a11y event on touch screens using screen readers

This commit is contained in:
Jacob Groundwater 2016-10-18 13:28:32 +09:00
Родитель cbe9768529
Коммит 9c9ba80978
1 изменённых файлов: 11 добавлений и 6 удалений

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

@ -72,6 +72,12 @@ const char* AppCommandToString(int command_id) {
}
}
bool IsScreenReaderActive() {
UINT screenReader = 0;
SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenReader, 0);
return screenReader && UiaClientsAreListening();
}
} // namespace
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
@ -91,21 +97,20 @@ bool NativeWindowViews::PreHandleMSG(
// because we still want Chromium to handle returning the actual
// accessibility object.
case WM_GETOBJECT: {
if (checked_for_a11y_support_) return false;
const DWORD obj_id = static_cast<DWORD>(l_param);
if (obj_id != OBJID_CLIENT) {
return false;
}
if (checked_for_a11y_support_) return false;
checked_for_a11y_support_ = true;
UINT screenReader = 0;
SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenReader, 0);
if (!screenReader || !UiaClientsAreListening()) {
if (!IsScreenReaderActive()) {
return false;
}
checked_for_a11y_support_ = true;
const auto axState = content::BrowserAccessibilityState::GetInstance();
if (axState && !axState->IsAccessibleBrowser()) {
axState->OnScreenReaderDetected();