Title: [134094] trunk/Source/WebCore
Revision
134094
Author
[email protected]
Date
2012-11-09 11:47:40 -0800 (Fri, 09 Nov 2012)

Log Message

[GTK] Isolate the GTK/Gail/Pango specific code in accessibility/gtk
https://bugs.webkit.org/show_bug.cgi?id=101727

Reviewed by Chris Fleizach.

Added conditional compilation checks for GTK+ specific
accessibility code, to pave the way for sharing this
implementation with other ports (e.g WebKitEFL).

* accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
(webkitAccessibleTextGetTextAfterOffset): Added conditional
compilation checks, only implementing it in GTK so far.
(webkitAccessibleTextGetTextAtOffset): Ditto.
(webkitAccessibleTextGetTextBeforeOffset): Ditto.
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
(atkParentOfRootObject): Added conditional compilation checks,
only implementing in GTK the part of getting the accessible object
for the root object.
(webkitAccessibleGetParent): Updated comments.
(webkitAccessibleGetNChildren): Ditto.
(webkitAccessibleRefChild): Ditto.
(webkitAccessibleGetIndexInParent): Ditto.
(webkitAccessibleGetAttributes): Only set the 'toolkit' attribute
for GTK. Other ports might be interested in this too.
(setAtkStateSetFromCoreObject): Updated comments.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134093 => 134094)


--- trunk/Source/WebCore/ChangeLog	2012-11-09 19:39:01 UTC (rev 134093)
+++ trunk/Source/WebCore/ChangeLog	2012-11-09 19:47:40 UTC (rev 134094)
@@ -1,3 +1,31 @@
+2012-11-09  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Isolate the GTK/Gail/Pango specific code in accessibility/gtk
+        https://bugs.webkit.org/show_bug.cgi?id=101727
+
+        Reviewed by Chris Fleizach.
+
+        Added conditional compilation checks for GTK+ specific
+        accessibility code, to pave the way for sharing this
+        implementation with other ports (e.g WebKitEFL).
+
+        * accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
+        (webkitAccessibleTextGetTextAfterOffset): Added conditional
+        compilation checks, only implementing it in GTK so far.
+        (webkitAccessibleTextGetTextAtOffset): Ditto.
+        (webkitAccessibleTextGetTextBeforeOffset): Ditto.
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
+        (atkParentOfRootObject): Added conditional compilation checks,
+        only implementing in GTK the part of getting the accessible object
+        for the root object.
+        (webkitAccessibleGetParent): Updated comments.
+        (webkitAccessibleGetNChildren): Ditto.
+        (webkitAccessibleRefChild): Ditto.
+        (webkitAccessibleGetIndexInParent): Ditto.
+        (webkitAccessibleGetAttributes): Only set the 'toolkit' attribute
+        for GTK. Other ports might be interested in this too.
+        (setAtkStateSetFromCoreObject): Updated comments.
+
 2012-11-09  Tommy Widenflycht  <[email protected]>
 
         MediaStream API: Don't trigger any object deletion during RTCPeerConnection::stop

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp (134093 => 134094)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp	2012-11-09 19:39:01 UTC (rev 134093)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp	2012-11-09 19:47:40 UTC (rev 134094)
@@ -47,8 +47,11 @@
 #include "WebKitAccessibleUtil.h"
 #include "WebKitAccessibleWrapperAtk.h"
 #include "htmlediting.h"
+
+#if PLATFORM(GTK)
 #include <libgail-util/gail-util.h>
 #include <pango/pango.h>
+#endif
 
 using namespace WebCore;
 
@@ -156,6 +159,7 @@
 
 static gchar* webkitAccessibleTextGetText(AtkText*, gint startOffset, gint endOffset);
 
+#if PLATFORM(GTK)
 static GailTextUtil* getGailTextUtilForAtk(AtkText* textObject)
 {
     GailTextUtil* gailTextUtil = gail_text_util_new();
@@ -182,6 +186,7 @@
     PangoLayout* layout = gtk_widget_create_pango_layout(static_cast<GtkWidget*>(webView), textForObject(coreObject));
     return layout;
 }
+#endif
 
 static int baselinePositionForRenderObject(RenderObject* renderObject)
 {
@@ -561,17 +566,32 @@
 
 static gchar* webkitAccessibleTextGetTextAfterOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
 {
+#if PLATFORM(GTK)
     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), GAIL_AFTER_OFFSET, boundaryType, offset, startOffset, endOffset);
+#else
+    notImplemented();
+    return 0;
+#endif
 }
 
 static gchar* webkitAccessibleTextGetTextAtOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
 {
+#if PLATFORM(GTK)
     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), GAIL_AT_OFFSET, boundaryType, offset, startOffset, endOffset);
