Title: [105721] trunk/Source/WebCore
Revision
105721
Author
[email protected]
Date
2012-01-24 03:40:44 -0800 (Tue, 24 Jan 2012)

Log Message

[GTK] Refactor GTK's accessibilitity code to be more modular
https://bugs.webkit.org/show_bug.cgi?id=76783

Reviewed by Martin Robinson.

New files for the implementation of the AtkDocument interface,
containing the related code from WebKitAccessibleWrapperAtk.cpp.

* accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp: Added.
(core):
(documentAttributeValue):
(webkitAccessibleDocumentInterfaceInit):
(webkitAccessibleDocumentGetAttributeValue):
(webkitAccessibleDocumentGetAttributes):
(webkitAccessibleDocumentGetLocale):
* accessibility/gtk/WebKitAccessibleInterfaceDocument.h: Added.

Move common function addAttributeToSet() out from the wrapper to
the utility file, used from WebKitAccessibleInterfaceDocument.cpp.

* accessibility/gtk/WebKitAccessibleUtil.cpp:
(addToAtkAttributeSet): Taken from WebKitAccessibleWrapperAtk.cpp.
* accessibility/gtk/WebKitAccessibleUtil.h:
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove local
implementation of addAttributeToSet, as well as all the code related
to the implementation of the AtkDocument interface.

Add new files to build files.

* GNUmakefile.list.am: Add WebKitAccessibleInterfaceDocument.[h|cpp].
* WebCore.gypi: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105720 => 105721)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 11:29:01 UTC (rev 105720)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 11:40:44 UTC (rev 105721)
@@ -5,6 +5,40 @@
 
         Reviewed by Martin Robinson.
 
+        New files for the implementation of the AtkDocument interface,
+        containing the related code from WebKitAccessibleWrapperAtk.cpp.
+
+        * accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp: Added.
+        (core):
+        (documentAttributeValue):
+        (webkitAccessibleDocumentInterfaceInit):
+        (webkitAccessibleDocumentGetAttributeValue):
+        (webkitAccessibleDocumentGetAttributes):
+        (webkitAccessibleDocumentGetLocale):
+        * accessibility/gtk/WebKitAccessibleInterfaceDocument.h: Added.
+
+        Move common function addAttributeToSet() out from the wrapper to
+        the utility file, used from WebKitAccessibleInterfaceDocument.cpp.
+
+        * accessibility/gtk/WebKitAccessibleUtil.cpp:
+        (addToAtkAttributeSet): Taken from WebKitAccessibleWrapperAtk.cpp.
+        * accessibility/gtk/WebKitAccessibleUtil.h:
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove local
+        implementation of addAttributeToSet, as well as all the code related
+        to the implementation of the AtkDocument interface.
+
+        Add new files to build files.
+
+        * GNUmakefile.list.am: Add WebKitAccessibleInterfaceDocument.[h|cpp].
+        * WebCore.gypi: Ditto.
+
+2012-01-24  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Refactor GTK's accessibilitity code to be more modular
+        https://bugs.webkit.org/show_bug.cgi?id=76783
+
+        Reviewed by Martin Robinson.
+
         New files for the implementation of the AtkComponent interface,
         containing the related code from WebKitAccessibleWrapperAtk.cpp.
 

Modified: trunk/Source/WebCore/GNUmakefile.list.am (105720 => 105721)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-01-24 11:29:01 UTC (rev 105720)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-01-24 11:40:44 UTC (rev 105721)
@@ -4425,6 +4425,8 @@
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceAction.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceComponent.h \
+	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp \
+	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp \

Modified: trunk/Source/WebCore/WebCore.gypi (105720 => 105721)


--- trunk/Source/WebCore/WebCore.gypi	2012-01-24 11:29:01 UTC (rev 105720)
+++ trunk/Source/WebCore/WebCore.gypi	2012-01-24 11:40:44 UTC (rev 105721)
@@ -1349,6 +1349,8 @@
             'accessibility/gtk/WebKitAccessibleInterfaceAction.h',
             'accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp',
             'accessibility/gtk/WebKitAccessibleInterfaceComponent.h',
+            'accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp',
+            'accessibility/gtk/WebKitAccessibleInterfaceDocument.h',
             'accessibility/gtk/WebKitAccessibleUtil.cpp',
             'accessibility/gtk/WebKitAccessibleUtil.h',
             'accessibility/gtk/WebKitAccessibleWrapperAtk.cpp',

