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

Side by Side Diff: Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.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) 2011, 2012 Igalia S.L.
5 *
6 * Portions from Mozilla a11y, copyright as follows:
7 *
8 * The Original Code is mozilla.org code.
9 *
10 * The Initial Developer of the Original Code is
11 * Sun Microsystems, Inc.
12 * Portions created by the Initial Developer are Copyright (C) 2002
13 * the Initial Developer. All Rights Reserved.
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Library General Public
17 * License as published by the Free Software Foundation; either
18 * version 2 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Library General Public License for more details.
24 *
25 * You should have received a copy of the GNU Library General Public License
26 * along with this library; see the file COPYING.LIB. If not, write to
27 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 * Boston, MA 02110-1301, USA.
29 */
30
31 #include "config.h"
32 #include "WebKitAccessibleInterfaceEditableText.h"
33
34 #if HAVE(ACCESSIBILITY)
35
36 #include "AccessibilityObject.h"
37 #include "Document.h"
38 #include "Frame.h"
39 #include "NotImplemented.h"
40 #include "WebKitAccessibleWrapperAtk.h"
41
42 using namespace WebCore;
43
44 static AccessibilityObject* core(AtkEditableText* text)
45 {
46 if (!WEBKIT_IS_ACCESSIBLE(text))
47 return 0;
48
49 return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text));
50 }
51
52 static gboolean webkitAccessibleEditableTextSetRunAttributes(AtkEditableText*, A tkAttributeSet*, gint, gint)
53 {
54 notImplemented();
55 return FALSE;
56 }
57
58 static void webkitAccessibleEditableTextSetTextContents(AtkEditableText* text, c onst gchar* string)
59 {
60 // FIXME: string nullcheck?
61 core(text)->setValue(String::fromUTF8(string));
62 }
63
64 static void webkitAccessibleEditableTextInsertText(AtkEditableText* text, const gchar* string, gint length, gint* position)
65 {
66 if (!string)
67 return;
68
69 AccessibilityObject* coreObject = core(text);
70 // FIXME: Not implemented in WebCore
71 // coreObject->setSelectedTextRange(PlainTextRange(*position, 0));
72 // coreObject->setSelectedText(String::fromUTF8(string));
73
74 Document* document = coreObject->document();
75 if (!document || !document->frame())
76 return;
77
78 coreObject->setSelectedVisiblePositionRange(coreObject->visiblePositionRange ForRange(PlainTextRange(*position, 0)));
79 coreObject->setFocused(true);
80 // FIXME: We should set position to the actual inserted text length, which m ay be less than that requested.
81 if (document->frame()->editor()->insertTextWithoutSendingTextEvent(String::f romUTF8(string).substring(0, length), false, 0))
82 *position += length;
83 }
84
85 static void webkitAccessibleEditableTextCopyText(AtkEditableText*, gint, gint)
86 {
87 notImplemented();
88 }
89
90 static void webkitAccessibleEditableTextCutText(AtkEditableText*, gint, gint)
91 {
92 notImplemented();
93 }
94
95 static void webkitAccessibleEditableTextDeleteText(AtkEditableText* text, gint s tartPos, gint endPos)
96 {
97 AccessibilityObject* coreObject = core(text);
98 // FIXME: Not implemented in WebCore
99 // coreObject->setSelectedTextRange(PlainTextRange(startPos, endPos - startP os));
100 // coreObject->setSelectedText(String());
101
102 Document* document = coreObject->document();
103 if (!document || !document->frame())
104 return;
105
106 coreObject->setSelectedVisiblePositionRange(coreObject->visiblePositionRange ForRange(PlainTextRange(startPos, endPos - startPos)));
107 coreObject->setFocused(true);
108 document->frame()->editor()->performDelete();
109 }
110
111 static void webkitAccessibleEditableTextPasteText(AtkEditableText*, gint)
112 {
113 notImplemented();
114 }
115
116 void webkitAccessibleEditableTextInterfaceInit(AtkEditableTextIface* iface)
117 {
118 iface->set_run_attributes = webkitAccessibleEditableTextSetRunAttributes;
119 iface->set_text_contents = webkitAccessibleEditableTextSetTextContents;
120 iface->insert_text = webkitAccessibleEditableTextInsertText;
121 iface->copy_text = webkitAccessibleEditableTextCopyText;
122 iface->cut_text = webkitAccessibleEditableTextCutText;
123 iface->delete_text = webkitAccessibleEditableTextDeleteText;
124 iface->paste_text = webkitAccessibleEditableTextPasteText;
125 }
126
127 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698