summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-07 17:51:13 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-11 14:33:48 +0200
commit1df15a830112bb6df104a94453105c74ada0fbf5 (patch)
tree077f59d272bfb3b5f5f6da9a127eaab87615b32c
parent6ac1bf6434f2a508b895f6da7997bd90a5a8c08a (diff)
Implement functions of BrowserAccessibilityDelegate
This is in line with how other platforms do it. Change-Id: Ia258511d3fa35387a69c81c9c02c181fc2995e6c Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--src/core/browser_accessibility_delegate_qt.cpp94
-rw-r--r--src/core/browser_accessibility_delegate_qt.h79
-rw-r--r--src/core/core_gyp_generator.pro1
-rw-r--r--src/core/render_widget_host_view_qt.cpp52
-rw-r--r--src/core/render_widget_host_view_qt.h12
5 files changed, 60 insertions, 178 deletions
diff --git a/src/core/browser_accessibility_delegate_qt.cpp b/src/core/browser_accessibility_delegate_qt.cpp
deleted file mode 100644
index a692b2621..000000000
--- a/src/core/browser_accessibility_delegate_qt.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "browser_accessibility_delegate_qt.h"
-
-#include <QtCore/qglobal.h>
-
-BrowserAccessibilityDelegateQt::BrowserAccessibilityDelegateQt(content::RenderWidgetHostViewBase *rwhv)
- : m_rwhv(rwhv)
-{
- Q_ASSERT(m_rwhv);
-}
-
-bool BrowserAccessibilityDelegateQt::HasFocus() const
-{
- return m_rwhv->HasFocus();
-}
-
-gfx::Rect BrowserAccessibilityDelegateQt::GetViewBounds() const
-{
- return m_rwhv->GetViewBounds();
-}
-
-void BrowserAccessibilityDelegateQt::SetAccessibilityFocus(int acc_obj_id)
-{
-}
-
-void BrowserAccessibilityDelegateQt::AccessibilityDoDefaultAction(int acc_obj_id)
-{
-}
-
-void BrowserAccessibilityDelegateQt::AccessibilityScrollToMakeVisible(
- int acc_obj_id, gfx::Rect subfocus)
-{
-}
-
-void BrowserAccessibilityDelegateQt::AccessibilityScrollToPoint(
- int acc_obj_id, gfx::Point point)
-{
-}
-
-void BrowserAccessibilityDelegateQt::AccessibilitySetTextSelection(
- int acc_obj_id, int start_offset, int end_offset)
-{
-}
-
-gfx::Point BrowserAccessibilityDelegateQt::GetLastTouchEventLocation() const
-{
- return gfx::Point();
-}
-
-void BrowserAccessibilityDelegateQt::FatalAccessibilityTreeError()
-{
- qWarning("BrowserAccessibilityDelegateQt::FatalAccessibilityTreeError");
- m_rwhv->SetBrowserAccessibilityManager(0);
-}
diff --git a/src/core/browser_accessibility_delegate_qt.h b/src/core/browser_accessibility_delegate_qt.h
deleted file mode 100644
index 1174f2378..000000000
--- a/src/core/browser_accessibility_delegate_qt.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BROWSER_ACCESSIBILITY_DELEGATE_QT_H
-#define BROWSER_ACCESSIBILITY_DELEGATE_QT_H
-
-#include <QtCore/qglobal.h>
-
-#include "content/browser/accessibility/browser_accessibility_manager.h"
-#include "content/browser/renderer_host/render_widget_host_view_base.h"
-
-class BrowserAccessibilityDelegateQt
- : public content::BrowserAccessibilityDelegate
-{
-public:
- BrowserAccessibilityDelegateQt(content::RenderWidgetHostViewBase *rwhv);
-
- virtual bool HasFocus() const Q_DECL_OVERRIDE;
- virtual void SetAccessibilityFocus(int acc_obj_id) Q_DECL_OVERRIDE;
-
- virtual void AccessibilityDoDefaultAction(int acc_obj_id) Q_DECL_OVERRIDE;
-
- virtual gfx::Rect GetViewBounds() const Q_DECL_OVERRIDE;
- virtual void AccessibilityScrollToMakeVisible(
- int acc_obj_id, gfx::Rect subfocus) Q_DECL_OVERRIDE;
- virtual void AccessibilityScrollToPoint(
- int acc_obj_id, gfx::Point point) Q_DECL_OVERRIDE;
-
- virtual void AccessibilitySetTextSelection(
- int acc_obj_id, int start_offset, int end_offset) Q_DECL_OVERRIDE;
-
- virtual gfx::Point GetLastTouchEventLocation() const Q_DECL_OVERRIDE;
-
- virtual void FatalAccessibilityTreeError() Q_DECL_OVERRIDE;
-
-private:
- Q_DISABLE_COPY(BrowserAccessibilityDelegateQt)
- content::RenderWidgetHostViewBase *m_rwhv;
-};
-
-#endif
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index d86811ce3..0e67eb59b 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -36,7 +36,6 @@ RESOURCES += devtools.qrc
INCLUDEPATH += $$[QT_INSTALL_HEADERS] $$PWD
SOURCES = \
- browser_accessibility_delegate_qt.cpp \
browser_accessibility_manager_qt.cpp \
browser_accessibility_qt.cpp \
browser_context_qt.cpp \
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 21de24d45..f29e36ae5 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -273,11 +273,10 @@ void RenderWidgetHostViewQt::CreateBrowserAccessibilityManagerIfNeeded()
if (GetBrowserAccessibilityManager())
return;
- m_accessibilityDelegate = scoped_ptr<BrowserAccessibilityDelegateQt>(new BrowserAccessibilityDelegateQt(this));
SetBrowserAccessibilityManager(new content::BrowserAccessibilityManagerQt(
m_adapterClient->accessibilityParentObject(),
content::BrowserAccessibilityManagerQt::GetEmptyDocument(),
- m_accessibilityDelegate.get()));
+ this));
}
// Set focus to the associated View component.
@@ -969,6 +968,55 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev)
}
}
+void RenderWidgetHostViewQt::SetAccessibilityFocus(int acc_obj_id)
+{
+ if (!m_host)
+ return;
+ m_host->AccessibilitySetFocus(acc_obj_id);
+}
+
+void RenderWidgetHostViewQt::AccessibilityDoDefaultAction(int acc_obj_id)
+{
+ if (!m_host)
+ return;
+ m_host->AccessibilityDoDefaultAction(acc_obj_id);
+}
+
+void RenderWidgetHostViewQt::AccessibilityScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus)
+{
+ if (!m_host)
+ return;
+ m_host->AccessibilityScrollToMakeVisible(acc_obj_id, subfocus);
+}
+
+void RenderWidgetHostViewQt::AccessibilityScrollToPoint(int acc_obj_id, gfx::Point point)
+{
+ if (!m_host)
+ return;
+ m_host->AccessibilityScrollToPoint(acc_obj_id, point);
+}
+
+void RenderWidgetHostViewQt::AccessibilitySetTextSelection(int acc_obj_id, int start_offset, int end_offset)
+{
+ if (!m_host)
+ return;
+ m_host->AccessibilitySetTextSelection(acc_obj_id, start_offset, end_offset);
+}
+
+gfx::Point RenderWidgetHostViewQt::GetLastTouchEventLocation() const
+{
+ QT_NOT_YET_IMPLEMENTED
+ return gfx::Point();
+}
+
+void RenderWidgetHostViewQt::FatalAccessibilityTreeError()
+{
+ if (!m_host)
+ return;
+ m_host->FatalAccessibilityTreeError();
+ SetBrowserAccessibilityManager(NULL);
+}
+
void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev)
{
m_host->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale()));
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 66cbef501..7f2090995 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -44,7 +44,6 @@
#include "render_widget_host_view_qt_delegate.h"
-#include "browser_accessibility_delegate_qt.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "cc/resources/transferable_resource.h"
@@ -93,6 +92,7 @@ class RenderWidgetHostViewQt
, public ui::GestureConsumer
, public ui::GestureEventHelper
, public RenderWidgetHostViewQtDelegateClient
+ , public content::BrowserAccessibilityDelegate
, public base::SupportsWeakPtr<RenderWidgetHostViewQt>
{
public:
@@ -210,6 +210,15 @@ public:
#endif // defined(USE_AURA)
#endif // defined(OS_WIN)
+ // Overridden from content::BrowserAccessibilityDelegate
+ virtual void SetAccessibilityFocus(int acc_obj_id) Q_DECL_OVERRIDE;
+ virtual void AccessibilityDoDefaultAction(int acc_obj_id) Q_DECL_OVERRIDE;
+ virtual void AccessibilityScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus) Q_DECL_OVERRIDE;
+ virtual void AccessibilityScrollToPoint(int acc_obj_id, gfx::Point point) Q_DECL_OVERRIDE;
+ virtual void AccessibilitySetTextSelection(int acc_obj_id, int start_offset, int end_offset) Q_DECL_OVERRIDE;
+ virtual gfx::Point GetLastTouchEventLocation() const Q_DECL_OVERRIDE;
+ virtual void FatalAccessibilityTreeError() Q_DECL_OVERRIDE;
+
QAccessibleInterface *GetQtAccessible();
private:
@@ -230,7 +239,6 @@ private:
QMap<int, int> m_touchIdMapping;
blink::WebTouchEvent m_accumTouchEvent;
scoped_ptr<RenderWidgetHostViewQtDelegate> m_delegate;
- scoped_ptr<BrowserAccessibilityDelegateQt> m_accessibilityDelegate;
QExplicitlySharedDataPointer<DelegatedFrameNodeData> m_frameNodeData;
cc::ReturnedResourceArray m_resourcesToRelease;