summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webaccessibility.cc
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 19:52:04 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 19:52:04 +0000
commitbd554c644039736cf4eb3944f63b7a8e87c449d9 (patch)
treec10f024ecd6f3a5665c4eacf6a9c0c81f866a9b1 /webkit/glue/webaccessibility.cc
parent017091110712afd7f2bdba2ab9c97f51d06c87b5 (diff)
downloadchromium_src-bd554c644039736cf4eb3944f63b7a8e87c449d9.zip
chromium_src-bd554c644039736cf4eb3944f63b7a8e87c449d9.tar.gz
chromium_src-bd554c644039736cf4eb3944f63b7a8e87c449d9.tar.bz2
Make the selection start and end attributes of an html input control
accessible, implement IAccessibleText methods to retrieve this info, and post a notification when the cursor moves within a text field. BUG=none TEST=Added new test to renderer_accessibility_browsertest Review URL: http://codereview.chromium.org/3389037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61216 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webaccessibility.cc')
-rw-r--r--webkit/glue/webaccessibility.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/webkit/glue/webaccessibility.cc b/webkit/glue/webaccessibility.cc
index 0d96685..70827c1 100644
--- a/webkit/glue/webaccessibility.cc
+++ b/webkit/glue/webaccessibility.cc
@@ -4,7 +4,9 @@
#include "webkit/glue/webaccessibility.h"
+#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h"
@@ -12,7 +14,9 @@
#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDocumentType.h"
#include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNamedNodeMap.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNode.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
@@ -332,11 +336,24 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src,
element.attributes().attributeItem(i).localName(),
element.attributes().attributeItem(i).value()));
}
+
+ if (element.isFormControlElement()) {
+ WebKit::WebFormControlElement form_element =
+ element.to<WebKit::WebFormControlElement>();
+ if (form_element.formControlType() == ASCIIToUTF16("text")) {
+ WebKit::WebInputElement input_element =
+ form_element.to<WebKit::WebInputElement>();
+ attributes[ATTR_TEXT_SEL_START] = base::IntToString16(
+ input_element.selectionStart());
+ attributes[ATTR_TEXT_SEL_END] = base::IntToString16(
+ input_element.selectionEnd());
+ }
+ }
}
if (role == WebAccessibility::ROLE_DOCUMENT ||
role == WebAccessibility::ROLE_WEB_AREA) {
- WebKit::WebDocument document = src.document();
+ const WebKit::WebDocument& document = src.document();
if (name.empty())
name = document.title();
attributes[ATTR_DOC_TITLE] = document.title();
@@ -346,7 +363,7 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src,
else
attributes[ATTR_DOC_MIMETYPE] = WebKit::WebString("text/html");
- WebKit::WebDocumentType doctype = document.doctype();
+ const WebKit::WebDocumentType& doctype = document.doctype();
if (!doctype.isNull())
attributes[ATTR_DOC_DOCTYPE] = doctype.name();
}