Added: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp (0 => 105721)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.cpp	2012-01-24 11:40:44 UTC (rev 105721)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Portions from Mozilla a11y, copyright as follows:
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Sun Microsystems, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * 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 "WebKitAccessibleInterfaceDocument.h"
+
+#include "AccessibilityObject.h"
+#include "Document.h"
+#include "DocumentType.h"
+#include "WebKitAccessibleUtil.h"
+#include "WebKitAccessibleWrapperAtk.h"
+
+using namespace WebCore;
+
+static AccessibilityObject* core(AtkDocument* document)
+{
+    if (!WEBKIT_IS_ACCESSIBLE(document))
+        return 0;
+
+    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(document));
+}
+
+static const gchar* documentAttributeValue(AtkDocument* document, const gchar* attribute)
+{
+    Document* coreDocument = core(document)->document();
+    if (!coreDocument)
+        return 0;
+
+    String value = String();
+    if (!g_ascii_strcasecmp(attribute, "DocType") && coreDocument->doctype())
+        value = coreDocument->doctype()->name();
+    else if (!g_ascii_strcasecmp(attribute, "Encoding"))
+        value = coreDocument->charset();
+    else if (!g_ascii_strcasecmp(attribute, "URI"))
+        value = coreDocument->documentURI();
+
+    if (!value.isEmpty())
+        return returnString(value);
+
+    return 0;
+}
+
+void webkitAccessibleDocumentInterfaceInit(AtkDocumentIface* iface)
+{
+    iface->get_document_attribute_value = webkitAccessibleDocumentGetAttributeValue;
+    iface->get_document_attributes = webkitAccessibleDocumentGetAttributes;
+    iface->get_document_locale = webkitAccessibleDocumentGetLocale;
+}
+
+const gchar* webkitAccessibleDocumentGetAttributeValue(AtkDocument* document, const gchar* attribute)
+{
+    return documentAttributeValue(document, attribute);
+}
+
+AtkAttributeSet* webkitAccessibleDocumentGetAttributes(AtkDocument* document)
+{
+    AtkAttributeSet* attributeSet = 0;
+    const gchar* attributes[] = { "DocType", "Encoding", "URI" };
+
+    for (unsigned i = 0; i < G_N_ELEMENTS(attributes); i++) {
+        const gchar* value = documentAttributeValue(document, attributes[i]);
+        if (value)
+            attributeSet = addToAtkAttributeSet(attributeSet, attributes[i], value);
+    }
+
+    return attributeSet;
+}
+
+const gchar* webkitAccessibleDocumentGetLocale(AtkDocument* document)
+{
+    // TODO: Should we fall back on lang xml:lang when the following comes up empty?
+    String language = core(document)->language();
+    if (!language.isEmpty())
+        return returnString(language);
+
+    return 0;
+}

Copied: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.h (from rev 105720, trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h) (0 => 105721)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.h	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceDocument.h	2012-01-24 11:40:44 UTC (rev 105721)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 WebKitAccessibleInterfaceDocument_h
+#define WebKitAccessibleInterfaceDocument_h
+
+#include <atk/atk.h>
+
+void webkitAccessibleDocumentInterfaceInit(AtkDocumentIface*);
+const gchar* webkitAccessibleDocumentGetAttributeValue(AtkDocument*, const gchar*);
+AtkAttributeSet* webkitAccessibleDocumentGetAttributes(AtkDocument*);
+const gchar* webkitAccessibleDocumentGetLocale(AtkDocument*);
+
+#endif // WebKitAccessibleInterfaceDocument_h

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp (105720 => 105721)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp	2012-01-24 11:29:01 UTC (rev 105720)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp	2012-01-24 11:40:44 UTC (rev 105721)
@@ -40,6 +40,15 @@
 
 using namespace WebCore;
 
+AtkAttributeSet* addToAtkAttributeSet(AtkAttributeSet* attributeSet, const char* name, const char* value)
+{
+    AtkAttribute* attribute = static_cast<AtkAttribute*>(g_malloc(sizeof(AtkAttribute)));
+    attribute->name = g_strdup(name);
+    attribute->value = g_strdup(value);
+    attributeSet = g_slist_prepend(attributeSet, attribute);
+    return attributeSet;
+}
+
 void contentsRelativeToAtkCoordinateType(AccessibilityObject* coreObject, AtkCoordType coordType, IntRect rect, gint* x, gint* y, gint* width, gint* height)
 {
     FrameView* frameView = coreObject->documentFrameView();

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h (105720 => 105721)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h	2012-01-24 11:29:01 UTC (rev 105720)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h	2012-01-24 11:40:44 UTC (rev 105721)
@@ -30,6 +30,8 @@
 class IntRect;
 }
 