+#else
+    notImplemented();
+    return 0;
+#endif
 }
 
 static gchar* webkitAccessibleTextGetTextBeforeOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
 {
+#if PLATFORM(GTK)
     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), GAIL_BEFORE_OFFSET, boundaryType, offset, startOffset, endOffset);
+#else
+    notImplemented();
+    return 0;
+#endif
 }
 
 static gunichar webkitAccessibleTextGetCharacterAtOffset(AtkText*, gint)

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (134093 => 134094)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-11-09 19:39:01 UTC (rev 134093)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-11-09 19:47:40 UTC (rev 134094)
@@ -59,7 +59,10 @@
 #include "htmlediting.h"
 #include "visible_units.h"
 #include <glib/gprintf.h>
+
+#if PLATFORM(GTK)
 #include <gtk/gtk.h>
+#endif
 
 using namespace WebCore;
 
@@ -232,6 +235,7 @@
         if (!document)
             return 0;
 
+#if PLATFORM(GTK)
         HostWindow* hostWindow = document->view()->hostWindow();
         if (hostWindow) {
             PlatformPageClient scrollView = hostWindow->platformPageClient();
@@ -241,6 +245,7 @@
                     return gtk_widget_get_accessible(scrollViewParent);
             }
         }
+#endif // PLATFORM(GTK)
     }
 
     if (!coreParent)
@@ -269,7 +274,7 @@
     if (!coreParent)
         return 0;
 
-    // GTK doesn't expose table rows to Assistive technologies, but we
+    // We don't expose table rows to Assistive technologies, but we
     // need to have them anyway in the hierarchy from WebCore to
     // properly perform coordinates calculations when requested.
     if (coreParent->isTableRow() && coreObject->isTableCell())
@@ -301,7 +306,7 @@
     AccessibilityObject* coreObject = core(object);
 
     // Tables should be treated in a different way because rows should
-    // be bypassed for GTK when exposing the accessible hierarchy.
+    // be bypassed when exposing the accessible hierarchy.
     if (coreObject->isAccessibilityTable())
         return getNChildrenForTable(coreObject);
 
@@ -341,8 +346,8 @@
     AccessibilityObject* coreObject = core(object);
     AccessibilityObject* coreChild = 0;
 
-    // Tables are special cases in GTK because rows should be
-    // bypassed, but still taking their cells into account.
+    // Tables are special cases because rows should be bypassed, but
+    // still taking their cells into account.
     if (coreObject->isAccessibilityTable())
         coreChild = getChildForTable(coreObject, index);
     else {
@@ -418,7 +423,7 @@
     }
 
     // Need to calculate the index of the cell in the table, as
-    // rows won't be exposed to assistive technologies in GTK.
+    // rows won't be exposed to assistive technologies.
     if (parent && parent->isTableRow() && coreObject->isTableCell())
         return getIndexInParentForCellInRow(coreObject);
 
@@ -429,7 +434,9 @@
 static AtkAttributeSet* webkitAccessibleGetAttributes(AtkObject* object)
 {
     AtkAttributeSet* attributeSet = 0;
+#if PLATFORM(GTK)
     attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WebKitGtk");
+#endif
 
     AccessibilityObject* coreObject = core(object);
     if (!coreObject)
@@ -660,16 +667,16 @@
 
     if (coreObject->canSetSelectedAttribute()) {
         atk_state_set_add_state(stateSet, ATK_STATE_SELECTABLE);
-        // Items in focusable lists in Gtk have both STATE_SELECT{ABLE,ED}
-        // and STATE_FOCUS{ABLE,ED}. We'll fake the latter based on the
-        // former.
+        // Items in focusable lists have both STATE_SELECT{ABLE,ED}
+        // and STATE_FOCUS{ABLE,ED}. We'll fake the latter based on
+        // the former.
         if (isListBoxOption)
             atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE);
     }
 
     if (coreObject->isSelected()) {
         atk_state_set_add_state(stateSet, ATK_STATE_SELECTED);
-        // Items in focusable lists in Gtk have both STATE_SELECT{ABLE,ED}
+        // Items in focusable lists have both STATE_SELECT{ABLE,ED}
         // and STATE_FOCUS{ABLE,ED}. We'll fake the latter based on the
         // former.
         if (isListBoxOption)
@@ -679,7 +686,7 @@
     // FIXME: Group both SHOWING and VISIBLE here for now
     // Not sure how to handle this in WebKit, see bug
     // http://bugzilla.gnome.org/show_bug.cgi?id=509650 for other
-    // issues with SHOWING vs VISIBLE within GTK+
+    // issues with SHOWING vs VISIBLE.
     if (!coreObject->isOffScreen()) {
         atk_state_set_add_state(stateSet, ATK_STATE_SHOWING);
         atk_state_set_add_state(stateSet, ATK_STATE_VISIBLE);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to