- Revision
- 122702
- Author
- commit-qu...@webkit.org
- Date
- 2012-07-16 00:45:51 -0700 (Mon, 16 Jul 2012)
Log Message
Source/WebKit: Add accessible for QWebView.
https://bugs.webkit.org/show_bug.cgi?id=91073
Patch by Frederik Gladhorn <frederik.gladh...@nokia.com> on 2012-07-16
Reviewed by Simon Hausmann.
Add classes to enable accessibility on the widget level.
* WebKit.pri:
* WebKit1.pro:
Source/WebKit/qt: Accessible Widget for QWebView
https://bugs.webkit.org/show_bug.cgi?id=91073
Added classes that allow navigation to the web view widget.
This is the glue to later access webkit's accessible objects
though the Qt accessibility framework.
Patch by Frederik Gladhorn <frederik.gladh...@nokia.com> on 2012-07-16
Reviewed by Simon Hausmann.
* Api/qwebview.cpp:
(QWebView::QWebView):
* Api/qwebviewaccessible.cpp: Added.
(accessibleInterfaceFactory):
(QWebFrameAccessible::QWebFrameAccessible):
(QWebFrameAccessible::frame):
(QWebFrameAccessible::parent):
(QWebFrameAccessible::text):
(QWebFrameAccessible::childCount):
(QWebFrameAccessible::child):
(QWebFrameAccessible::indexOfChild):
(QWebFrameAccessible::state):
(QWebFrameAccessible::role):
(QWebFrameAccessible::navigate):
(QWebPageAccessible::QWebPageAccessible):
(QWebPageAccessible::page):
(QWebPageAccessible::text):
(QWebPageAccessible::parent):
(QWebPageAccessible::child):
(QWebPageAccessible::childCount):
(QWebPageAccessible::indexOfChild):
(QWebPageAccessible::navigate):
(QWebPageAccessible::role):
(QWebPageAccessible::state):
(QWebViewAccessible::QWebViewAccessible):
(QWebViewAccessible::view):
(QWebViewAccessible::childCount):
(QWebViewAccessible::child):
* Api/qwebviewaccessible_p.h: Added.
(QWebFrameAccessible):
(QWebPageAccessible):
(QWebViewAccessible):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (122701 => 122702)
--- trunk/Source/WebKit/ChangeLog 2012-07-16 07:24:17 UTC (rev 122701)
+++ trunk/Source/WebKit/ChangeLog 2012-07-16 07:45:51 UTC (rev 122702)
@@ -1,3 +1,15 @@
+2012-07-16 Frederik Gladhorn <frederik.gladh...@nokia.com>
+
+ Add accessible for QWebView.
+ https://bugs.webkit.org/show_bug.cgi?id=91073
+
+ Reviewed by Simon Hausmann.
+
+ Add classes to enable accessibility on the widget level.
+
+ * WebKit.pri:
+ * WebKit1.pro:
+
2012-07-15 Gyuyoung Kim <gyuyoung....@samsung.com>
[EFL] Move files guarded by #ifdef to existing file list.
Modified: trunk/Source/WebKit/WebKit.pri (122701 => 122702)
--- trunk/Source/WebKit/WebKit.pri 2012-07-16 07:24:17 UTC (rev 122701)
+++ trunk/Source/WebKit/WebKit.pri 2012-07-16 07:45:51 UTC (rev 122702)
@@ -37,3 +37,8 @@
$$PWD/qt/Api/qwebplugindatabase_p.h \
$$PWD/qt/Api/qhttpheader_p.h
+haveQt(5): contains(CONFIG, accessibility) {
+ SOURCES += $$PWD/qt/Api/qwebviewaccessible.cpp
+ HEADERS += $$PWD/qt/Api/qwebviewaccessible_p.h
+}
+
Modified: trunk/Source/WebKit/WebKit1.pro (122701 => 122702)
--- trunk/Source/WebKit/WebKit1.pro 2012-07-16 07:24:17 UTC (rev 122701)
+++ trunk/Source/WebKit/WebKit1.pro 2012-07-16 07:45:51 UTC (rev 122702)
@@ -94,6 +94,11 @@
$$PWD/qt/WebCoreSupport/PlatformStrategiesQt.h \
$$PWD/qt/WebCoreSupport/WebEventConversion.h
+haveQt(5): contains(QT_CONFIG,accessibility) {
+ SOURCES += $$PWD/qt/Api/qwebviewaccessible.cpp
+ HEADERS += $$PWD/qt/Api/qwebviewaccessible_p.h
+}
+
INCLUDEPATH += \
$$PWD/qt/Api \
$$PWD/qt/WebCoreSupport
Modified: trunk/Source/WebKit/qt/Api/qwebview.cpp (122701 => 122702)
--- trunk/Source/WebKit/qt/Api/qwebview.cpp 2012-07-16 07:24:17 UTC (rev 122701)
+++ trunk/Source/WebKit/qt/Api/qwebview.cpp 2012-07-16 07:45:51 UTC (rev 122702)
@@ -33,6 +33,11 @@
#include "qprinter.h"
#include "qdir.h"
#include "qfile.h"
+#ifndef QT_NO_ACCESSIBILITY
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include "qwebviewaccessible_p.h"
+#endif
+#endif
class QWebViewPrivate {
public:
@@ -148,6 +153,23 @@
{Google Chat Example}, {Fancy Browser Example}
*/
+#ifndef QT_NO_ACCESSIBILITY
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+static QAccessibleInterface* accessibleInterfaceFactory(const QString& key, QObject* object)
+{
+ Q_UNUSED(key)
+
+ if (QWebPage* page = qobject_cast<QWebPage*>(object))
+ return new QWebPageAccessible(page);
+ if (QWebView* view = qobject_cast<QWebView*>(object))
+ return new QWebViewAccessible(view);
+ if (QWebFrame* frame = qobject_cast<QWebFrame*>(object))
+ return new QWebFrameAccessible(frame);
+ return 0;
+}
+#endif
+#endif
+
/*!
Constructs an empty QWebView with parent \a parent.
@@ -167,6 +189,12 @@
setMouseTracking(true);
setFocusPolicy(Qt::WheelFocus);
+
+#ifndef QT_NO_ACCESSIBILITY
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ QAccessible::installFactory(accessibleInterfaceFactory);
+#endif
+#endif
}
/*!
Added: trunk/Source/WebKit/qt/Api/qwebviewaccessible.cpp (0 => 122702)
--- trunk/Source/WebKit/qt/Api/qwebviewaccessible.cpp (rev 0)
+++ trunk/Source/WebKit/qt/Api/qwebviewaccessible.cpp 2012-07-16 07:45:51 UTC (rev 122702)
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "qwebviewaccessible_p.h"
+
+#include "qwebframe.h"
+#include "qwebframe_p.h"
+#include "qwebpage.h"
+#include "qwebview.h"
+
+QWebFrameAccessible::QWebFrameAccessible(QWebFrame* frame)
+ : QAccessibleObject(frame)
+{
+}
+
+QWebFrame* QWebFrameAccessible::frame() const
+{
+ return qobject_cast<QWebFrame*>(object());
+}
+
+QAccessibleInterface* QWebFrameAccessible::parent() const
+{
+ return QAccessible::queryAccessibleInterface(object()->parent());
+}
+
+QString QWebFrameAccessible::text(QAccessible::Text) const
+{
+ return QString();
+}
+
+int QWebFrameAccessible::childCount() const
+{
+ return 0;
+}
+
+QAccessibleInterface* QWebFrameAccessible::child(int index) const
+{
+ return 0;
+}
+
+int QWebFrameAccessible::indexOfChild(const QAccessibleInterface*) const
+{
+ return 0;
+}
+
+QAccessible::State QWebFrameAccessible::state() const
+{
+ return QAccessible::State();
+}
+
+QAccessible::Role QWebFrameAccessible::role() const
+{
+ return QAccessible::Client;
+}
+
+int QWebFrameAccessible::navigate(QAccessible::RelationFlag, int, QAccessibleInterface** target) const
+{
+ *target = 0;
+ return -1;
+}
+
+QWebPageAccessible::QWebPageAccessible(QWebPage* page)
+ : QAccessibleObject(page)
+{
+}
+
+QWebPage* QWebPageAccessible::page() const
+{
+ return qobject_cast<QWebPage*>(object());
+}
+
+QString QWebPageAccessible::text(QAccessible::Text t) const
+{
+ return QString();
+}
+
+QAccessibleInterface* QWebPageAccessible::parent() const
+{
+ return QAccessible::queryAccessibleInterface(object()->parent());
+}
+
+QAccessibleInterface* QWebPageAccessible::child(int index) const
+{
+ if (!index && page()->mainFrame())
+ return new QWebFrameAccessible(page()->mainFrame());
+ return 0;
+}
+
+int QWebPageAccessible::childCount() const
+{
+ return page()->mainFrame() ? 1 : 0;
+}
+
+int QWebPageAccessible::indexOfChild(const QAccessibleInterface*) const
+{
+ return 0;
+}
+
+int QWebPageAccessible::navigate(QAccessible::RelationFlag, int, QAccessibleInterface** target) const
+{
+ *target = 0;
+ return -1;
+}
+
+QAccessible::Role QWebPageAccessible::role() const
+{
+ return QAccessible::Client;
+}
+
+QAccessible::State QWebPageAccessible::state() const
+{
+ return QAccessible::State();
+}
+
+QWebViewAccessible::QWebViewAccessible(QWebView* view)
+ : QAccessibleWidget(view, QAccessible::Document)
+{
+}
+
+QWebView* QWebViewAccessible::view() const
+{
+ return qobject_cast<QWebView*>(object());
+}
+
+int QWebViewAccessible::childCount() const
+{
+ return view()->page() ? 1 : 0;
+}
+
+QAccessibleInterface* QWebViewAccessible::child(int index) const
+{
+ if (!index && view()->page())
+ return new QWebPageAccessible(view()->page());
+ return 0;
+}
Added: trunk/Source/WebKit/qt/Api/qwebviewaccessible_p.h (0 => 122702)
--- trunk/Source/WebKit/qt/Api/qwebviewaccessible_p.h (rev 0)
+++ trunk/Source/WebKit/qt/Api/qwebviewaccessible_p.h 2012-07-16 07:45:51 UTC (rev 122702)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef qwebviewaccessible_p_h
+#define qwebviewaccessible_p_h
+
+#include <qaccessible.h>
+#include <qaccessibleobject.h>
+#include <qaccessiblewidget.h>
+
+class QWebFrame;
+class QWebPage;
+class QWebView;
+
+/*
+ * Classes representing accessible objects for View, Frame and Page.
+ *
+ * Each of these just returns one child which lets the accessibility
+ * framwork navigate towards the actual contents in the frame.
+ */
+
+class QWebFrameAccessible : public QAccessibleObject {
+public:
+ QWebFrameAccessible(QWebFrame*);
+
+ QWebFrame* frame() const;
+
+ QAccessibleInterface* parent() const;
+ int childCount() const;
+ QAccessibleInterface* child(int index) const;
+ int indexOfChild(const QAccessibleInterface*) const;
+ int navigate(QAccessible::RelationFlag, int, QAccessibleInterface** target) const;
+
+ QString text(QAccessible::Text) const;
+ QAccessible::Role role() const;
+ QAccessible::State state() const;
+};
+
+class QWebPageAccessible : public QAccessibleObject {
+public:
+ QWebPageAccessible(QWebPage*);
+
+ QWebPage* page() const;
+
+ QAccessibleInterface* parent() const;
+ int childCount() const;
+ QAccessibleInterface* child(int index) const;
+ int indexOfChild(const QAccessibleInterface*) const;
+ int navigate(QAccessible::RelationFlag, int, QAccessibleInterface** target) const;
+
+ QString text(QAccessible::Text) const;
+ QAccessible::Role role() const;
+ QAccessible::State state() const;
+};
+
+class QWebViewAccessible : public QAccessibleWidget {
+public:
+ QWebViewAccessible(QWebView*);
+
+ QWebView* view() const;
+
+ int childCount() const;
+ QAccessibleInterface* child(int index) const;
+};
+
+#endif
Modified: trunk/Source/WebKit/qt/ChangeLog (122701 => 122702)
--- trunk/Source/WebKit/qt/ChangeLog 2012-07-16 07:24:17 UTC (rev 122701)
+++ trunk/Source/WebKit/qt/ChangeLog 2012-07-16 07:45:51 UTC (rev 122702)
@@ -1,3 +1,47 @@
+2012-07-16 Frederik Gladhorn <frederik.gladh...@nokia.com>
+
+ Accessible Widget for QWebView
+ https://bugs.webkit.org/show_bug.cgi?id=91073
+
+ Added classes that allow navigation to the web view widget.
+ This is the glue to later access webkit's accessible objects
+ though the Qt accessibility framework.
+
+ Reviewed by Simon Hausmann.
+
+ * Api/qwebview.cpp:
+ (QWebView::QWebView):
+ * Api/qwebviewaccessible.cpp: Added.
+ (accessibleInterfaceFactory):
+ (QWebFrameAccessible::QWebFrameAccessible):
+ (QWebFrameAccessible::frame):
+ (QWebFrameAccessible::parent):
+ (QWebFrameAccessible::text):
+ (QWebFrameAccessible::childCount):
+ (QWebFrameAccessible::child):
+ (QWebFrameAccessible::indexOfChild):
+ (QWebFrameAccessible::state):
+ (QWebFrameAccessible::role):
+ (QWebFrameAccessible::navigate):
+ (QWebPageAccessible::QWebPageAccessible):
+ (QWebPageAccessible::page):
+ (QWebPageAccessible::text):
+ (QWebPageAccessible::parent):
+ (QWebPageAccessible::child):
+ (QWebPageAccessible::childCount):
+ (QWebPageAccessible::indexOfChild):
+ (QWebPageAccessible::navigate):
+ (QWebPageAccessible::role):
+ (QWebPageAccessible::state):
+ (QWebViewAccessible::QWebViewAccessible):
+ (QWebViewAccessible::view):
+ (QWebViewAccessible::childCount):
+ (QWebViewAccessible::child):
+ * Api/qwebviewaccessible_p.h: Added.
+ (QWebFrameAccessible):
+ (QWebPageAccessible):
+ (QWebViewAccessible):
+
2012-07-12 Huang Dongsung <luxte...@company100.net>
[Qt] Increase the drawing performance by merging dirty rects.