Title: [105726] trunk/Source/WebCore
Revision
105726
Author
[email protected]
Date
2012-01-24 04:04:16 -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 AtkImage interface,
containing the related code from WebKitAccessibleWrapperAtk.cpp.

* accessibility/gtk/WebKitAccessibleInterfaceImage.cpp: Added.
(core):
(webkitAccessibleImageInterfaceInit):
(webkitAccessibleImageGetImagePosition):
(webkitAccessibleImageGetImageDescription):
(webkitAccessibleImageGetImageSize):
* accessibility/gtk/WebKitAccessibleInterfaceImage.h: Added.
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove code
related to the implementation of the AtkImage interface.

Add new files to build files.

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

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105725 => 105726)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 11:58:52 UTC (rev 105725)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 12:04:16 UTC (rev 105726)
@@ -5,6 +5,31 @@
 
         Reviewed by Martin Robinson.
 
+        New files for the implementation of the AtkImage interface,
+        containing the related code from WebKitAccessibleWrapperAtk.cpp.
+
+        * accessibility/gtk/WebKitAccessibleInterfaceImage.cpp: Added.
+        (core):
+        (webkitAccessibleImageInterfaceInit):
+        (webkitAccessibleImageGetImagePosition):
+        (webkitAccessibleImageGetImageDescription):
+        (webkitAccessibleImageGetImageSize):
+        * accessibility/gtk/WebKitAccessibleInterfaceImage.h: Added.
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove code
+        related to the implementation of the AtkImage interface.
+
+        Add new files to build files.
+
+        * GNUmakefile.list.am: Add WebKitAccessibleInterfaceImage.[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 AtkHypertext interface,
         containing the related code from WebKitAccessibleWrapperAtk.cpp.
 

Modified: trunk/Source/WebCore/GNUmakefile.list.am (105725 => 105726)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-01-24 11:58:52 UTC (rev 105725)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-01-24 12:04:16 UTC (rev 105726)
@@ -4433,6 +4433,8 @@
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceHyperlinkImpl.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceHypertext.cpp \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceHypertext.h \
+	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp \
+	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.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 (105725 => 105726)


--- trunk/Source/WebCore/WebCore.gypi	2012-01-24 11:58:52 UTC (rev 105725)
+++ trunk/Source/WebCore/WebCore.gypi	2012-01-24 12:04:16 UTC (rev 105726)
@@ -1357,6 +1357,8 @@
             'accessibility/gtk/WebKitAccessibleInterfaceHyperlinkImpl.h',
             'accessibility/gtk/WebKitAccessibleInterfaceHypertext.cpp',
             'accessibility/gtk/WebKitAccessibleInterfaceHypertext.h',
+            'accessibility/gtk/WebKitAccessibleInterfaceImage.cpp',
+            'accessibility/gtk/WebKitAccessibleInterfaceImage.h',
             'accessibility/gtk/WebKitAccessibleUtil.cpp',
             'accessibility/gtk/WebKitAccessibleUtil.h',
             'accessibility/gtk/WebKitAccessibleWrapperAtk.cpp',

Added: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp (0 => 105726)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp	2012-01-24 12:04:16 UTC (rev 105726)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
+ * Copyright (C) 2009, 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 "WebKitAccessibleInterfaceImage.h"
+
+#include "AccessibilityObject.h"
+#include "IntRect.h"
+#include "WebKitAccessibleUtil.h"
+#include "WebKitAccessibleWrapperAtk.h"
+
+using namespace WebCore;
+
+static AccessibilityObject* core(AtkImage* image)
+{
+    if (!WEBKIT_IS_ACCESSIBLE(image))
+        return 0;
+
+    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(image));
+}
+
+void webkitAccessibleImageInterfaceInit(AtkImageIface* iface)
+{
+    iface->get_image_position = webkitAccessibleImageGetImagePosition;
+    iface->get_image_description = webkitAccessibleImageGetImageDescription;
+    iface->get_image_size = webkitAccessibleImageGetImageSize;
+}
+
+void webkitAccessibleImageGetImagePosition(AtkImage* image, gint* x, gint* y, AtkCoordType coordType)
+{
+    IntRect rect = core(image)->elementRect();
+    contentsRelativeToAtkCoordinateType(core(image), coordType, rect, x, y);
+}
+
+const gchar* webkitAccessibleImageGetImageDescription(AtkImage* image)
+{
+    return returnString(core(image)->accessibilityDescription());
+}
+
+void webkitAccessibleImageGetImageSize(AtkImage* image, gint* width, gint* height)
+{
+    IntSize size = core(image)->size();
+
+    if (width)
+        *width = size.width();
+    if (height)
+        *height = size.height();
+}

