diff options
| author | Stephan Binner <stephan.binner@basyskom.com> | 2015-03-03 18:25:41 +0100 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2015-03-05 11:47:31 +0100 |
| commit | a1a62c871a47a92e3712845283f6163f6f892109 (patch) | |
| tree | fa3ef154a79162711dbb2d208a435542ecd39608 /recipes-qt/qt5/qtwebengine/0004-Enable-building-Qt-WebEngine-without-accessiblity-en.patch | |
| parent | 7a65ba6089560efdd840a9590684c24fbcdb7818 (diff) | |
| download | meta-qt5-a1a62c871a47a92e3712845283f6163f6f892109.tar.gz | |
qtwebengine: Fix build if qtbase has no accessibility
* backport patch from 5.4 branch to 5.4.1 release
* bump SRCREV in git recipe to use newer revision from 5.4 which
already includes this patch
Signed-off-by: Stephan Binner <stephan.binner@basyskom.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'recipes-qt/qt5/qtwebengine/0004-Enable-building-Qt-WebEngine-without-accessiblity-en.patch')
| -rw-r--r-- | recipes-qt/qt5/qtwebengine/0004-Enable-building-Qt-WebEngine-without-accessiblity-en.patch | 534 |
1 files changed, 534 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtwebengine/0004-Enable-building-Qt-WebEngine-without-accessiblity-en.patch b/recipes-qt/qt5/qtwebengine/0004-Enable-building-Qt-WebEngine-without-accessiblity-en.patch new file mode 100644 index 00000000..7dfad9ac --- /dev/null +++ b/recipes-qt/qt5/qtwebengine/0004-Enable-building-Qt-WebEngine-without-accessiblity-en.patch | |||
| @@ -0,0 +1,534 @@ | |||
| 1 | From dca162bbe2e0356596bdc4469fb0754be27e0b7d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Stephan Binner <stephan.binner@basyskom.com> | ||
| 3 | Date: Wed, 4 Mar 2015 12:39:29 +0100 | ||
| 4 | Subject: [PATCH 4/4] Enable building Qt WebEngine without accessiblity | ||
| 5 | enabled. | ||
| 6 | |||
| 7 | This adds guards that for QT_NO_ACCESSIBILITY being not defined | ||
| 8 | around the code that uses accessibility types. | ||
| 9 | |||
| 10 | It disables the quicknanobrowser and quicktestbrowser examples | ||
| 11 | which need Qt QuickControls, which has a hard dependency to | ||
| 12 | accessibility being enabled. | ||
| 13 | |||
| 14 | Upstream-Status: Backport from 5.5 | ||
| 15 | https://codereview.qt-project.org/#/c/104207/ | ||
| 16 | |||
| 17 | Backport of d95b9295c970401939d2779cbdc9e2a8c7965277 from 5.5 | ||
| 18 | |||
| 19 | Change-Id: I2a2a0a6196fcb3baa39603d9c929183b454f39ed | ||
| 20 | Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com> | ||
| 21 | --- | ||
| 22 | examples/webengine/quicknanobrowser/quicknanobrowser.pro | 2 ++ | ||
| 23 | src/core/browser_accessibility_manager_qt.cpp | 6 ++++++ | ||
| 24 | src/core/browser_accessibility_manager_qt.h | 2 ++ | ||
| 25 | src/core/browser_accessibility_qt.cpp | 4 ++++ | ||
| 26 | src/core/browser_accessibility_qt.h | 3 +++ | ||
| 27 | src/core/render_widget_host_view_qt.cpp | 13 ++++++++++++- | ||
| 28 | src/core/render_widget_host_view_qt.h | 6 +++++- | ||
| 29 | src/core/web_contents_adapter.cpp | 2 ++ | ||
| 30 | src/core/web_contents_adapter_client.h | 2 ++ | ||
| 31 | src/webengine/api/qquickwebengineview.cpp | 12 ++++++++++++ | ||
| 32 | src/webengine/api/qquickwebengineview_p.h | 2 ++ | ||
| 33 | src/webengine/api/qquickwebengineview_p_p.h | 5 ++++- | ||
| 34 | src/webenginewidgets/api/qwebenginepage.cpp | 3 +++ | ||
| 35 | src/webenginewidgets/api/qwebenginepage.h | 2 ++ | ||
| 36 | src/webenginewidgets/api/qwebenginepage_p.h | 2 ++ | ||
| 37 | src/webenginewidgets/api/qwebengineview.cpp | 7 ++++++- | ||
| 38 | src/webenginewidgets/api/qwebengineview_p.h | 3 ++- | ||
| 39 | tests/quicktestbrowser/quicktestbrowser.pro | 2 ++ | ||
| 40 | 18 files changed, 73 insertions(+), 5 deletions(-) | ||
| 41 | |||
| 42 | diff --git a/examples/webengine/quicknanobrowser/quicknanobrowser.pro b/examples/webengine/quicknanobrowser/quicknanobrowser.pro | ||
| 43 | index 3628b81..a8e57b0 100644 | ||
| 44 | --- a/examples/webengine/quicknanobrowser/quicknanobrowser.pro | ||
| 45 | +++ b/examples/webengine/quicknanobrowser/quicknanobrowser.pro | ||
| 46 | @@ -1,3 +1,5 @@ | ||
| 47 | +requires(contains(QT_CONFIG, accessibility)) | ||
| 48 | + | ||
| 49 | TEMPLATE = app | ||
| 50 | TARGET = quicknanobrowser | ||
| 51 | |||
| 52 | diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp | ||
| 53 | index 28d0dd7..6729866 100644 | ||
| 54 | --- a/src/core/browser_accessibility_manager_qt.cpp | ||
| 55 | +++ b/src/core/browser_accessibility_manager_qt.cpp | ||
| 56 | @@ -45,9 +45,14 @@ namespace content { | ||
| 57 | |||
| 58 | BrowserAccessibility *BrowserAccessibilityFactoryQt::Create() | ||
| 59 | { | ||
| 60 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 61 | return new BrowserAccessibilityQt(); | ||
| 62 | +#else | ||
| 63 | + return 0; | ||
| 64 | +#endif // QT_NO_ACCESSIBILITY | ||
| 65 | } | ||
| 66 | |||
| 67 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 68 | BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt( | ||
| 69 | QObject* parentObject, | ||
| 70 | const ui::AXTreeUpdate& initialTree, | ||
| 71 | @@ -131,5 +136,6 @@ void BrowserAccessibilityManagerQt::NotifyAccessibilityEvent(ui::AXEvent event_t | ||
| 72 | break; | ||
| 73 | } | ||
| 74 | } | ||
| 75 | +#endif // QT_NO_ACCESSIBILITY | ||
| 76 | |||
| 77 | } | ||
| 78 | diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h | ||
| 79 | index 5d8498d..49b3af3 100644 | ||
| 80 | --- a/src/core/browser_accessibility_manager_qt.h | ||
| 81 | +++ b/src/core/browser_accessibility_manager_qt.h | ||
| 82 | @@ -38,6 +38,7 @@ | ||
| 83 | #define BROWSER_ACCESSIBILITY_MANAGER_QT_H | ||
| 84 | |||
| 85 | #include "content/browser/accessibility/browser_accessibility_manager.h" | ||
| 86 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 87 | #include <QtCore/qobject.h> | ||
| 88 | |||
| 89 | QT_BEGIN_NAMESPACE | ||
| 90 | @@ -74,4 +75,5 @@ private: | ||
| 91 | |||
| 92 | } | ||
| 93 | |||
| 94 | +#endif // QT_NO_ACCESSIBILITY | ||
| 95 | #endif | ||
| 96 | diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp | ||
| 97 | index b5cd26f..4b8e97a 100644 | ||
| 98 | --- a/src/core/browser_accessibility_qt.cpp | ||
| 99 | +++ b/src/core/browser_accessibility_qt.cpp | ||
| 100 | @@ -40,6 +40,8 @@ | ||
| 101 | |||
| 102 | #include "browser_accessibility_qt.h" | ||
| 103 | |||
| 104 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 105 | + | ||
| 106 | #include "third_party/WebKit/public/web/WebAXEnums.h" | ||
| 107 | #include "ui/accessibility/ax_node_data.h" | ||
| 108 | |||
| 109 | @@ -898,3 +900,5 @@ void BrowserAccessibilityQt::modelChange(QAccessibleTableModelChangeEvent *) | ||
| 110 | } | ||
| 111 | |||
| 112 | } // namespace content | ||
| 113 | + | ||
| 114 | +#endif // QT_NO_ACCESSIBILITY | ||
| 115 | diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h | ||
| 116 | index db190ff..e87b5d8 100644 | ||
| 117 | --- a/src/core/browser_accessibility_qt.h | ||
| 118 | +++ b/src/core/browser_accessibility_qt.h | ||
| 119 | @@ -38,6 +38,8 @@ | ||
| 120 | #define BROWSER_ACCESSIBILITY_QT_H | ||
| 121 | |||
| 122 | #include <QtGui/qaccessible.h> | ||
| 123 | + | ||
| 124 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 125 | #include "content/browser/accessibility/browser_accessibility.h" | ||
| 126 | |||
| 127 | namespace content { | ||
| 128 | @@ -145,4 +147,5 @@ public: | ||
| 129 | |||
| 130 | } | ||
| 131 | |||
| 132 | +#endif // QT_NO_ACCESSIBILITY | ||
| 133 | #endif | ||
| 134 | diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp | ||
| 135 | index c221e94..18d64e8 100644 | ||
| 136 | --- a/src/core/render_widget_host_view_qt.cpp | ||
| 137 | +++ b/src/core/render_widget_host_view_qt.cpp | ||
| 138 | @@ -198,15 +198,18 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget | ||
| 139 | , m_initPending(false) | ||
| 140 | { | ||
| 141 | m_host->SetView(this); | ||
| 142 | - | ||
| 143 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 144 | QAccessible::installActivationObserver(this); | ||
| 145 | if (QAccessible::isActive()) | ||
| 146 | content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); | ||
| 147 | +#endif // QT_NO_ACCESSIBILITY | ||
| 148 | } | ||
| 149 | |||
| 150 | RenderWidgetHostViewQt::~RenderWidgetHostViewQt() | ||
| 151 | { | ||
| 152 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 153 | QAccessible::removeActivationObserver(this); | ||
| 154 | +#endif // QT_NO_ACCESSIBILITY | ||
| 155 | } | ||
| 156 | |||
| 157 | void RenderWidgetHostViewQt::setDelegate(RenderWidgetHostViewQtDelegate* delegate) | ||
| 158 | @@ -296,6 +299,7 @@ gfx::NativeViewAccessible RenderWidgetHostViewQt::GetNativeViewAccessible() | ||
| 159 | |||
| 160 | void RenderWidgetHostViewQt::CreateBrowserAccessibilityManagerIfNeeded() | ||
| 161 | { | ||
| 162 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 163 | if (GetBrowserAccessibilityManager()) | ||
| 164 | return; | ||
| 165 | |||
| 166 | @@ -303,6 +307,9 @@ void RenderWidgetHostViewQt::CreateBrowserAccessibilityManagerIfNeeded() | ||
| 167 | m_adapterClient->accessibilityParentObject(), | ||
| 168 | content::BrowserAccessibilityManagerQt::GetEmptyDocument(), | ||
| 169 | this)); | ||
| 170 | +#else | ||
| 171 | + return 0; | ||
| 172 | +#endif // QT_NO_ACCESSIBILITY | ||
| 173 | } | ||
| 174 | |||
| 175 | // Set focus to the associated View component. | ||
| 176 | @@ -953,6 +960,7 @@ void RenderWidgetHostViewQt::AccessibilityFatalError() | ||
| 177 | SetBrowserAccessibilityManager(NULL); | ||
| 178 | } | ||
| 179 | |||
| 180 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 181 | void RenderWidgetHostViewQt::accessibilityActiveChanged(bool active) | ||
| 182 | { | ||
| 183 | if (active) | ||
| 184 | @@ -960,6 +968,7 @@ void RenderWidgetHostViewQt::accessibilityActiveChanged(bool active) | ||
| 185 | else | ||
| 186 | content::BrowserAccessibilityStateImpl::GetInstance()->DisableAccessibility(); | ||
| 187 | } | ||
| 188 | +#endif // QT_NO_ACCESSIBILITY | ||
| 189 | |||
| 190 | void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev) | ||
| 191 | { | ||
| 192 | @@ -1042,6 +1051,7 @@ void RenderWidgetHostViewQt::handleFocusEvent(QFocusEvent *ev) | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 197 | QAccessibleInterface *RenderWidgetHostViewQt::GetQtAccessible() | ||
| 198 | { | ||
| 199 | // Assume we have a screen reader doing stuff | ||
| 200 | @@ -1051,6 +1061,7 @@ QAccessibleInterface *RenderWidgetHostViewQt::GetQtAccessible() | ||
| 201 | content::BrowserAccessibilityQt *accQt = static_cast<content::BrowserAccessibilityQt*>(acc); | ||
| 202 | return accQt; | ||
| 203 | } | ||
| 204 | +#endif // QT_NO_ACCESSIBILITY | ||
| 205 | |||
| 206 | void RenderWidgetHostViewQt::didFirstVisuallyNonEmptyLayout() | ||
| 207 | { | ||
| 208 | diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h | ||
| 209 | index d4a3ff2..fac7efd 100644 | ||
| 210 | --- a/src/core/render_widget_host_view_qt.h | ||
| 211 | +++ b/src/core/render_widget_host_view_qt.h | ||
| 212 | @@ -50,6 +50,7 @@ | ||
| 213 | #include <QRect> | ||
| 214 | #include <QtGlobal> | ||
| 215 | #include <QtGui/qaccessible.h> | ||
| 216 | +#include <QtGui/QTouchEvent> | ||
| 217 | |||
| 218 | #include "delegated_frame_node.h" | ||
| 219 | |||
| 220 | @@ -59,7 +60,6 @@ class QFocusEvent; | ||
| 221 | class QHoverEvent; | ||
| 222 | class QKeyEvent; | ||
| 223 | class QMouseEvent; | ||
| 224 | -class QTouchEvent; | ||
| 225 | class QVariant; | ||
| 226 | class QWheelEvent; | ||
| 227 | class QAccessibleInterface; | ||
| 228 | @@ -93,7 +93,9 @@ class RenderWidgetHostViewQt | ||
| 229 | , public RenderWidgetHostViewQtDelegateClient | ||
| 230 | , public content::BrowserAccessibilityDelegate | ||
| 231 | , public base::SupportsWeakPtr<RenderWidgetHostViewQt> | ||
| 232 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 233 | , public QAccessible::ActivationObserver | ||
| 234 | +#endif // QT_NO_ACCESSIBILITY | ||
| 235 | { | ||
| 236 | public: | ||
| 237 | RenderWidgetHostViewQt(content::RenderWidgetHost* widget); | ||
| 238 | @@ -213,9 +215,11 @@ public: | ||
| 239 | virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) const Q_DECL_OVERRIDE { return gfx::Point(); } | ||
| 240 | virtual void AccessibilityHitTest(const gfx::Point& point) Q_DECL_OVERRIDE { } | ||
| 241 | virtual void AccessibilityFatalError() Q_DECL_OVERRIDE; | ||
| 242 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 243 | virtual void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE; | ||
| 244 | |||
| 245 | QAccessibleInterface *GetQtAccessible(); | ||
| 246 | +#endif // QT_NO_ACCESSIBILITY | ||
| 247 | |||
| 248 | void didFirstVisuallyNonEmptyLayout(); | ||
| 249 | |||
| 250 | diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp | ||
| 251 | index 3f223f7..e41acd0 100644 | ||
| 252 | --- a/src/core/web_contents_adapter.cpp | ||
| 253 | +++ b/src/core/web_contents_adapter.cpp | ||
| 254 | @@ -628,12 +628,14 @@ void WebContentsAdapter::enableInspector(bool enable) | ||
| 255 | ContentBrowserClientQt::Get()->enableInspector(enable); | ||
| 256 | } | ||
| 257 | |||
| 258 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 259 | QAccessibleInterface *WebContentsAdapter::browserAccessible() | ||
| 260 | { | ||
| 261 | Q_D(const WebContentsAdapter); | ||
| 262 | RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt*>(d->webContents->GetRenderWidgetHostView()); | ||
| 263 | return rwhv ? rwhv->GetQtAccessible() : Q_NULLPTR; | ||
| 264 | } | ||
| 265 | +#endif // QT_NO_ACCESSIBILITY | ||
| 266 | |||
| 267 | void WebContentsAdapter::runJavaScript(const QString &javaScript) | ||
| 268 | { | ||
| 269 | diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h | ||
| 270 | index 8fd401f..df18980 100644 | ||
| 271 | --- a/src/core/web_contents_adapter_client.h | ||
| 272 | +++ b/src/core/web_contents_adapter_client.h | ||
| 273 | @@ -168,7 +168,9 @@ public: | ||
| 274 | virtual void passOnFocus(bool reverse) = 0; | ||
| 275 | // returns the last QObject (QWidget/QQuickItem) based object in the accessibility | ||
| 276 | // hierarchy before going into the BrowserAccessibility tree | ||
| 277 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 278 | virtual QObject *accessibilityParentObject() = 0; | ||
| 279 | +#endif // QT_NO_ACCESSIBILITY | ||
| 280 | virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) = 0; | ||
| 281 | virtual void authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword) = 0; | ||
| 282 | virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) = 0; | ||
| 283 | diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp | ||
| 284 | index 3497c16..a35cfc3 100644 | ||
| 285 | --- a/src/webengine/api/qquickwebengineview.cpp | ||
| 286 | +++ b/src/webengine/api/qquickwebengineview.cpp | ||
| 287 | @@ -61,16 +61,20 @@ | ||
| 288 | #include <QScreen> | ||
| 289 | #include <QStringBuilder> | ||
| 290 | #include <QUrl> | ||
| 291 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 292 | #include <private/qquickaccessibleattached_p.h> | ||
| 293 | +#endif // QT_NO_ACCESSIBILITY | ||
| 294 | |||
| 295 | QT_BEGIN_NAMESPACE | ||
| 296 | |||
| 297 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 298 | static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object) | ||
| 299 | { | ||
| 300 | if (QQuickWebEngineView *v = qobject_cast<QQuickWebEngineView*>(object)) | ||
| 301 | return new QQuickWebEngineViewAccessible(v); | ||
| 302 | return 0; | ||
| 303 | } | ||
| 304 | +#endif // QT_NO_ACCESSIBILITY | ||
| 305 | |||
| 306 | QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() | ||
| 307 | : adapter(new WebContentsAdapter) | ||
| 308 | @@ -102,7 +106,9 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() | ||
| 309 | // 1x, 2x, 3x etc assets that fit an integral number of pixels. | ||
| 310 | setDevicePixelRatio(qMax(1, qRound(webPixelRatio))); | ||
| 311 | } | ||
| 312 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 313 | QAccessible::installFactory(&webAccessibleFactory); | ||
| 314 | +#endif // QT_NO_ACCESSIBILITY | ||
| 315 | } | ||
| 316 | |||
| 317 | QQuickWebEngineViewPrivate::~QQuickWebEngineViewPrivate() | ||
| 318 | @@ -395,11 +401,13 @@ void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &sec | ||
| 319 | Q_EMIT e->featurePermissionRequested(securityOrigin, feature); | ||
| 320 | } | ||
| 321 | |||
| 322 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 323 | QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() | ||
| 324 | { | ||
| 325 | Q_Q(QQuickWebEngineView); | ||
| 326 | return q; | ||
| 327 | } | ||
| 328 | +#endif // QT_NO_ACCESSIBILITY | ||
| 329 | |||
| 330 | WebEngineSettings *QQuickWebEngineViewPrivate::webEngineSettings() const | ||
| 331 | { | ||
| 332 | @@ -414,6 +422,7 @@ void QQuickWebEngineViewPrivate::setDevicePixelRatio(qreal devicePixelRatio) | ||
| 333 | m_dpiScale = devicePixelRatio / screen->devicePixelRatio(); | ||
| 334 | } | ||
| 335 | |||
| 336 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 337 | QQuickWebEngineViewAccessible::QQuickWebEngineViewAccessible(QQuickWebEngineView *o) | ||
| 338 | : QAccessibleObject(o) | ||
| 339 | {} | ||
| 340 | @@ -460,6 +469,7 @@ QAccessible::State QQuickWebEngineViewAccessible::state() const | ||
| 341 | QAccessible::State s; | ||
| 342 | return s; | ||
| 343 | } | ||
| 344 | +#endif // QT_NO_ACCESSIBILITY | ||
| 345 | |||
| 346 | void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContents) | ||
| 347 | { | ||
| 348 | @@ -497,8 +507,10 @@ QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent) | ||
| 349 | this->setActiveFocusOnTab(true); | ||
| 350 | this->setFlag(QQuickItem::ItemIsFocusScope); | ||
| 351 | |||
| 352 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 353 | QQuickAccessibleAttached *accessible = QQuickAccessibleAttached::qmlAttachedProperties(this); | ||
| 354 | accessible->setRole(QAccessible::Grouping); | ||
| 355 | +#endif // QT_NO_ACCESSIBILITY | ||
| 356 | } | ||
| 357 | |||
| 358 | QQuickWebEngineView::~QQuickWebEngineView() | ||
| 359 | diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h | ||
| 360 | index 22713ee..f3ceb2c 100644 | ||
| 361 | --- a/src/webengine/api/qquickwebengineview_p.h | ||
| 362 | +++ b/src/webengine/api/qquickwebengineview_p.h | ||
| 363 | @@ -155,7 +155,9 @@ private: | ||
| 364 | friend class QQuickWebEngineViewExperimental; | ||
| 365 | friend class QQuickWebEngineViewExperimentalExtension; | ||
| 366 | friend class QQuickWebEngineNewViewRequest; | ||
| 367 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 368 | friend class QQuickWebEngineViewAccessible; | ||
| 369 | +#endif // QT_NO_ACCESSIBILITY | ||
| 370 | }; | ||
| 371 | |||
| 372 | QT_END_NAMESPACE | ||
| 373 | diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h | ||
| 374 | index 6662f1f..3ab95c6 100644 | ||
| 375 | --- a/src/webengine/api/qquickwebengineview_p_p.h | ||
| 376 | +++ b/src/webengine/api/qquickwebengineview_p_p.h | ||
| 377 | @@ -175,7 +175,9 @@ public: | ||
| 378 | virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE; | ||
| 379 | virtual void authenticationRequired(const QUrl&, const QString&, bool, const QString&, QString*, QString*) Q_DECL_OVERRIDE { } | ||
| 380 | virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE; | ||
| 381 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 382 | virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE; | ||
| 383 | +#endif // QT_NO_ACCESSIBILITY | ||
| 384 | virtual WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE; | ||
| 385 | virtual void allowCertificateError(const QExplicitlySharedDataPointer<CertificateErrorController> &errorController); | ||
| 386 | |||
| 387 | @@ -202,6 +204,7 @@ private: | ||
| 388 | qreal m_dpiScale; | ||
| 389 | }; | ||
| 390 | |||
| 391 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 392 | class QQuickWebEngineViewAccessible : public QAccessibleObject | ||
| 393 | { | ||
| 394 | public: | ||
| 395 | @@ -217,7 +220,7 @@ public: | ||
| 396 | private: | ||
| 397 | QQuickWebEngineView *engineView() const { return static_cast<QQuickWebEngineView*>(object()); } | ||
| 398 | }; | ||
| 399 | - | ||
| 400 | +#endif // QT_NO_ACCESSIBILITY | ||
| 401 | QT_END_NAMESPACE | ||
| 402 | |||
| 403 | QML_DECLARE_TYPE(QQuickWebEngineViewExperimental) | ||
| 404 | diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp | ||
| 405 | index 72b16f2..068c175 100644 | ||
| 406 | --- a/src/webenginewidgets/api/qwebenginepage.cpp | ||
| 407 | +++ b/src/webenginewidgets/api/qwebenginepage.cpp | ||
| 408 | @@ -39,6 +39,7 @@ | ||
| 409 | #include <QApplication> | ||
| 410 | #include <QAuthenticator> | ||
| 411 | #include <QClipboard> | ||
| 412 | +#include <QContextMenuEvent> | ||
| 413 | #include <QFileDialog> | ||
| 414 | #include <QIcon> | ||
| 415 | #include <QInputDialog> | ||
| 416 | @@ -342,10 +343,12 @@ void QWebEnginePagePrivate::runMediaAccessPermissionRequest(const QUrl &security | ||
| 417 | Q_EMIT q->featurePermissionRequested(securityOrigin, requestedFeature); | ||
| 418 | } | ||
| 419 | |||
| 420 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 421 | QObject *QWebEnginePagePrivate::accessibilityParentObject() | ||
| 422 | { | ||
| 423 | return view; | ||
| 424 | } | ||
| 425 | +#endif // QT_NO_ACCESSIBILITY | ||
| 426 | |||
| 427 | void QWebEnginePagePrivate::updateAction(QWebEnginePage::WebAction action) const | ||
| 428 | { | ||
| 429 | diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h | ||
| 430 | index 7856b82..9fd81b0 100644 | ||
| 431 | --- a/src/webenginewidgets/api/qwebenginepage.h | ||
| 432 | +++ b/src/webenginewidgets/api/qwebenginepage.h | ||
| 433 | @@ -258,7 +258,9 @@ private: | ||
| 434 | |||
| 435 | friend class QWebEngineView; | ||
| 436 | friend class QWebEngineViewPrivate; | ||
| 437 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 438 | friend class QWebEngineViewAccessible; | ||
| 439 | +#endif // QT_NO_ACCESSIBILITY | ||
| 440 | }; | ||
| 441 | |||
| 442 | |||
| 443 | diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h | ||
| 444 | index 5412922..2307e7a 100644 | ||
| 445 | --- a/src/webenginewidgets/api/qwebenginepage_p.h | ||
| 446 | +++ b/src/webenginewidgets/api/qwebenginepage_p.h | ||
| 447 | @@ -135,7 +135,9 @@ public: | ||
| 448 | virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE; | ||
| 449 | virtual void authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword) Q_DECL_OVERRIDE; | ||
| 450 | virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE; | ||
| 451 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 452 | virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE; | ||
| 453 | +#endif // QT_NO_ACCESSIBILITY | ||
| 454 | virtual WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE; | ||
| 455 | virtual void allowCertificateError(const QExplicitlySharedDataPointer<CertificateErrorController> &controller) Q_DECL_OVERRIDE; | ||
| 456 | |||
| 457 | diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp | ||
| 458 | index 8d21989..63ac405 100644 | ||
| 459 | --- a/src/webenginewidgets/api/qwebengineview.cpp | ||
| 460 | +++ b/src/webenginewidgets/api/qwebengineview.cpp | ||
| 461 | @@ -85,19 +85,22 @@ void QWebEngineViewPrivate::bind(QWebEngineView *view, QWebEnginePage *page) | ||
| 462 | } | ||
| 463 | } | ||
| 464 | |||
| 465 | - | ||
| 466 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 467 | static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object) | ||
| 468 | { | ||
| 469 | if (QWebEngineView *v = qobject_cast<QWebEngineView*>(object)) | ||
| 470 | return new QWebEngineViewAccessible(v); | ||
| 471 | return Q_NULLPTR; | ||
| 472 | } | ||
| 473 | +#endif // QT_NO_ACCESSIBILITY | ||
| 474 | |||
| 475 | QWebEngineViewPrivate::QWebEngineViewPrivate() | ||
| 476 | : page(0) | ||
| 477 | , m_pendingContextMenuEvent(false) | ||
| 478 | { | ||
| 479 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 480 | QAccessible::installFactory(&webAccessibleFactory); | ||
| 481 | +#endif // QT_NO_ACCESSIBILITY | ||
| 482 | } | ||
| 483 | |||
| 484 | QWebEngineView::QWebEngineView(QWidget *parent) | ||
| 485 | @@ -274,6 +277,7 @@ void QWebEngineView::contextMenuEvent(QContextMenuEvent *event) | ||
| 486 | menu->popup(event->globalPos()); | ||
| 487 | } | ||
| 488 | |||
| 489 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 490 | int QWebEngineViewAccessible::childCount() const | ||
| 491 | { | ||
| 492 | if (view() && child(0)) | ||
| 493 | @@ -294,6 +298,7 @@ int QWebEngineViewAccessible::indexOfChild(const QAccessibleInterface *c) const | ||
| 494 | return 0; | ||
| 495 | return -1; | ||
| 496 | } | ||
| 497 | +#endif // QT_NO_ACCESSIBILITY | ||
| 498 | |||
| 499 | QT_END_NAMESPACE | ||
| 500 | |||
| 501 | diff --git a/src/webenginewidgets/api/qwebengineview_p.h b/src/webenginewidgets/api/qwebengineview_p.h | ||
| 502 | index 9db971f..e0cc3f4 100644 | ||
| 503 | --- a/src/webenginewidgets/api/qwebengineview_p.h | ||
| 504 | +++ b/src/webenginewidgets/api/qwebengineview_p.h | ||
| 505 | @@ -59,6 +59,7 @@ public: | ||
| 506 | bool m_pendingContextMenuEvent; | ||
| 507 | }; | ||
| 508 | |||
| 509 | +#ifndef QT_NO_ACCESSIBILITY | ||
| 510 | class QWebEngineViewAccessible : public QAccessibleWidget | ||
| 511 | { | ||
| 512 | public: | ||
| 513 | @@ -72,7 +73,7 @@ public: | ||
| 514 | private: | ||
| 515 | QWebEngineView *view() const { return static_cast<QWebEngineView*>(object()); } | ||
| 516 | }; | ||
| 517 | - | ||
| 518 | +#endif // QT_NO_ACCESSIBILITY | ||
| 519 | |||
| 520 | QT_END_NAMESPACE | ||
| 521 | |||
| 522 | diff --git a/tests/quicktestbrowser/quicktestbrowser.pro b/tests/quicktestbrowser/quicktestbrowser.pro | ||
| 523 | index ac8fe74..51ea5a2 100644 | ||
| 524 | --- a/tests/quicktestbrowser/quicktestbrowser.pro | ||
| 525 | +++ b/tests/quicktestbrowser/quicktestbrowser.pro | ||
| 526 | @@ -1,3 +1,5 @@ | ||
| 527 | +requires(contains(QT_CONFIG, accessibility)) | ||
| 528 | + | ||
| 529 | TEMPLATE = app | ||
| 530 | TARGET = quicktestbrowser | ||
| 531 | |||
| 532 | -- | ||
| 533 | 2.3.1 | ||
| 534 | |||
