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

Side by Side Diff: content/shell/test_runner/web_ax_object_proxy.cc

Issue 2945773002: Relation properties for Accessibility Object Model phase 1 (Closed)
Patch Set: Fix merge error, format Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/test_runner/web_ax_object_proxy.h" 5 #include "content/shell/test_runner/web_ax_object_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // 639 //
640 // NEW bounding rect calculation - high-level interface 640 // NEW bounding rect calculation - high-level interface
641 // 641 //
642 .SetProperty("boundsX", &WebAXObjectProxy::BoundsX) 642 .SetProperty("boundsX", &WebAXObjectProxy::BoundsX)
643 .SetProperty("boundsY", &WebAXObjectProxy::BoundsY) 643 .SetProperty("boundsY", &WebAXObjectProxy::BoundsY)
644 .SetProperty("boundsWidth", &WebAXObjectProxy::BoundsWidth) 644 .SetProperty("boundsWidth", &WebAXObjectProxy::BoundsWidth)
645 .SetProperty("boundsHeight", &WebAXObjectProxy::BoundsHeight) 645 .SetProperty("boundsHeight", &WebAXObjectProxy::BoundsHeight)
646 .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes) 646 .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes)
647 .SetMethod("attributesOfChildren", 647 .SetMethod("attributesOfChildren",
648 &WebAXObjectProxy::AttributesOfChildren) 648 &WebAXObjectProxy::AttributesOfChildren)
649 .SetMethod("ariaActiveDescendantElement",
650 &WebAXObjectProxy::AriaActiveDescendantElement)
649 .SetMethod("ariaControlsElementAtIndex", 651 .SetMethod("ariaControlsElementAtIndex",
650 &WebAXObjectProxy::AriaControlsElementAtIndex) 652 &WebAXObjectProxy::AriaControlsElementAtIndex)
653 .SetMethod("ariaDetailsElement", &WebAXObjectProxy::AriaDetailsElement)
654 .SetMethod("ariaErrorMessageElement",
655 &WebAXObjectProxy::AriaErrorMessageElement)
651 .SetMethod("ariaFlowToElementAtIndex", 656 .SetMethod("ariaFlowToElementAtIndex",
652 &WebAXObjectProxy::AriaFlowToElementAtIndex) 657 &WebAXObjectProxy::AriaFlowToElementAtIndex)
653 .SetMethod("ariaOwnsElementAtIndex", 658 .SetMethod("ariaOwnsElementAtIndex",
654 &WebAXObjectProxy::AriaOwnsElementAtIndex) 659 &WebAXObjectProxy::AriaOwnsElementAtIndex)
655 .SetMethod("lineForIndex", &WebAXObjectProxy::LineForIndex) 660 .SetMethod("lineForIndex", &WebAXObjectProxy::LineForIndex)
656 .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange) 661 .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange)
657 .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex) 662 .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex)
658 .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint) 663 .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint)
659 .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader) 664 .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader)
660 .SetMethod("rowHeaderAtIndex", &WebAXObjectProxy::RowHeaderAtIndex) 665 .SetMethod("rowHeaderAtIndex", &WebAXObjectProxy::RowHeaderAtIndex)
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 blink::WebVector<blink::WebAXObject> headers; 1261 blink::WebVector<blink::WebAXObject> headers;
1257 accessibility_object_.ColumnHeaders(headers); 1262 accessibility_object_.ColumnHeaders(headers);
1258 return static_cast<int32_t>(headers.size()); 1263 return static_cast<int32_t>(headers.size());
1259 } 1264 }
1260 1265
1261 bool WebAXObjectProxy::IsClickable() { 1266 bool WebAXObjectProxy::IsClickable() {
1262 accessibility_object_.UpdateLayoutAndCheckValidity(); 1267 accessibility_object_.UpdateLayoutAndCheckValidity();
1263 return accessibility_object_.IsClickable(); 1268 return accessibility_object_.IsClickable();
1264 } 1269 }
1265 1270
1271 v8::Local<v8::Object> WebAXObjectProxy::AriaActiveDescendantElement() {
1272 accessibility_object_.UpdateLayoutAndCheckValidity();
1273 SparseAttributeAdapter attribute_adapter;
1274 accessibility_object_.GetSparseAXAttributes(attribute_adapter);
1275 blink::WebAXObject element =
1276 attribute_adapter.object_attributes
1277 [blink::WebAXObjectAttribute::kAriaActiveDescendant];
1278 return factory_->GetOrCreate(element);
1279 }
1280
1266 v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( 1281 v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex(
1267 unsigned index) { 1282 unsigned index) {
1268 accessibility_object_.UpdateLayoutAndCheckValidity(); 1283 accessibility_object_.UpdateLayoutAndCheckValidity();
1269 SparseAttributeAdapter attribute_adapter; 1284 SparseAttributeAdapter attribute_adapter;
1270 accessibility_object_.GetSparseAXAttributes(attribute_adapter); 1285 accessibility_object_.GetSparseAXAttributes(attribute_adapter);
1271 blink::WebVector<blink::WebAXObject> elements = 1286 blink::WebVector<blink::WebAXObject> elements =
1272 attribute_adapter.object_vector_attributes 1287 attribute_adapter.object_vector_attributes
1273 [blink::WebAXObjectVectorAttribute::kAriaControls]; 1288 [blink::WebAXObjectVectorAttribute::kAriaControls];
1274 size_t elementCount = elements.size(); 1289 size_t elementCount = elements.size();
1275 if (index >= elementCount) 1290 if (index >= elementCount)
1276 return v8::Local<v8::Object>(); 1291 return v8::Local<v8::Object>();
1277 1292
1278 return factory_->GetOrCreate(elements[index]); 1293 return factory_->GetOrCreate(elements[index]);
1279 } 1294 }
1280 1295
1296 v8::Local<v8::Object> WebAXObjectProxy::AriaDetailsElement() {
1297 accessibility_object_.UpdateLayoutAndCheckValidity();
1298 SparseAttributeAdapter attribute_adapter;
1299 accessibility_object_.GetSparseAXAttributes(attribute_adapter);
1300 blink::WebAXObject element =
1301 attribute_adapter
1302 .object_attributes[blink::WebAXObjectAttribute::kAriaDetails];
1303 return factory_->GetOrCreate(element);
1304 }
1305
1306 v8::Local<v8::Object> WebAXObjectProxy::AriaErrorMessageElement() {
1307 accessibility_object_.UpdateLayoutAndCheckValidity();
1308 SparseAttributeAdapter attribute_adapter;
1309 accessibility_object_.GetSparseAXAttributes(attribute_adapter);
1310 blink::WebAXObject element =
1311 attribute_adapter
1312 .object_attributes[blink::WebAXObjectAttribute::kAriaErrorMessage];
1313 return factory_->GetOrCreate(element);
1314 }
1315
1281 v8::Local<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex( 1316 v8::Local<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex(
1282 unsigned index) { 1317 unsigned index) {
1283 accessibility_object_.UpdateLayoutAndCheckValidity(); 1318 accessibility_object_.UpdateLayoutAndCheckValidity();
1284 SparseAttributeAdapter attribute_adapter; 1319 SparseAttributeAdapter attribute_adapter;
1285 accessibility_object_.GetSparseAXAttributes(attribute_adapter); 1320 accessibility_object_.GetSparseAXAttributes(attribute_adapter);
1286 blink::WebVector<blink::WebAXObject> elements = 1321 blink::WebVector<blink::WebAXObject> elements =
1287 attribute_adapter.object_vector_attributes 1322 attribute_adapter.object_vector_attributes
1288 [blink::WebAXObjectVectorAttribute::kAriaFlowTo]; 1323 [blink::WebAXObjectVectorAttribute::kAriaFlowTo];
1289 size_t elementCount = elements.size(); 1324 size_t elementCount = elements.size();
1290 if (index >= elementCount) 1325 if (index >= elementCount)
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 v8::Local<v8::Value> value_handle = 1918 v8::Local<v8::Value> value_handle =
1884 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8(); 1919 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8();
1885 if (value_handle.IsEmpty()) 1920 if (value_handle.IsEmpty())
1886 return v8::Local<v8::Object>(); 1921 return v8::Local<v8::Object>();
1887 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); 1922 v8::Local<v8::Object> handle = value_handle->ToObject(isolate);
1888 elements_.Append(handle); 1923 elements_.Append(handle);
1889 return handle; 1924 return handle;
1890 } 1925 }
1891 1926
1892 } // namespace test_runner 1927 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698