Added: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.h (0 => 105726)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.h	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.h	2012-01-24 12:04:16 UTC (rev 105726)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
+ * Copyright (C) 2009, 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 WebKitAccessibleInterfaceImage_h
+#define WebKitAccessibleInterfaceImage_h
+
+#include <atk/atk.h>
+
+void webkitAccessibleImageInterfaceInit(AtkImageIface*);
+void webkitAccessibleImageGetImagePosition(AtkImage*, gint* x, gint* y, AtkCoordType);
+const gchar* webkitAccessibleImageGetImageDescription(AtkImage*);
+void webkitAccessibleImageGetImageSize(AtkImage*, gint* width, gint* height);
+
+#endif // WebKitAccessibleInterfaceImage_h

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (105725 => 105726)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-01-24 11:58:52 UTC (rev 105725)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-01-24 12:04:16 UTC (rev 105726)
@@ -69,6 +69,7 @@
 #include "WebKitAccessibleInterfaceEditableText.h"
 #include "WebKitAccessibleInterfaceHyperlinkImpl.h"
 #include "WebKitAccessibleInterfaceHypertext.h"
+#include "WebKitAccessibleInterfaceImage.h"
 #include "WebKitAccessibleUtil.h"
 #include "htmlediting.h"
 #include "visible_units.h"
@@ -123,11 +124,6 @@
     return core(ATK_OBJECT(text));
 }
 
-static AccessibilityObject* core(AtkImage* image)
-{
-    return core(ATK_OBJECT(image));
-}
-
 static AccessibilityObject* core(AtkTable* table)
 {
     return core(ATK_OBJECT(table));
@@ -1835,36 +1831,6 @@
     iface->set_caret_offset = webkit_accessible_text_set_caret_offset;
 }
 
-// Image
-
-static void webkit_accessible_image_get_image_position(AtkImage* image, gint* x, gint* y, AtkCoordType coordType)
-{
-    IntRect rect = core(image)->elementRect();
-    contentsRelativeToAtkCoordinateType(core(image), coordType, rect, x, y);
-}
-
-static const gchar* webkit_accessible_image_get_image_description(AtkImage* image)
-{
-    return returnString(core(image)->accessibilityDescription());
-}
-
-static void webkit_accessible_image_get_image_size(AtkImage* image, gint* width, gint* height)
-{
-    IntSize size = core(image)->size();
-
-    if (width)
-        *width = size.width();
-    if (height)
-        *height = size.height();
-}
-
-static void atk_image_interface_init(AtkImageIface* iface)
-{
-    iface->get_image_position = webkit_accessible_image_get_image_position;
-    iface->get_image_description = webkit_accessible_image_get_image_description;
-    iface->get_image_size = webkit_accessible_image_get_image_size;
-}
-
 // Table
 
 static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
@@ -2126,8 +2092,7 @@
     {(GInterfaceInitFunc)atk_text_interface_init,
      (GInterfaceFinalizeFunc) 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleComponentInterfaceInit), 0, 0},
-    {(GInterfaceInitFunc)atk_image_interface_init,
-     (GInterfaceFinalizeFunc) 0, 0},
+    {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleImageInterfaceInit), 0, 0},
     {(GInterfaceInitFunc)atk_table_interface_init,
      (GInterfaceFinalizeFunc) 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleHypertextInterfaceInit), 0, 0},
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to