| OLD | NEW |
| 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 #import "ui/accessibility/platform/ax_platform_node_mac.h" | 5 #import "ui/accessibility/platform/ax_platform_node_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "ui/accessibility/ax_action_data.h" | 12 #include "ui/accessibility/ax_action_data.h" |
| 13 #include "ui/accessibility/ax_node_data.h" | 13 #include "ui/accessibility/ax_node_data.h" |
| 14 #include "ui/accessibility/ax_role_properties.h" | 14 #include "ui/accessibility/ax_role_properties.h" |
| 15 #include "ui/accessibility/platform/ax_platform_node.h" | 15 #include "ui/accessibility/platform/ax_platform_node.h" |
| 16 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 16 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 18 #include "ui/base/text/text_properties.h" |
| 19 #include "ui/gfx/geometry/rect.h" |
| 18 #import "ui/gfx/mac/coordinate_conversion.h" | 20 #import "ui/gfx/mac/coordinate_conversion.h" |
| 21 #include "ui/gfx/range/range.h" |
| 19 #include "ui/strings/grit/ui_strings.h" | 22 #include "ui/strings/grit/ui_strings.h" |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| 22 | 25 |
| 23 struct RoleMapEntry { | 26 struct RoleMapEntry { |
| 24 ui::AXRole value; | 27 ui::AXRole value; |
| 25 NSString* nativeValue; | 28 NSString* nativeValue; |
| 26 }; | 29 }; |
| 27 | 30 |
| 28 struct EventMapEntry { | 31 struct EventMapEntry { |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 } | 697 } |
| 695 | 698 |
| 696 - (id)AXRangeForIndex:(id)parameter { | 699 - (id)AXRangeForIndex:(id)parameter { |
| 697 DCHECK([parameter isKindOfClass:[NSNumber class]]); | 700 DCHECK([parameter isKindOfClass:[NSNumber class]]); |
| 698 NOTIMPLEMENTED(); | 701 NOTIMPLEMENTED(); |
| 699 return nil; | 702 return nil; |
| 700 } | 703 } |
| 701 | 704 |
| 702 - (id)AXBoundsForRange:(id)parameter { | 705 - (id)AXBoundsForRange:(id)parameter { |
| 703 DCHECK([parameter isKindOfClass:[NSValue class]]); | 706 DCHECK([parameter isKindOfClass:[NSValue class]]); |
| 704 // TODO(tapted): Provide an accessor on AXPlatformNodeDelegate to obtain this | 707 if (ui::TextInputClient* text = node_->GetDelegate()->GetTextInputClient()) { |
| 705 // from ui::TextInputClient::GetCompositionCharacterBounds(). | 708 gfx::Range actualRange; |
| 706 NOTIMPLEMENTED(); | 709 gfx::Rect rect = ui::GetFirstRectForTextInputRange( |
| 710 text, gfx::Range([parameter rangeValue]), &actualRange); |
| 711 // GetFirstRectForTextInputRange() can "fail", in which case it returns |
| 712 // the caret bounds. That might be weird. |
| 713 rect.set_width(30); |
| 714 DLOG(INFO) << text << " -> " << actualRange.ToString() << " -> " |
| 715 << rect.ToString(); |
| 716 return [NSValue valueWithRect:gfx::ScreenRectToNSRect(rect)]; |
| 717 } else { |
| 718 DLOG(INFO) << "it null"; |
| 719 } |
| 707 return nil; | 720 return nil; |
| 708 } | 721 } |
| 709 | 722 |
| 710 - (id)AXRTFForRange:(id)parameter { | 723 - (id)AXRTFForRange:(id)parameter { |
| 711 DCHECK([parameter isKindOfClass:[NSValue class]]); | 724 DCHECK([parameter isKindOfClass:[NSValue class]]); |
| 712 NOTIMPLEMENTED(); | 725 NOTIMPLEMENTED(); |
| 713 return nil; | 726 return nil; |
| 714 } | 727 } |
| 715 | 728 |
| 716 - (id)AXStyleRangeForIndex:(id)parameter { | 729 - (id)AXStyleRangeForIndex:(id)parameter { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 } | 797 } |
| 785 NotifyMacEvent(native_node_, event_type); | 798 NotifyMacEvent(native_node_, event_type); |
| 786 } | 799 } |
| 787 | 800 |
| 788 int AXPlatformNodeMac::GetIndexInParent() { | 801 int AXPlatformNodeMac::GetIndexInParent() { |
| 789 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 802 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
| 790 return -1; | 803 return -1; |
| 791 } | 804 } |
| 792 | 805 |
| 793 } // namespace ui | 806 } // namespace ui |
| OLD | NEW |