Changeset 105716 in webkit
- Timestamp:
- Jan 24, 2012 3:03:51 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r105714 r105716 1 2012-01-24 Mario Sanchez Prada <msanchez@igalia.com> 2 3 [GTK] Refactor GTK's accessibilitity code to be more modular 4 https://bugs.webkit.org/show_bug.cgi?id=76783 5 6 Reviewed by Martin Robinson. 7 8 New files for the implementation of the AtkComponent interface, 9 containing the related code from WebKitAccessibleWrapperAtk.cpp. 10 11 * accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp: Added. 12 (core): 13 (atkToContents): 14 (webkitAccessibleComponentInterfaceInit): 15 (webkitAccessibleComponentRefAccessibleAtPoint): 16 (webkitAccessibleComponentGetExtents): 17 (webkitAccessibleComponentGrabFocus): 18 * accessibility/gtk/WebKitAccessibleInterfaceComponent.h: Added. 19 20 Move common function contentsToAtk() out from the wrapper to the 21 utility file, used from WebKitAccessibleInterfaceComponent.cpp. 22 23 * accessibility/gtk/WebKitAccessibleUtil.cpp: 24 (contentsRelativeToAtkCoordinateType): Taken from WebKitAccessibleWrapperAtk.cpp. 25 * accessibility/gtk/WebKitAccessibleUtil.h: 26 * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove local 27 implementation of contentsToAtk, as well as all the code related 28 to the implementation of the AtkComponent interface. 29 30 Add new files to build files. 31 32 * GNUmakefile.list.am: Add WebKitAccessibleInterfaceComponent.[h|cpp]. 33 * WebCore.gypi: Ditto. 34 1 35 2012-01-24 Kentaro Hara <haraken@chromium.org> 2 36 -
trunk/Source/WebCore/GNUmakefile.list.am
r105648 r105716 4424 4424 Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceAction.cpp \ 4425 4425 Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceAction.h \ 4426 Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp \ 4427 Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceComponent.h \ 4426 4428 Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp \ 4427 4429 Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h \ -
trunk/Source/WebCore/WebCore.gypi
r105705 r105716 1348 1348 'accessibility/gtk/WebKitAccessibleInterfaceAction.cpp', 1349 1349 'accessibility/gtk/WebKitAccessibleInterfaceAction.h', 1350 'accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp', 1351 'accessibility/gtk/WebKitAccessibleInterfaceComponent.h', 1350 1352 'accessibility/gtk/WebKitAccessibleUtil.cpp', 1351 1353 'accessibility/gtk/WebKitAccessibleUtil.h', -
trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceComponent.h
r105715 r105716 2 2 * Copyright (C) 2008 Nuanti Ltd. 3 3 * Copyright (C) 2009 Jan Alonzo 4 * Copyright (C) 2009, 201 0, 2012 Igalia S.L.4 * Copyright (C) 2009, 2012 Igalia S.L. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 20 20 */ 21 21 22 #ifndef WebKitAccessible Util_h23 #define WebKitAccessible Util_h22 #ifndef WebKitAccessibleInterfaceComponent_h 23 #define WebKitAccessibleInterfaceComponent_h 24 24 25 #include < wtf/text/WTFString.h>25 #include <atk/atk.h> 26 26 27 // Returns a const char* pointing to a statically allocated string. 28 const char* returnString(const String&); 27 void webkitAccessibleComponentInterfaceInit(AtkComponentIface*); 28 AtkObject* webkitAccessibleComponentRefAccessibleAtPoint(AtkComponent*, gint x, gint y, AtkCoordType); 29 void webkitAccessibleComponentGetExtents(AtkComponent*, gint* x, gint* y, gint* width, gint* height, AtkCoordType); 30 gboolean webkitAccessibleComponentGrabFocus(AtkComponent*); 29 31 30 #endif // WebKitAccessible Util_h32 #endif // WebKitAccessibleInterfaceComponent_h -
trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp
r105610 r105716 32 32 #include "WebKitAccessibleUtil.h" 33 33 34 #include "AccessibilityObject.h" 35 #include "FrameView.h" 36 #include "IntRect.h" 37 34 38 #include <wtf/text/AtomicString.h> 35 39 #include <wtf/text/CString.h> 40 41 using namespace WebCore; 42 43 void contentsRelativeToAtkCoordinateType(AccessibilityObject* coreObject, AtkCoordType coordType, IntRect rect, gint* x, gint* y, gint* width, gint* height) 44 { 45 FrameView* frameView = coreObject->documentFrameView(); 46 47 if (frameView) { 48 switch (coordType) { 49 case ATK_XY_WINDOW: 50 rect = frameView->contentsToWindow(rect); 51 break; 52 case ATK_XY_SCREEN: 53 rect = frameView->contentsToScreen(rect); 54 break; 55 } 56 } 57 58 if (x) 59 *x = rect.x(); 60 if (y) 61 *y = rect.y(); 62 if (width) 63 *width = rect.width(); 64 if (height) 65 *height = rect.height(); 66 } 36 67 37 68 // Used to provide const char* returns. -
trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h
r105610 r105716 23 23 #define WebKitAccessibleUtil_h 24 24 25 #include <atk/atk.h> 25 26 #include <wtf/text/WTFString.h> 26 27 27 // Returns a const char* pointing to a statically allocated string. 28 namespace WebCore { 29 class AccessibilityObject; 30 class IntRect; 31 } 32 33 void contentsRelativeToAtkCoordinateType(WebCore::AccessibilityObject*, AtkCoordType, WebCore::IntRect, gint* x, gint* y, gint* width = 0, gint* height = 0); 34 28 35 const char* returnString(const String&); 29 36 -
trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
r105618 r105716 65 65 #include "WebKitAccessibleHyperlink.h" 66 66 #include "WebKitAccessibleInterfaceAction.h" 67 #include "WebKitAccessibleInterfaceComponent.h" 67 68 #include "WebKitAccessibleUtil.h" 68 69 #include "htmlediting.h" … … 124 125 { 125 126 return core(ATK_OBJECT(text)); 126 }127 128 static AccessibilityObject* core(AtkComponent* component)129 {130 return core(ATK_OBJECT(component));131 127 } 132 128 … … 1941 1937 } 1942 1938 1943 static void contentsToAtk(AccessibilityObject* coreObject, AtkCoordType coordType, IntRect rect, gint* x, gint* y, gint* width = 0, gint* height = 0)1944 {1945 FrameView* frameView = coreObject->documentFrameView();1946 1947 if (frameView) {1948 switch (coordType) {1949 case ATK_XY_WINDOW:1950 rect = frameView->contentsToWindow(rect);1951 break;1952 case ATK_XY_SCREEN:1953 rect = frameView->contentsToScreen(rect);1954 break;1955 }1956 }1957 1958 if (x)1959 *x = rect.x();1960 if (y)1961 *y = rect.y();1962 if (width)1963 *width = rect.width();1964 if (height)1965 *height = rect.height();1966 }1967 1968 static IntPoint atkToContents(AccessibilityObject* coreObject, AtkCoordType coordType, gint x, gint y)1969 {1970 IntPoint pos(x, y);1971 1972 FrameView* frameView = coreObject->documentFrameView();1973 if (frameView) {1974 switch (coordType) {1975 case ATK_XY_SCREEN:1976 return frameView->screenToContents(pos);1977 case ATK_XY_WINDOW:1978 return frameView->windowToContents(pos);1979 }1980 }1981 1982 return pos;1983 }1984 1985 static AtkObject* webkit_accessible_component_ref_accessible_at_point(AtkComponent* component, gint x, gint y, AtkCoordType coordType)1986 {1987 IntPoint pos = atkToContents(core(component), coordType, x, y);1988 1989 AccessibilityObject* target = core(component)->accessibilityHitTest(pos);1990 if (!target)1991 return 0;1992 g_object_ref(target->wrapper());1993 return target->wrapper();1994 }1995 1996 static void webkit_accessible_component_get_extents(AtkComponent* component, gint* x, gint* y, gint* width, gint* height, AtkCoordType coordType)1997 {1998 IntRect rect = core(component)->elementRect();1999 contentsToAtk(core(component), coordType, rect, x, y, width, height);2000 }2001 2002 static gboolean webkit_accessible_component_grab_focus(AtkComponent* component)2003 {2004 core(component)->setFocused(true);2005 return core(component)->isFocused();2006 }2007 2008 static void atk_component_interface_init(AtkComponentIface* iface)2009 {2010 iface->ref_accessible_at_point = webkit_accessible_component_ref_accessible_at_point;2011 iface->get_extents = webkit_accessible_component_get_extents;2012 iface->grab_focus = webkit_accessible_component_grab_focus;2013 }2014 2015 1939 // Image 2016 1940 … … 2018 1942 { 2019 1943 IntRect rect = core(image)->elementRect(); 2020 contents ToAtk(core(image), coordType, rect, x, y);1944 contentsRelativeToAtkCoordinateType(core(image), coordType, rect, x, y); 2021 1945 } 2022 1946 … … 2447 2371 {(GInterfaceInitFunc)atk_text_interface_init, 2448 2372 (GInterfaceFinalizeFunc) 0, 0}, 2449 {(GInterfaceInitFunc)atk_component_interface_init, 2450 (GInterfaceFinalizeFunc) 0, 0}, 2373 {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleComponentInterfaceInit), 0, 0}, 2451 2374 {(GInterfaceInitFunc)atk_image_interface_init, 2452 2375 (GInterfaceFinalizeFunc) 0, 0},
Note: See TracChangeset
for help on using the changeset viewer.