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

Side by Side Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 2301833005: Get rid of AX_LINE_BREAKS attribute to improve performance. (Closed)
Patch Set: Re-worded comment. Created 4 years, 3 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 "chrome/renderer/extensions/automation_internal_custom_bindings.h" 5 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 std::string role_name = ui::ToString(node->data().role); 520 std::string role_name = ui::ToString(node->data().role);
521 result.Set(v8::String::NewFromUtf8(isolate, role_name.c_str())); 521 result.Set(v8::String::NewFromUtf8(isolate, role_name.c_str()));
522 }); 522 });
523 RouteNodeIDFunction( 523 RouteNodeIDFunction(
524 "GetLocation", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, 524 "GetLocation", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
525 TreeCache* cache, ui::AXNode* node) { 525 TreeCache* cache, ui::AXNode* node) {
526 gfx::Rect location = ComputeGlobalNodeBounds(cache, node); 526 gfx::Rect location = ComputeGlobalNodeBounds(cache, node);
527 location.Offset(cache->location_offset); 527 location.Offset(cache->location_offset);
528 result.Set(RectToV8Object(isolate, location)); 528 result.Set(RectToV8Object(isolate, location));
529 }); 529 });
530 RouteNodeIDFunction(
531 "GetLineStartOffsets",
532 [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
533 TreeCache* cache, ui::AXNode* node) {
534 const std::vector<int> line_starts =
535 node->GetOrComputeLineStartOffsets();
536 v8::Local<v8::Array> array_result(
537 v8::Array::New(isolate, line_starts.size()));
538 for (size_t i = 0; i < line_starts.size(); ++i) {
539 array_result->Set(static_cast<uint32_t>(i),
540 v8::Integer::New(isolate, line_starts[i]));
541 }
542 result.Set(array_result);
543 });
530 RouteNodeIDFunction("GetChildIDs", [](v8::Isolate* isolate, 544 RouteNodeIDFunction("GetChildIDs", [](v8::Isolate* isolate,
531 v8::ReturnValue<v8::Value> result, 545 v8::ReturnValue<v8::Value> result,
532 TreeCache* cache, ui::AXNode* node) { 546 TreeCache* cache, ui::AXNode* node) {
533 const std::vector<ui::AXNode*>& children = node->children(); 547 const std::vector<ui::AXNode*>& children = node->children();
534 v8::Local<v8::Array> array_result(v8::Array::New(isolate, children.size())); 548 v8::Local<v8::Array> array_result(v8::Array::New(isolate, children.size()));
535 for (size_t i = 0; i < children.size(); ++i) { 549 for (size_t i = 0; i < children.size(); ++i) {
536 array_result->Set(static_cast<uint32_t>(i), 550 array_result->Set(static_cast<uint32_t>(i),
537 v8::Integer::New(isolate, children[i]->id())); 551 v8::Integer::New(isolate, children[i]->id()));
538 } 552 }
539 result.Set(array_result); 553 result.Set(array_result);
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 2U)); 1366 v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 2U));
1353 args->Set(0U, v8::Integer::New(GetIsolate(), tree_id)); 1367 args->Set(0U, v8::Integer::New(GetIsolate(), tree_id));
1354 v8::Local<v8::Array> nodes(v8::Array::New(GetIsolate(), ids.size())); 1368 v8::Local<v8::Array> nodes(v8::Array::New(GetIsolate(), ids.size()));
1355 args->Set(1U, nodes); 1369 args->Set(1U, nodes);
1356 for (size_t i = 0; i < ids.size(); ++i) 1370 for (size_t i = 0; i < ids.size(); ++i)
1357 nodes->Set(i, v8::Integer::New(GetIsolate(), ids[i])); 1371 nodes->Set(i, v8::Integer::New(GetIsolate(), ids[i]));
1358 context()->DispatchEvent("automationInternal.onNodesRemoved", args); 1372 context()->DispatchEvent("automationInternal.onNodesRemoved", args);
1359 } 1373 }
1360 1374
1361 } // namespace extensions 1375 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698