Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp

Issue 13726025: Remove GTK AX support, we've never used it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2008 Nuanti Ltd.
3 * Copyright (C) 2009 Jan Alonzo
4 * Copyright (C) 2012 Igalia S.L.
5 * Copyright (C) 2013 Samsung Electronics
6 *
7 * Portions from Mozilla a11y, copyright as follows:
8 *
9 * The Original Code is mozilla.org code.
10 *
11 * The Initial Developer of the Original Code is
12 * Sun Microsystems, Inc.
13 * Portions created by the Initial Developer are Copyright (C) 2002
14 * the Initial Developer. All Rights Reserved.
15 *
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Library General Public
18 * License as published by the Free Software Foundation; either
19 * version 2 of the License, or (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Library General Public License for more details.
25 *
26 * You should have received a copy of the GNU Library General Public License
27 * along with this library; see the file COPYING.LIB. If not, write to
28 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
29 * Boston, MA 02110-1301, USA.
30 */
31
32 #include "config.h"
33 #include "WebKitAccessibleInterfaceDocument.h"
34
35 #if HAVE(ACCESSIBILITY)
36
37 #include "AccessibilityObject.h"
38 #include "Document.h"
39 #include "DocumentType.h"
40 #include "WebKitAccessibleUtil.h"
41 #include "WebKitAccessibleWrapperAtk.h"
42
43 using namespace WebCore;
44
45 static AccessibilityObject* core(AtkDocument* document)
46 {
47 if (!WEBKIT_IS_ACCESSIBLE(document))
48 return 0;
49
50 return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(document));
51 }
52
53 static const gchar* documentAttributeValue(AtkDocument* document, const gchar* a ttribute)
54 {
55 Document* coreDocument = core(document)->document();
56 if (!coreDocument)
57 return 0;
58
59 String value = String();
60 AtkCachedProperty atkCachedProperty;
61
62 if (!g_ascii_strcasecmp(attribute, "DocType") && coreDocument->doctype()) {
63 value = coreDocument->doctype()->name();
64 atkCachedProperty = AtkCachedDocumentType;
65 } else if (!g_ascii_strcasecmp(attribute, "Encoding")) {
66 value = coreDocument->charset();
67 atkCachedProperty = AtkCachedDocumentEncoding;
68 } else if (!g_ascii_strcasecmp(attribute, "URI")) {
69 value = coreDocument->documentURI();
70 atkCachedProperty = AtkCachedDocumentURI;
71 }
72
73 if (!value.isEmpty())
74 return cacheAndReturnAtkProperty(ATK_OBJECT(document), atkCachedProperty , value);
75
76 return 0;
77 }
78
79 static const gchar* webkitAccessibleDocumentGetAttributeValue(AtkDocument* docum ent, const gchar* attribute)
80 {
81 return documentAttributeValue(document, attribute);
82 }
83
84 static AtkAttributeSet* webkitAccessibleDocumentGetAttributes(AtkDocument* docum ent)
85 {
86 AtkAttributeSet* attributeSet = 0;
87 const gchar* attributes[] = { "DocType", "Encoding", "URI" };
88
89 for (unsigned i = 0; i < G_N_ELEMENTS(attributes); i++) {
90 const gchar* value = documentAttributeValue(document, attributes[i]);
91 if (value)
92 attributeSet = addToAtkAttributeSet(attributeSet, attributes[i], val ue);
93 }
94
95 return attributeSet;
96 }
97
98 static const gchar* webkitAccessibleDocumentGetLocale(AtkDocument* document)
99 {
100 // TODO: Should we fall back on lang xml:lang when the following comes up em pty?
101 String language = core(document)->language();
102 if (!language.isEmpty())
103 return cacheAndReturnAtkProperty(ATK_OBJECT(document), AtkCachedDocument Locale, language);
104
105 return 0;
106 }
107
108 void webkitAccessibleDocumentInterfaceInit(AtkDocumentIface* iface)
109 {
110 iface->get_document_attribute_value = webkitAccessibleDocumentGetAttributeVa lue;
111 iface->get_document_attributes = webkitAccessibleDocumentGetAttributes;
112 iface->get_document_locale = webkitAccessibleDocumentGetLocale;
113 }
114
115 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698