From 0bd5956e6199c71ab19b0d7a0b91c453140e72fc Mon Sep 17 00:00:00 2001 From: Adam Kallai Date: Wed, 12 Aug 2015 03:57:32 -0700 Subject: Fix QAccessible name and description calculation The logic was removed in 1881f56d65b3981b176d99262f5266cf9ff76be3. There is no platform independent implementation in Chromium for calculating Accessible name which follow the W3C Accessibility standard. We need to apply this logic in order to get Accessible name and description correctly. It also fixes the QWebEngineAccessibility test cases. Change-Id: I733c6311301c43610b7a9aaf22c73c2e5d368c70 Reviewed-by: Joerg Bornemann --- src/core/browser_accessibility_qt.cpp | 86 +++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 4 deletions(-) (limited to 'src/core/browser_accessibility_qt.cpp') diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 9d4fdfe00..ebf99e950 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -59,6 +59,84 @@ BrowserAccessibilityQt::BrowserAccessibilityQt() QAccessible::registerAccessibleInterface(this); } +// This function is taken from chromium/content/browser/accessibility/browser_accessibility_win.cc +// see also http://www.w3.org/TR/html-aapi +void BrowserAccessibilityQt::OnDataChanged() +{ + BrowserAccessibility::OnDataChanged(); + + // The calculation of the accessible name of an element has been + // standardized in the HTML to Platform Accessibility APIs Implementation + // Guide (http://www.w3.org/TR/html-aapi/). In order to return the + // appropriate accessible name on Windows, we need to apply some logic + // to the fields we get from WebKit. + // + // TODO(dmazzoni): move most of this logic into WebKit. + // + // WebKit gives us: + // + // name: the default name, e.g. inner text + // title ui element: a reference to a