+AtkAttributeSet* addToAtkAttributeSet(AtkAttributeSet*, const char* name, const char* value);
+
 void contentsRelativeToAtkCoordinateType(WebCore::AccessibilityObject*, AtkCoordType, WebCore::IntRect, gint* x, gint* y, gint* width = 0, gint* height = 0);
 
 const char* returnString(const String&);

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (105720 => 105721)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-01-24 11:29:01 UTC (rev 105720)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-01-24 11:40:44 UTC (rev 105721)
@@ -65,6 +65,7 @@
 #include "WebKitAccessibleHyperlink.h"
 #include "WebKitAccessibleInterfaceAction.h"
 #include "WebKitAccessibleInterfaceComponent.h"
+#include "WebKitAccessibleInterfaceDocument.h"
 #include "WebKitAccessibleUtil.h"
 #include "htmlediting.h"
 #include "visible_units.h"
@@ -141,11 +142,6 @@
     return core(ATK_OBJECT(hypertext));
 }
 
-static AccessibilityObject* core(AtkDocument* document)
-{
-    return core(ATK_OBJECT(document));
-}
-
 static AccessibilityObject* core(AtkValue* value)
 {
     return core(ATK_OBJECT(value));
@@ -467,20 +463,10 @@
     return -1;
 }
 
-static AtkAttributeSet* addAttributeToSet(AtkAttributeSet* attributeSet, const char* name, const char* value)
-{
-    AtkAttribute* attribute = static_cast<AtkAttribute*>(g_malloc(sizeof(AtkAttribute)));
-    attribute->name = g_strdup(name);
-    attribute->value = g_strdup(value);
-    attributeSet = g_slist_prepend(attributeSet, attribute);
-
-    return attributeSet;
-}
-
 static AtkAttributeSet* webkit_accessible_get_attributes(AtkObject* object)
 {
     AtkAttributeSet* attributeSet = 0;
-    attributeSet = addAttributeToSet(attributeSet, "toolkit", "WebKitGtk");
+    attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WebKitGtk");
 
     AccessibilityObject* coreObject = core(object);
     if (!coreObject)
@@ -489,13 +475,13 @@
     int headingLevel = coreObject->headingLevel();
     if (headingLevel) {
         String value = String::number(headingLevel);
-        attributeSet = addAttributeToSet(attributeSet, "level", value.utf8().data());
+        attributeSet = addToAtkAttributeSet(attributeSet, "level", value.utf8().data());
     }
 
     // Set the 'layout-guess' attribute to help Assistive
     // Technologies know when an exposed table is not data table.
     if (coreObject->isAccessibilityTable() && !coreObject->isDataTable())
-        attributeSet = addAttributeToSet(attributeSet, "layout-guess", "true");
+        attributeSet = addToAtkAttributeSet(attributeSet, "layout-guess", "true");
 
     return attributeSet;
 }
@@ -1330,20 +1316,20 @@
 
     AtkAttributeSet* result = 0;
     GOwnPtr<gchar> buffer(g_strdup_printf("%i", style->fontSize()));
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_SIZE), buffer.get());
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_SIZE), buffer.get());
 
     Color bgColor = style->visitedDependentColor(CSSPropertyBackgroundColor);
     if (bgColor.isValid()) {
         buffer.set(g_strdup_printf("%i,%i,%i",
                                    bgColor.red(), bgColor.green(), bgColor.blue()));
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_BG_COLOR), buffer.get());
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_BG_COLOR), buffer.get());
     }
 
     Color fgColor = style->visitedDependentColor(CSSPropertyColor);
     if (fgColor.isValid()) {
         buffer.set(g_strdup_printf("%i,%i,%i",
                                    fgColor.red(), fgColor.green(), fgColor.blue()));
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FG_COLOR), buffer.get());
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FG_COLOR), buffer.get());
     }
 
     int baselinePosition;
@@ -1365,20 +1351,20 @@
 
     if (includeRise) {
         buffer.set(g_strdup_printf("%i", baselinePosition));
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_RISE), buffer.get());
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_RISE), buffer.get());
     }
 
     if (!style->textIndent().isUndefined()) {
         int indentation = style->textIndent().calcValue(object->size().width());
         buffer.set(g_strdup_printf("%i", indentation));
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
     }
 
     String fontFamilyName = style->font().family().family().string();
     if (fontFamilyName.left(8) == "-webkit-")
         fontFamilyName = fontFamilyName.substring(8);
 
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FAMILY_NAME), fontFamilyName.utf8().data());
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FAMILY_NAME), fontFamilyName.utf8().data());
 
     int fontWeight = -1;
     switch (style->font().weight()) {
@@ -1411,7 +1397,7 @@
     }
     if (fontWeight > 0) {
         buffer.set(g_strdup_printf("%i", fontWeight));
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_WEIGHT), buffer.get());
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_WEIGHT), buffer.get());
     }
 
     switch (style->textAlign()) {
@@ -1421,29 +1407,29 @@
         break;
     case LEFT:
     case WEBKIT_LEFT:
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "left");
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "left");
         break;
     case RIGHT:
     case WEBKIT_RIGHT:
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "right");
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "right");
         break;
     case CENTER:
     case WEBKIT_CENTER:
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "center");
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "center");
         break;
     case JUSTIFY:
