| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/accessibility/accessibility_tree_formatter.h" | 5 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 const char* kRangeLocDictAttr = "loc"; | 34 const char* kRangeLocDictAttr = "loc"; |
| 35 const char* kRangeLenDictAttr = "len"; | 35 const char* kRangeLenDictAttr = "len"; |
| 36 | 36 |
| 37 scoped_ptr<base::DictionaryValue> PopulatePosition( | 37 scoped_ptr<base::DictionaryValue> PopulatePosition( |
| 38 const BrowserAccessibility& node) { | 38 const BrowserAccessibility& node) { |
| 39 scoped_ptr<base::DictionaryValue> position(new base::DictionaryValue); | 39 scoped_ptr<base::DictionaryValue> position(new base::DictionaryValue); |
| 40 // The NSAccessibility position of an object is in global coordinates and | 40 // The NSAccessibility position of an object is in global coordinates and |
| 41 // based on the lower-left corner of the object. To make this easier and less | 41 // based on the lower-left corner of the object. To make this easier and less |
| 42 // confusing, convert it to local window coordinates using the top-left | 42 // confusing, convert it to local window coordinates using the top-left |
| 43 // corner when dumping the position. | 43 // corner when dumping the position. |
| 44 BrowserAccessibility* root = node.manager()->GetRoot(); | 44 BrowserAccessibility* root = node.manager()->GetRootManager()->GetRoot(); |
| 45 BrowserAccessibilityCocoa* cocoa_root = root->ToBrowserAccessibilityCocoa(); | 45 BrowserAccessibilityCocoa* cocoa_root = root->ToBrowserAccessibilityCocoa(); |
| 46 NSPoint root_position = [[cocoa_root position] pointValue]; | 46 NSPoint root_position = [[cocoa_root position] pointValue]; |
| 47 NSSize root_size = [[cocoa_root size] sizeValue]; | 47 NSSize root_size = [[cocoa_root size] sizeValue]; |
| 48 int root_top = -static_cast<int>(root_position.y + root_size.height); | 48 int root_top = -static_cast<int>(root_position.y + root_size.height); |
| 49 int root_left = static_cast<int>(root_position.x); | 49 int root_left = static_cast<int>(root_position.x); |
| 50 | 50 |
| 51 BrowserAccessibilityCocoa* cocoa_node = | 51 BrowserAccessibilityCocoa* cocoa_node = |
| 52 const_cast<BrowserAccessibility*>(&node)->ToBrowserAccessibilityCocoa(); | 52 const_cast<BrowserAccessibility*>(&node)->ToBrowserAccessibilityCocoa(); |
| 53 NSPoint node_position = [[cocoa_node position] pointValue]; | 53 NSPoint node_position = [[cocoa_node position] pointValue]; |
| 54 NSSize node_size = [[cocoa_node size] sizeValue]; | 54 NSSize node_size = [[cocoa_node size] sizeValue]; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 331 |
| 332 const string AccessibilityTreeFormatterMac::GetAllowString() { | 332 const string AccessibilityTreeFormatterMac::GetAllowString() { |
| 333 return "@MAC-ALLOW:"; | 333 return "@MAC-ALLOW:"; |
| 334 } | 334 } |
| 335 | 335 |
| 336 const string AccessibilityTreeFormatterMac::GetDenyString() { | 336 const string AccessibilityTreeFormatterMac::GetDenyString() { |
| 337 return "@MAC-DENY:"; | 337 return "@MAC-DENY:"; |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace content | 340 } // namespace content |
| OLD | NEW |