Implement accessibility enhancements (issue #1217)

- Add new CefBrowserHost::SetAccessibilityState method for toggling
  accessibility state when readers are detected by the client.
- Add new CefAccessibilityHandler interface for the delivery of
  accessibility notifications to windowless (OSR) clients.
- Fix delivery of CefFocusHandler callbacks to windowless clients.
- cefclient: Add example windowless accessibility implementation on Windows and macOS.
- cefclient: Automatically detect screen readers on Windows and macOS.
This commit is contained in:
Nishant Kaushik
2017-05-12 18:28:25 +00:00
committed by Marshall Greenblatt
parent 64fcfa6068
commit 816f700d3e
51 changed files with 3476 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ namespace client {
// Client handler implementation for windowless browsers. There will only ever
// be one browser per handler instance.
class ClientHandlerOsr : public ClientHandler,
public CefAccessibilityHandler,
public CefRenderHandler {
public:
// Implement this interface to receive notification of ClientHandlerOsr
@@ -61,6 +62,8 @@ class ClientHandlerOsr : public ClientHandler,
const CefRange& selection_range,
const CefRenderHandler::RectList& character_bounds) = 0;
virtual void UpdateAccessibilityTree(CefRefPtr<CefValue> value) = 0;
protected:
virtual ~OsrDelegate() {}
};
@@ -77,6 +80,9 @@ class ClientHandlerOsr : public ClientHandler,
CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE {
return this;
}
CefRefPtr<CefAccessibilityHandler> GetAccessibilityHandler() OVERRIDE {
return this;
}
// CefLifeSpanHandler methods.
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
@@ -118,6 +124,10 @@ class ClientHandlerOsr : public ClientHandler,
const CefRange& selection_range,
const CefRenderHandler::RectList& character_bounds) OVERRIDE;
// CefAccessibilityHandler methods.
void OnAccessibilityTreeChange(CefRefPtr<CefValue> value) OVERRIDE;
void OnAccessibilityLocationChange(CefRefPtr<CefValue> value) OVERRIDE {}
private:
// Only accessed on the UI thread.
OsrDelegate* osr_delegate_;