1/* 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20#include "config.h" 21#include "qwebviewaccessible_p.h" 22 23#include "qwebframe.h" 24#include "qwebframe_p.h" 25#include "qwebpage.h" 26#include "qwebview.h" 27 28QWebFrameAccessible::QWebFrameAccessible(QWebFrame* frame) 29 : QAccessibleObject(frame) 30{ 31} 32 33QWebFrame* QWebFrameAccessible::frame() const 34{ 35 return qobject_cast<QWebFrame*>(object()); 36} 37 38QAccessibleInterface* QWebFrameAccessible::parent() const 39{ 40 return QAccessible::queryAccessibleInterface(object()->parent()); 41} 42 43QString QWebFrameAccessible::text(QAccessible::Text) const 44{ 45 return QString(); 46} 47 48int QWebFrameAccessible::childCount() const 49{ 50 return 0; 51} 52 53QAccessibleInterface* QWebFrameAccessible::child(int index) const 54{ 55 return 0; 56} 57 58int QWebFrameAccessible::indexOfChild(const QAccessibleInterface*) const 59{ 60 return 0; 61} 62 63QAccessible::State QWebFrameAccessible::state() const 64{ 65 return QAccessible::State(); 66} 67 68QAccessible::Role QWebFrameAccessible::role() const 69{ 70 return QAccessible::Client; 71} 72 73int QWebFrameAccessible::navigate(QAccessible::RelationFlag, int, QAccessibleInterface** target) const 74{ 75 *target = 0; 76 return -1; 77} 78 79QWebPageAccessible::QWebPageAccessible(QWebPage* page) 80 : QAccessibleObject(page) 81{ 82} 83 84QWebPage* QWebPageAccessible::page() const 85{ 86 return qobject_cast<QWebPage*>(object()); 87} 88 89QString QWebPageAccessible::text(QAccessible::Text t) const 90{ 91 return QString(); 92} 93 94QAccessibleInterface* QWebPageAccessible::parent() const 95{ 96 return QAccessible::queryAccessibleInterface(object()->parent()); 97} 98 99QAccessibleInterface* QWebPageAccessible::child(int index) const 100{ 101 if (!index && page()->mainFrame()) 102 return new QWebFrameAccessible(page()->mainFrame()); 103 return 0; 104} 105 106int QWebPageAccessible::childCount() const 107{ 108 return page()->mainFrame() ? 1 : 0; 109} 110 111int QWebPageAccessible::indexOfChild(const QAccessibleInterface*) const 112{ 113 return 0; 114} 115 116int QWebPageAccessible::navigate(QAccessible::RelationFlag, int, QAccessibleInterface** target) const 117{ 118 *target = 0; 119 return -1; 120} 121 122QAccessible::Role QWebPageAccessible::role() const 123{ 124 return QAccessible::Client; 125} 126 127QAccessible::State QWebPageAccessible::state() const 128{ 129 return QAccessible::State(); 130} 131 132QWebViewAccessible::QWebViewAccessible(QWebView* view) 133 : QAccessibleWidget(view, QAccessible::Document) 134{ 135} 136 137QWebView* QWebViewAccessible::view() const 138{ 139 return qobject_cast<QWebView*>(object()); 140} 141 142int QWebViewAccessible::childCount() const 143{ 144 return view()->page() ? 1 : 0; 145} 146 147QAccessibleInterface* QWebViewAccessible::child(int index) const 148{ 149 if (!index && view()->page()) 150 return new QWebPageAccessible(view()->page()); 151 return 0; 152} 153