1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/shell/renderer/test_runner/web_ax_object_proxy.h" 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/strings/stringprintf.h" 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "gin/handle.h" 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "third_party/WebKit/public/platform/WebPoint.h" 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "third_party/WebKit/public/platform/WebRect.h" 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "third_party/WebKit/public/platform/WebString.h" 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "third_party/WebKit/public/web/WebFrame.h" 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "third_party/WebKit/public/web/WebKit.h" 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace content { 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace { 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Map role value to string, matching Safari/Mac platform implementation to 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// avoid rebaselining layout tests. 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string RoleToString(blink::WebAXRole role) 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles){ 23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string result = "AXRole: AX"; 24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) switch (role) { 25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleAlertDialog: 26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("AlertDialog"); 27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleAlert: 28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Alert"); 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleAnnotation: 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Annotation"); 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleApplication: 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Application"); 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleArticle: 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Article"); 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleBanner: 36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Banner"); 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleBrowser: 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Browser"); 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleBusyIndicator: 40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("BusyIndicator"); 41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleButton: 42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Button"); 43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleCanvas: 44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Canvas"); 45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleCell: 46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Cell"); 47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleCheckBox: 48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("CheckBox"); 49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleColorWell: 50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ColorWell"); 51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleColumnHeader: 52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ColumnHeader"); 53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleColumn: 54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Column"); 55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleComboBox: 56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ComboBox"); 57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleComplementary: 58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Complementary"); 59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleContentInfo: 60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ContentInfo"); 61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDefinition: 62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Definition"); 63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDescriptionListDetail: 64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("DescriptionListDetail"); 65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDescriptionListTerm: 66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("DescriptionListTerm"); 67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDialog: 68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Dialog"); 69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDirectory: 70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Directory"); 71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDisclosureTriangle: 72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("DisclosureTriangle"); 73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDiv: 74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Div"); 75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDocument: 76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Document"); 77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleDrawer: 78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Drawer"); 79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleEditableText: 80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("EditableText"); 811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci case blink::WebAXRoleEmbeddedObject: 821320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return result.append("EmbeddedObject"); 831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci case blink::WebAXRoleFigcaption: 841320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return result.append("Figcaption"); 851320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci case blink::WebAXRoleFigure: 861320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return result.append("Figure"); 87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleFooter: 88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Footer"); 89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleForm: 90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Form"); 91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleGrid: 92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Grid"); 93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleGroup: 94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Group"); 95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleGrowArea: 96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("GrowArea"); 97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleHeading: 98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Heading"); 99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleHelpTag: 100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("HelpTag"); 101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleHorizontalRule: 102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("HorizontalRule"); 103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleIgnored: 104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Ignored"); 105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleImageMapLink: 106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ImageMapLink"); 107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleImageMap: 108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ImageMap"); 109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleImage: 110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Image"); 111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleIncrementor: 112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Incrementor"); 113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleInlineTextBox: 114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("InlineTextBox"); 115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleLabel: 116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Label"); 117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleLegend: 118a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Legend"); 119a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleLink: 120a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Link"); 121a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleListBoxOption: 122a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ListBoxOption"); 123a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleListBox: 124a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ListBox"); 125a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleListItem: 126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ListItem"); 127a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleListMarker: 128a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ListMarker"); 129a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleList: 130a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("List"); 131a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleLog: 132a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Log"); 133a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMain: 134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Main"); 135a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMarquee: 136a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Marquee"); 137a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMathElement: 138a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("MathElement"); 139a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMath: 140a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Math"); 141a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMatte: 142a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Matte"); 143a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMenuBar: 144a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("MenuBar"); 145a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMenuButton: 146a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("MenuButton"); 147a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMenuItem: 148a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("MenuItem"); 149a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMenuListOption: 150a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("MenuListOption"); 151a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMenuListPopup: 152a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("MenuListPopup"); 153a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleMenu: 154a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Menu"); 155a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleNavigation: 156a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Navigation"); 1571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci case blink::WebAXRoleNone: 1581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return result.append("None"); 159a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleNote: 160a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Note"); 161a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleOutline: 162a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Outline"); 163a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleParagraph: 164a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Paragraph"); 165a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRolePopUpButton: 166a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("PopUpButton"); 167a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRolePresentational: 168a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Presentational"); 169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleProgressIndicator: 170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ProgressIndicator"); 171a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRadioButton: 172a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("RadioButton"); 173a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRadioGroup: 174a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("RadioGroup"); 175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRegion: 176a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Region"); 177a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRootWebArea: 178a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("RootWebArea"); 179a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRowHeader: 180a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("RowHeader"); 181a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRow: 182a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Row"); 183a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRulerMarker: 184a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("RulerMarker"); 185a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleRuler: 186a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Ruler"); 187a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSVGRoot: 188a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SVGRoot"); 189a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleScrollArea: 190a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ScrollArea"); 191a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleScrollBar: 192a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ScrollBar"); 193a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSeamlessWebArea: 194a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SeamlessWebArea"); 195a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSearch: 196a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Search"); 197a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSheet: 198a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Sheet"); 199a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSlider: 200a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Slider"); 201a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSliderThumb: 202a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SliderThumb"); 203a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSpinButtonPart: 204a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SpinButtonPart"); 205a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSpinButton: 206a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SpinButton"); 207a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSplitGroup: 208a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SplitGroup"); 209a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSplitter: 210a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Splitter"); 211a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleStaticText: 212a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("StaticText"); 213a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleStatus: 214a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Status"); 215a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleSystemWide: 216a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("SystemWide"); 217a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTabGroup: 218a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TabGroup"); 219a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTabList: 220a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TabList"); 221a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTabPanel: 222a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TabPanel"); 223a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTab: 224a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Tab"); 225a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTableHeaderContainer: 226a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TableHeaderContainer"); 227a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTable: 228a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Table"); 229a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTextArea: 230a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TextArea"); 231a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTextField: 232a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TextField"); 233a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTimer: 234a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Timer"); 235a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleToggleButton: 236a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ToggleButton"); 237a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleToolbar: 238a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Toolbar"); 239a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTreeGrid: 240a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TreeGrid"); 241a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTreeItem: 242a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("TreeItem"); 243a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleTree: 244a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Tree"); 245a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleUnknown: 246a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Unknown"); 247a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleUserInterfaceTooltip: 248a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("UserInterfaceTooltip"); 249a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleValueIndicator: 250a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("ValueIndicator"); 251a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleWebArea: 252a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("WebArea"); 253a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXRoleWindow: 254a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Window"); 255a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) default: 256a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.append("Unknown"); 257a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 258a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 259a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 260a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetDescription(const blink::WebAXObject& object) { 261a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string description = object.accessibilityDescription().utf8(); 262a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return description.insert(0, "AXDescription: "); 263a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 264a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 265a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetHelpText(const blink::WebAXObject& object) { 266a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string help_text = object.helpText().utf8(); 267a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return help_text.insert(0, "AXHelp: "); 268a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 269a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 270a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetStringValue(const blink::WebAXObject& object) { 271a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string value; 272a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (object.role() == blink::WebAXRoleColorWell) { 273a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int r, g, b; 274a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) object.colorValue(r, g, b); 275a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) value = base::StringPrintf("rgb %7.5f %7.5f %7.5f 1", 276a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) r / 255., g / 255., b / 255.); 277a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } else { 278a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) value = object.stringValue().utf8(); 279a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 280a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return value.insert(0, "AXValue: "); 281a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 282a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 283a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetRole(const blink::WebAXObject& object) { 284a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string role_string = RoleToString(object.role()); 285a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 286a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Special-case canvas with fallback content because Chromium wants to treat 287a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // this as essentially a separate role that it can map differently depending 288a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // on the platform. 289a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (object.role() == blink::WebAXRoleCanvas && 290a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) object.canvasHasFallbackContent()) { 291a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) role_string += "WithFallbackContent"; 292a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 293a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 294a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return role_string; 295a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 296a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 297a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetTitle(const blink::WebAXObject& object) { 298a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string title = object.title().utf8(); 299a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return title.insert(0, "AXTitle: "); 300a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 301a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 302a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetOrientation(const blink::WebAXObject& object) { 303a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (object.isVertical()) 304a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return "AXOrientation: AXVerticalOrientation"; 305a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 306a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return "AXOrientation: AXHorizontalOrientation"; 307a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 308a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 309a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetValueDescription(const blink::WebAXObject& object) { 310a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string value_description = object.valueDescription().utf8(); 311a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return value_description.insert(0, "AXValueDescription: "); 312a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 313a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 314a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string GetAttributes(const blink::WebAXObject& object) { 315a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // FIXME: Concatenate all attributes of the AXObject. 316a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string attributes(GetTitle(object)); 317a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) attributes.append("\n"); 318a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) attributes.append(GetRole(object)); 319a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) attributes.append("\n"); 320a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) attributes.append(GetDescription(object)); 321a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return attributes; 322a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 323a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 324a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)blink::WebRect BoundsForCharacter(const blink::WebAXObject& object, 325a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int characterIndex) { 326a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK_EQ(object.role(), blink::WebAXRoleStaticText); 327a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int end = 0; 328a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) for (unsigned i = 0; i < object.childCount(); i++) { 329a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebAXObject inline_text_box = object.childAt(i); 330a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK_EQ(inline_text_box.role(), blink::WebAXRoleInlineTextBox); 331a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int start = end; 332a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) end += inline_text_box.stringValue().length(); 333effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch if (characterIndex < start || characterIndex >= end) 334a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) continue; 335a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebRect inline_text_box_rect = inline_text_box.boundingBoxRect(); 336a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int localIndex = characterIndex - start; 337a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebVector<int> character_offsets; 338a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box.characterOffsets(character_offsets); 339a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK(character_offsets.size() > 0 && 340a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets.size() == inline_text_box.stringValue().length()); 341a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) switch (inline_text_box.textDirection()) { 342a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXTextDirectionLR: { 343a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (localIndex) { 344a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int left = inline_text_box_rect.x + character_offsets[localIndex - 1]; 345a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int width = character_offsets[localIndex] - 346a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets[localIndex - 1]; 347a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(left, inline_text_box_rect.y, 348a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) width, inline_text_box_rect.height); 349a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 350a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect( 351a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box_rect.x, inline_text_box_rect.y, 352a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets[0], inline_text_box_rect.height); 353a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 354a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXTextDirectionRL: { 355a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int right = inline_text_box_rect.x + inline_text_box_rect.width; 356a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 357a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (localIndex) { 358a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int left = right - character_offsets[localIndex]; 359a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int width = character_offsets[localIndex] - 360a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets[localIndex - 1]; 361a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(left, inline_text_box_rect.y, 362a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) width, inline_text_box_rect.height); 363a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 364a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int left = right - character_offsets[0]; 365a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect( 366a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) left, inline_text_box_rect.y, 367a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets[0], inline_text_box_rect.height); 368a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 369a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXTextDirectionTB: { 370a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (localIndex) { 371a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int top = inline_text_box_rect.y + character_offsets[localIndex - 1]; 372a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int height = character_offsets[localIndex] - 373a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets[localIndex - 1]; 374a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(inline_text_box_rect.x, top, 375a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box_rect.width, height); 376a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 377a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(inline_text_box_rect.x, inline_text_box_rect.y, 378a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box_rect.width, character_offsets[0]); 379a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 380a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) case blink::WebAXTextDirectionBT: { 381a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int bottom = inline_text_box_rect.y + inline_text_box_rect.height; 382a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 383a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (localIndex) { 384a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int top = bottom - character_offsets[localIndex]; 385a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int height = character_offsets[localIndex] - 386a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) character_offsets[localIndex - 1]; 387a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(inline_text_box_rect.x, top, 388a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box_rect.width, height); 389a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 390a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int top = bottom - character_offsets[0]; 391a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(inline_text_box_rect.x, top, 392a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box_rect.width, character_offsets[0]); 393a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 394a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 395a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 396a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 397a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK(false); 398a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return blink::WebRect(); 399a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 400a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 401a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void GetBoundariesForOneWord(const blink::WebAXObject& object, 402a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int character_index, 403a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int& word_start, 404a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int& word_end) { 405a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int end = 0; 406a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) for (unsigned i = 0; i < object.childCount(); i++) { 407a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebAXObject inline_text_box = object.childAt(i); 408a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK_EQ(inline_text_box.role(), blink::WebAXRoleInlineTextBox); 409a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int start = end; 410a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) end += inline_text_box.stringValue().length(); 411a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (end <= character_index) 412a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) continue; 413a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int localIndex = character_index - start; 414a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 415a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebVector<int> starts; 416a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebVector<int> ends; 417a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) inline_text_box.wordBoundaries(starts, ends); 418a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) size_t word_count = starts.size(); 419a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK_EQ(ends.size(), word_count); 420a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 421a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // If there are no words, use the InlineTextBox boundaries. 422a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (!word_count) { 423a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_start = start; 424a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_end = end; 425a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return; 426a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 427a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 428a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Look for a character within any word other than the last. 429a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) for (size_t j = 0; j < word_count - 1; j++) { 430a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (localIndex <= ends[j]) { 431a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_start = start + starts[j]; 432a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_end = start + ends[j]; 433a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return; 434a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 435a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 436a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 437a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Return the last word by default. 438a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_start = start + starts[word_count - 1]; 439a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_end = start + ends[word_count - 1]; 440a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return; 441a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 442a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 443a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 444a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Collects attributes into a string, delimited by dashes. Used by all methods 445a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// that output lists of attributes: attributesOfLinkedUIElementsCallback, 446a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// AttributesOfChildrenCallback, etc. 447a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class AttributesCollector { 448a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public: 449a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) AttributesCollector() {} 450a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ~AttributesCollector() {} 451a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 452a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void CollectAttributes(const blink::WebAXObject& object) { 453a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) attributes_.append("\n------------\n"); 454a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) attributes_.append(GetAttributes(object)); 455a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 456a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 457a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string attributes() const { return attributes_; } 458a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 459a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private: 460a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) std::string attributes_; 461a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 462a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AttributesCollector); 463a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}; 464a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 465a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace 466a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 467a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)gin::WrapperInfo WebAXObjectProxy::kWrapperInfo = { 468a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) gin::kEmbedderNativeGin}; 469a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 470a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)WebAXObjectProxy::WebAXObjectProxy(const blink::WebAXObject& object, 471a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WebAXObjectProxy::Factory* factory) 472a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) : accessibility_object_(object), 473a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) factory_(factory) { 474a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 475a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 476a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)WebAXObjectProxy::~WebAXObjectProxy() {} 477a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 478a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)gin::ObjectTemplateBuilder 479a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)WebAXObjectProxy::GetObjectTemplateBuilder(v8::Isolate* isolate) { 480a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return gin::Wrappable<WebAXObjectProxy>::GetObjectTemplateBuilder(isolate) 481a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("role", &WebAXObjectProxy::Role) 482a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("title", &WebAXObjectProxy::Title) 483a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("description", &WebAXObjectProxy::Description) 484a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("helpText", &WebAXObjectProxy::HelpText) 485a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("stringValue", &WebAXObjectProxy::StringValue) 486a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("x", &WebAXObjectProxy::X) 487a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("y", &WebAXObjectProxy::Y) 488a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("width", &WebAXObjectProxy::Width) 489a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("height", &WebAXObjectProxy::Height) 490a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("intValue", &WebAXObjectProxy::IntValue) 491a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("minValue", &WebAXObjectProxy::MinValue) 492a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("maxValue", &WebAXObjectProxy::MaxValue) 493a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription) 494a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount) 495a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("insertionPointLineNumber", 496a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::InsertionPointLineNumber) 497a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("selectedTextRange", &WebAXObjectProxy::SelectedTextRange) 498a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isEnabled", &WebAXObjectProxy::IsEnabled) 499a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isRequired", &WebAXObjectProxy::IsRequired) 500a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) 501a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isFocusable", &WebAXObjectProxy::IsFocusable) 502a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isSelected", &WebAXObjectProxy::IsSelected) 503a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isSelectable", &WebAXObjectProxy::IsSelectable) 504a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isMultiSelectable", &WebAXObjectProxy::IsMultiSelectable) 505a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isSelectedOptionActive", 506a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::IsSelectedOptionActive) 507a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isExpanded", &WebAXObjectProxy::IsExpanded) 508a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isChecked", &WebAXObjectProxy::IsChecked) 509a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isVisible", &WebAXObjectProxy::IsVisible) 510a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen) 511a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed) 512a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup) 513a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isValid", &WebAXObjectProxy::IsValid) 514a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly) 515a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("orientation", &WebAXObjectProxy::Orientation) 516a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) 517a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) 518a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("rowCount", &WebAXObjectProxy::RowCount) 519a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) 520a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) 521a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes) 522a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("attributesOfChildren", 523a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::AttributesOfChildren) 524a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("lineForIndex", &WebAXObjectProxy::LineForIndex) 525a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange) 526a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex) 527a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint) 528a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader) 529a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("rowIndexRange", &WebAXObjectProxy::RowIndexRange) 530a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("columnIndexRange", &WebAXObjectProxy::ColumnIndexRange) 531a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("cellForColumnAndRow", &WebAXObjectProxy::CellForColumnAndRow) 532a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("titleUIElement", &WebAXObjectProxy::TitleUIElement) 533a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("setSelectedTextRange", 534a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::SetSelectedTextRange) 535a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("isAttributeSettable", &WebAXObjectProxy::IsAttributeSettable) 536a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("isPressActionSupported", 537a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::IsPressActionSupported) 538a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("isIncrementActionSupported", 539a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::IsIncrementActionSupported) 540a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("isDecrementActionSupported", 541a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::IsDecrementActionSupported) 542a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("parentElement", &WebAXObjectProxy::ParentElement) 543a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("increment", &WebAXObjectProxy::Increment) 544a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("decrement", &WebAXObjectProxy::Decrement) 545a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("showMenu", &WebAXObjectProxy::ShowMenu) 546a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("press", &WebAXObjectProxy::Press) 547a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("isEqual", &WebAXObjectProxy::IsEqual) 548a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("setNotificationListener", 549a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::SetNotificationListener) 550a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("unsetNotificationListener", 551a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::UnsetNotificationListener) 552a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("takeFocus", &WebAXObjectProxy::TakeFocus) 553a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("scrollToMakeVisible", &WebAXObjectProxy::ScrollToMakeVisible) 554a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("scrollToMakeVisibleWithSubFocus", 555a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::ScrollToMakeVisibleWithSubFocus) 556a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("scrollToGlobalPoint", &WebAXObjectProxy::ScrollToGlobalPoint) 557a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("wordStart", &WebAXObjectProxy::WordStart) 558a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("wordEnd", &WebAXObjectProxy::WordEnd) 559a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // TODO(hajimehoshi): This is for backward compatibility. Remove them. 560a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("addNotificationListener", 561a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::SetNotificationListener) 562a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .SetMethod("removeNotificationListener", 563a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &WebAXObjectProxy::UnsetNotificationListener); 564a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 565a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 566a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::GetChildAtIndex(unsigned index) { 56703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return factory_->GetOrCreate(accessibility_object_.childAt(index)); 568a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 569a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 570a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsRoot() const { 571a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return false; 572a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 573a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 574a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsEqualToObject(const blink::WebAXObject& other) { 57503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.equals(other); 576a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 577a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 578a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::NotificationReceived( 579a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebFrame* frame, 580a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const std::string& notification_name) { 581a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (notification_callback_.IsEmpty()) 582a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return; 583a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 584a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); 585a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (context.IsEmpty()) 586a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return; 587a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 588a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Isolate* isolate = blink::mainThreadIsolate(); 589a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 590a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Value> argv[] = { 591a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::String::NewFromUtf8(isolate, notification_name.data(), 592a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::String::kNormalString, 593a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) notification_name.size()), 594a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) }; 595a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) frame->callFunctionEvenIfScriptDisabled( 596a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Local<v8::Function>::New(isolate, notification_callback_), 597a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) context->Global(), 598a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) arraysize(argv), 599a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) argv); 600a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 601a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 602116680a4aac90f2aa7413d9095a592090648e557Ben Murdochvoid WebAXObjectProxy::Reset() { 603116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch notification_callback_.Reset(); 604116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 605116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 606a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::Role() { 60703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 60803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetRole(accessibility_object_); 609a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 610a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 611a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::Title() { 61203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 61303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetTitle(accessibility_object_); 614a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 615a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 616a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::Description() { 61703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 61803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetDescription(accessibility_object_); 619a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 620a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 621a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::HelpText() { 62203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 62303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetHelpText(accessibility_object_); 624a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 625a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 626a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::StringValue() { 62703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 62803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetStringValue(accessibility_object_); 629a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 630a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 631a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::X() { 63203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 63303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.boundingBoxRect().x; 634a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 635a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 636a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::Y() { 63703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 63803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.boundingBoxRect().y; 639a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 640a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 641a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::Width() { 64203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 64303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.boundingBoxRect().width; 644a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 645a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 646a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::Height() { 64703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 64803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.boundingBoxRect().height; 649a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 650a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 651a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::IntValue() { 65203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 65303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (accessibility_object_.supportsRangeValue()) 65403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.valueForRange(); 65503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) else if (accessibility_object_.role() == blink::WebAXRoleHeading) 65603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.headingLevel(); 657a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) else 65803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return atoi(accessibility_object_.stringValue().utf8().data()); 659a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 660a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 661a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::MinValue() { 66203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 66303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.minValueForRange(); 664a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 665a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 666a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::MaxValue() { 66703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 66803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.maxValueForRange(); 669a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 670a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 671a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::ValueDescription() { 67203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 67303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetValueDescription(accessibility_object_); 674a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 675a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 676a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::ChildrenCount() { 67703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 678a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int count = 1; // Root object always has only one child, the WebView. 679a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (!IsRoot()) 68003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) count = accessibility_object_.childCount(); 681a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return count; 682a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 683a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 684a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::InsertionPointLineNumber() { 68503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 68603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (!accessibility_object_.isFocused()) 687a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return -1; 68803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.selectionEndLineNumber(); 689a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 690a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 691a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::SelectedTextRange() { 69203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 69303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned selection_start = accessibility_object_.selectionStart(); 69403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned selection_end = accessibility_object_.selectionEnd(); 695a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return base::StringPrintf("{%d, %d}", 696a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) selection_start, selection_end - selection_start); 697a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 698a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 699a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsEnabled() { 70003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 70103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isEnabled(); 702a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 703a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 704a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsRequired() { 70503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 70603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isRequired(); 707a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 708a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 709a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsFocused() { 71003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 71103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isFocused(); 712a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 713a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 714a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsFocusable() { 71503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 71603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.canSetFocusAttribute(); 717a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 718a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 719a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsSelected() { 72003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 72103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isSelected(); 722a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 723a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 724a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsSelectable() { 72503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 72603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.canSetSelectedAttribute(); 727a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 728a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 729a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsMultiSelectable() { 73003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 73103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isMultiSelectable(); 732a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 733a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 734a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsSelectedOptionActive() { 73503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 73603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isSelectedOptionActive(); 737a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 738a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 739a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsExpanded() { 74003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 74103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return !accessibility_object_.isCollapsed(); 742a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 743a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 744a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsChecked() { 74503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 74603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isChecked(); 747a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 748a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 749a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsVisible() { 75003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 75103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isVisible(); 752a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 753a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 754a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsOffScreen() { 75503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 75603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isOffScreen(); 757a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 758a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 759a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsCollapsed() { 76003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 76103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isCollapsed(); 762a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 763a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 764a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::HasPopup() { 76503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 76603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.ariaHasPopup(); 767a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 768a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 769a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsValid() { 77003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 77103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return !accessibility_object_.isDetached(); 772a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 773a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 774a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsReadOnly() { 77503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 77603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isReadOnly(); 777a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 778a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 779a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::Orientation() { 78003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 78103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetOrientation(accessibility_object_); 782a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 783a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 784a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::ClickPointX() { 78503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 78603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.clickPoint().x; 787a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 788a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 789a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::ClickPointY() { 79003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 79103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.clickPoint().y; 792a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 793a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 794a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int32_t WebAXObjectProxy::RowCount() { 79503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 79603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return static_cast<int32_t>(accessibility_object_.rowCount()); 797a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 798a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 799a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int32_t WebAXObjectProxy::ColumnCount() { 80003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 80103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return static_cast<int32_t>(accessibility_object_.columnCount()); 802a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 803a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 804a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsClickable() { 80503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 80603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.isClickable(); 807a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 808a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 809a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::AllAttributes() { 81003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 81103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return GetAttributes(accessibility_object_); 812a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 813a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 814a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::AttributesOfChildren() { 81503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 816a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) AttributesCollector collector; 81703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned size = accessibility_object_.childCount(); 818a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) for (unsigned i = 0; i < size; ++i) 81903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) collector.CollectAttributes(accessibility_object_.childAt(i)); 820a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return collector.attributes(); 821a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 822a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 823a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::LineForIndex(int index) { 82403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 825a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebVector<int> line_breaks; 82603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.lineBreaks(line_breaks); 827a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int line = 0; 828a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int vector_size = static_cast<int>(line_breaks.size()); 829a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) while (line < vector_size && line_breaks[line] <= index) 830a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) line++; 831a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return line; 832a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 833a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 834a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::BoundsForRange(int start, int end) { 83503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 83603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (accessibility_object_.role() != blink::WebAXRoleStaticText) 837a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return std::string(); 838a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 83903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (!accessibility_object_.updateLayoutAndCheckValidity()) 840c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch return std::string(); 841c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 842a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int len = end - start; 843a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 844a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Get the bounds for each character and union them into one large rectangle. 845a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // This is just for testing so it doesn't need to be efficient. 84603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) blink::WebRect bounds = BoundsForCharacter(accessibility_object_, start); 847a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) for (int i = 1; i < len; i++) { 84803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) blink::WebRect next = BoundsForCharacter(accessibility_object_, start + i); 849a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int right = std::max(bounds.x + bounds.width, next.x + next.width); 850a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int bottom = std::max(bounds.y + bounds.height, next.y + next.height); 851a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bounds.x = std::min(bounds.x, next.x); 852a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bounds.y = std::min(bounds.y, next.y); 853a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bounds.width = right - bounds.x; 854a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bounds.height = bottom - bounds.y; 855a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 856a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 857a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return base::StringPrintf("{x: %d, y: %d, width: %d, height: %d}", 858a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bounds.x, bounds.y, bounds.width, bounds.height); 859a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 860a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 861a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::ChildAtIndex(int index) { 86203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 863a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return GetChildAtIndex(index); 864a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 865a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 866a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::ElementAtPoint(int x, int y) { 86703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 868a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebPoint point(x, y); 86903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) blink::WebAXObject obj = accessibility_object_.hitTest(point); 870a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (obj.isNull()) 871a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 872a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 873a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return factory_->GetOrCreate(obj); 874a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 875a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 876a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::TableHeader() { 87703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 87803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) blink::WebAXObject obj = accessibility_object_.headerContainerObject(); 879a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (obj.isNull()) 880a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 881a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 882a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return factory_->GetOrCreate(obj); 883a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 884a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 885a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::RowIndexRange() { 88603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 88703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned row_index = accessibility_object_.cellRowIndex(); 88803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned row_span = accessibility_object_.cellRowSpan(); 889a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return base::StringPrintf("{%d, %d}", row_index, row_span); 890a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 891a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 892a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)std::string WebAXObjectProxy::ColumnIndexRange() { 89303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 89403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned column_index = accessibility_object_.cellColumnIndex(); 89503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) unsigned column_span = accessibility_object_.cellColumnSpan(); 896a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return base::StringPrintf("{%d, %d}", column_index, column_span); 897a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 898a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 899a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::CellForColumnAndRow( 900a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int column, int row) { 90103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 902a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebAXObject obj = 90303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.cellForColumnAndRow(column, row); 904a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (obj.isNull()) 905a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 906a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 907a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return factory_->GetOrCreate(obj); 908a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 909a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 910a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::TitleUIElement() { 91103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 91203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) blink::WebAXObject obj = accessibility_object_.titleUIElement(); 913a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (obj.isNull()) 914a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 915a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 916a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return factory_->GetOrCreate(obj); 917a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 918a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 919a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::SetSelectedTextRange(int selection_start, 920a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int length) { 92103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 92203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.setSelectedTextRange(selection_start, 923a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) selection_start + length); 924a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 925a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 926a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsAttributeSettable(const std::string& attribute) { 92703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 928a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool settable = false; 929a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (attribute == "AXValue") 93003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) settable = accessibility_object_.canSetValueAttribute(); 931a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return settable; 932a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 933a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 934a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsPressActionSupported() { 93503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 93603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.canPress(); 937a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 938a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 939a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsIncrementActionSupported() { 94003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 94103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.canIncrement(); 942a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 943a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 944a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsDecrementActionSupported() { 94503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 94603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return accessibility_object_.canDecrement(); 947a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 948a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 949a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxy::ParentElement() { 95003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 95103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) blink::WebAXObject parent_object = accessibility_object_.parentObject(); 952a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) while (parent_object.accessibilityIsIgnored()) 953a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) parent_object = parent_object.parentObject(); 954a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return factory_->GetOrCreate(parent_object); 955a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 956a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 957a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::Increment() { 95803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 95903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.increment(); 960a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 961a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 962a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::Decrement() { 96303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 96403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.decrement(); 965a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 966a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 967a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::ShowMenu() { 968a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 969a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 970a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::Press() { 97103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 97203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.press(); 973a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 974a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 975a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool WebAXObjectProxy::IsEqual(v8::Handle<v8::Object> proxy) { 976a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WebAXObjectProxy* unwrapped_proxy = NULL; 977a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (!gin::ConvertFromV8(blink::mainThreadIsolate(), proxy, &unwrapped_proxy)) 978a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return false; 979a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return unwrapped_proxy->IsEqualToObject(accessibility_object_); 980a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 981a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 982a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::SetNotificationListener( 983a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Function> callback) { 984a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Isolate* isolate = blink::mainThreadIsolate(); 985a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) notification_callback_.Reset(isolate, callback); 986a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 987a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 988a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::UnsetNotificationListener() { 989a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) notification_callback_.Reset(); 990a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 991a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 992a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::TakeFocus() { 99303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 99403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.setFocused(true); 995a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 996a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 997a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::ScrollToMakeVisible() { 99803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 99903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.scrollToMakeVisible(); 1000a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1001a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1002a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::ScrollToMakeVisibleWithSubFocus(int x, int y, 1003a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int width, int height) { 100403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 100503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.scrollToMakeVisibleWithSubFocus( 1006a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) blink::WebRect(x, y, width, height)); 1007a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1008a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1009a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxy::ScrollToGlobalPoint(int x, int y) { 101003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 101103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.scrollToGlobalPoint(blink::WebPoint(x, y)); 1012a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1013a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1014a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::WordStart(int character_index) { 101503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 101603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (accessibility_object_.role() != blink::WebAXRoleStaticText) 1017a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return -1; 1018a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1019a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int word_start, word_end; 102003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) GetBoundariesForOneWord(accessibility_object_, character_index, 1021a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_start, word_end); 1022a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return word_start; 1023a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1024a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1025a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)int WebAXObjectProxy::WordEnd(int character_index) { 102603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) accessibility_object_.updateLayoutAndCheckValidity(); 102703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (accessibility_object_.role() != blink::WebAXRoleStaticText) 1028a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return -1; 1029a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1030a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int word_start, word_end; 103103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) GetBoundariesForOneWord(accessibility_object_, character_index, 1032a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) word_start, word_end); 1033a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return word_end; 1034a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1035a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1036a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)RootWebAXObjectProxy::RootWebAXObjectProxy( 1037a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const blink::WebAXObject &object, Factory *factory) 1038a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) : WebAXObjectProxy(object, factory) { 1039a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1040a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1041a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> RootWebAXObjectProxy::GetChildAtIndex(unsigned index) { 1042a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (index) 1043a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 1044a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1045a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return factory()->GetOrCreate(accessibility_object()); 1046a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1047a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1048a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool RootWebAXObjectProxy::IsRoot() const { 1049a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return true; 1050a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1051a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1052c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen MurdochWebAXObjectProxyList::WebAXObjectProxyList() 1053c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch : elements_(blink::mainThreadIsolate()) { 1054a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1055a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1056a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)WebAXObjectProxyList::~WebAXObjectProxyList() { 1057a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) Clear(); 1058a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1059a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1060a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void WebAXObjectProxyList::Clear() { 1061116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch v8::Isolate* isolate = blink::mainThreadIsolate(); 1062116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch v8::HandleScope handle_scope(isolate); 1063116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch size_t elementCount = elements_.Size(); 1064116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch for (size_t i = 0; i < elementCount; i++) { 1065116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch WebAXObjectProxy* unwrapped_object = NULL; 1066116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool result = gin::ConvertFromV8(isolate, elements_.Get(i), 1067116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch &unwrapped_object); 1068116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch DCHECK(result); 1069116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch DCHECK(unwrapped_object); 1070116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch unwrapped_object->Reset(); 1071116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch } 1072c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch elements_.Clear(); 1073a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1074a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1075a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxyList::GetOrCreate( 1076a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const blink::WebAXObject& object) { 1077a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (object.isNull()) 1078a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 1079a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1080a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Isolate* isolate = blink::mainThreadIsolate(); 1081a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1082c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch size_t elementCount = elements_.Size(); 1083a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) for (size_t i = 0; i < elementCount; i++) { 1084a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WebAXObjectProxy* unwrapped_object = NULL; 1085c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch bool result = gin::ConvertFromV8(isolate, elements_.Get(i), 1086a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) &unwrapped_object); 1087a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK(result); 1088a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DCHECK(unwrapped_object); 1089a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (unwrapped_object->IsEqualToObject(object)) 1090c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch return elements_.Get(i); 1091a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 1092a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1093a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Value> value_handle = gin::CreateHandle( 1094a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) isolate, new WebAXObjectProxy(object, this)).ToV8(); 1095a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (value_handle.IsEmpty()) 1096a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 1097a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Object> handle = value_handle->ToObject(); 1098c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch elements_.Append(handle); 1099c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch return handle; 1100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)v8::Handle<v8::Object> WebAXObjectProxyList::CreateRoot( 1103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const blink::WebAXObject& object) { 1104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Isolate* isolate = blink::mainThreadIsolate(); 1105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Value> value_handle = gin::CreateHandle( 1106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) isolate, new RootWebAXObjectProxy(object, this)).ToV8(); 1107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (value_handle.IsEmpty()) 1108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return v8::Handle<v8::Object>(); 1109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) v8::Handle<v8::Object> handle = value_handle->ToObject(); 1110c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch elements_.Append(handle); 1111c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch return handle; 1112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 1113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace content 1115