-        result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "fill");
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "fill");
     }
 
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_UNDERLINE), (style->textDecoration() & UNDERLINE) ? "single" : "none");
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_UNDERLINE), (style->textDecoration() & UNDERLINE) ? "single" : "none");
 
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->font().italic() ? "italic" : "normal");
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->font().italic() ? "italic" : "normal");
 
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STRIKETHROUGH), (style->textDecoration() & LINE_THROUGH) ? "true" : "false");
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STRIKETHROUGH), (style->textDecoration() & LINE_THROUGH) ? "true" : "false");
 
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INVISIBLE), (style->visibility() == HIDDEN) ? "true" : "false");
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INVISIBLE), (style->visibility() == HIDDEN) ? "true" : "false");
 
-    result = addAttributeToSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_EDITABLE), object->isReadOnly() ? "false" : "true");
+    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_EDITABLE), object->isReadOnly() ? "false" : "true");
 
     return result;
 }
@@ -2249,63 +2235,6 @@
     iface->get_hyperlink = webkitAccessibleHyperlinkImplGetHyperlink;
 }
 
-static const gchar* documentAttributeValue(AtkDocument* document, const gchar* attribute)
-{
-    Document* coreDocument = core(document)->document();
-    if (!coreDocument)
-        return 0;
-
-    String value = String();
-    if (!g_ascii_strcasecmp(attribute, "DocType") && coreDocument->doctype())
-        value = coreDocument->doctype()->name();
-    else if (!g_ascii_strcasecmp(attribute, "Encoding"))
-        value = coreDocument->charset();
-    else if (!g_ascii_strcasecmp(attribute, "URI"))
-        value = coreDocument->documentURI();
-    if (!value.isEmpty())
-        return returnString(value);
-
-    return 0;
-}
-
-static const gchar* webkit_accessible_document_get_attribute_value(AtkDocument* document, const gchar* attribute)
-{
-    return documentAttributeValue(document, attribute);
-}
-
-static AtkAttributeSet* webkit_accessible_document_get_attributes(AtkDocument* document)
-{
-    AtkAttributeSet* attributeSet = 0;
-    const gchar* attributes[] = { "DocType", "Encoding", "URI" };
-
-    for (unsigned i = 0; i < G_N_ELEMENTS(attributes); i++) {
-        const gchar* value = documentAttributeValue(document, attributes[i]);
-        if (value)
-            attributeSet = addAttributeToSet(attributeSet, attributes[i], value);
-    }
-
-    return attributeSet;
-}
-
-static const gchar* webkit_accessible_document_get_locale(AtkDocument* document)
-{
-
-    // TODO: Should we fall back on lang xml:lang when the following comes up empty?
-    String language = core(document)->language();
-    if (!language.isEmpty())
-        return returnString(language);
-
-    return 0;
-}
-
-static void atk_document_interface_init(AtkDocumentIface* iface)
-{
-    iface->get_document_attribute_value = webkit_accessible_document_get_attribute_value;
-    iface->get_document_attributes = webkit_accessible_document_get_attributes;
-    iface->get_document_locale = webkit_accessible_document_get_locale;
-}
-
-
 static void webkitAccessibleValueGetCurrentValue(AtkValue* value, GValue* gValue)
 {
     memset(gValue,  0, sizeof(GValue));
@@ -2379,8 +2308,7 @@
      (GInterfaceFinalizeFunc) 0, 0},
     {(GInterfaceInitFunc)atkHyperlinkImplInterfaceInit,
      (GInterfaceFinalizeFunc) 0, 0},
-    {(GInterfaceInitFunc)atk_document_interface_init,
-     (GInterfaceFinalizeFunc) 0, 0},
+    {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleDocumentInterfaceInit), 0, 0},
     {(GInterfaceInitFunc)atkValueInterfaceInit,
      (GInterfaceFinalizeFunc) 0, 0}
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to