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

Side by Side Diff: ui/accessibility/platform/ax_platform_node_auralinux.cc

Issue 1146973004: Possible browser crash while traversing tree of accessibility objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/accessibility/platform/ax_platform_node_auralinux.h" 5 #include "ui/accessibility/platform/ax_platform_node_auralinux.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "ui/accessibility/ax_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 obj->GetAtkState(atk_state_set); 182 obj->GetAtkState(atk_state_set);
183 return atk_state_set; 183 return atk_state_set;
184 } 184 }
185 185
186 // 186 //
187 // AtkComponent interface 187 // AtkComponent interface
188 // 188 //
189 189
190 static gfx::Point FindAtkObjectParentCoords(AtkObject* atk_object) { 190 static gfx::Point FindAtkObjectParentCoords(AtkObject* atk_object) {
191 if (!atk_object)
192 return gfx::Point(0, 0);
193
191 if (atk_object_get_role(atk_object) == ATK_ROLE_WINDOW) { 194 if (atk_object_get_role(atk_object) == ATK_ROLE_WINDOW) {
192 int x, y; 195 int x, y;
193 atk_component_get_extents(ATK_COMPONENT(atk_object), 196 atk_component_get_extents(ATK_COMPONENT(atk_object),
194 &x, &y, nullptr, nullptr, ATK_XY_WINDOW); 197 &x, &y, nullptr, nullptr, ATK_XY_WINDOW);
195 gfx::Point window_coords(x, y); 198 gfx::Point window_coords(x, y);
196 return window_coords; 199 return window_coords;
197 } 200 }
198 atk_object = atk_object_get_parent(atk_object); 201 atk_object = atk_object_get_parent(atk_object);
199 202
200 return FindAtkObjectParentCoords(atk_object); 203 return FindAtkObjectParentCoords(atk_object);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 if (x) 497 if (x)
495 *x = extents.x(); 498 *x = extents.x();
496 if (y) 499 if (y)
497 *y = extents.y(); 500 *y = extents.y();
498 if (width) 501 if (width)
499 *width = extents.width(); 502 *width = extents.width();
500 if (height) 503 if (height)
501 *height = extents.height(); 504 *height = extents.height();
502 505
503 if (coord_type == ATK_XY_WINDOW) { 506 if (coord_type == ATK_XY_WINDOW) {
504 AtkObject* atk_object = GetParent(); 507 if (AtkObject* atk_object = GetParent()) {
505 gfx::Point window_coords = FindAtkObjectParentCoords(atk_object); 508 gfx::Point window_coords = FindAtkObjectParentCoords(atk_object);
506 if (x) 509 if (x)
507 *x -= window_coords.x(); 510 *x -= window_coords.x();
508 if (y) 511 if (y)
509 *y -= window_coords.y(); 512 *y -= window_coords.y();
513 }
510 } 514 }
511 } 515 }
512 516
513 void AXPlatformNodeAuraLinux::GetExtents(gint* x, gint* y, 517 void AXPlatformNodeAuraLinux::GetExtents(gint* x, gint* y,
514 gint* width, gint* height, 518 gint* width, gint* height,
515 AtkCoordType coord_type) { 519 AtkCoordType coord_type) {
516 SetExtentsRelativeToAtkCoordinateType(x, y, 520 SetExtentsRelativeToAtkCoordinateType(x, y,
517 width, height, 521 width, height,
518 coord_type); 522 coord_type);
519 } 523 }
520 524
521 void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y, 525 void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y,
522 AtkCoordType coord_type) { 526 AtkCoordType coord_type) {
523 SetExtentsRelativeToAtkCoordinateType(x, y, 527 SetExtentsRelativeToAtkCoordinateType(x, y,
524 nullptr,nullptr, 528 nullptr,nullptr,
525 coord_type); 529 coord_type);
526 } 530 }
527 531
528 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { 532 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) {
529 gfx::Rect rect_size = GetData().location; 533 gfx::Rect rect_size = GetData().location;
530 if (width) 534 if (width)
531 *width = rect_size.width(); 535 *width = rect_size.width();
532 if (height) 536 if (height)
533 *height = rect_size.height(); 537 *height = rect_size.height();
534 } 538 }
535 539
536 } // namespace ui 540 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698