| Index: ui/accessibility/platform/ax_platform_node_mac.mm
|
| diff --git a/ui/accessibility/platform/ax_platform_node_mac.mm b/ui/accessibility/platform/ax_platform_node_mac.mm
|
| index 62936942cb6eb03e7bf5a5d08d545c1d183d1ac8..ed2135ec33b1edc74ba53f980c864d7b646e5dde 100644
|
| --- a/ui/accessibility/platform/ax_platform_node_mac.mm
|
| +++ b/ui/accessibility/platform/ax_platform_node_mac.mm
|
| @@ -15,7 +15,10 @@
|
| #include "ui/accessibility/platform/ax_platform_node.h"
|
| #include "ui/accessibility/platform/ax_platform_node_delegate.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| +#include "ui/base/text/text_properties.h"
|
| +#include "ui/gfx/geometry/rect.h"
|
| #import "ui/gfx/mac/coordinate_conversion.h"
|
| +#include "ui/gfx/range/range.h"
|
| #include "ui/strings/grit/ui_strings.h"
|
|
|
| namespace {
|
| @@ -701,9 +704,19 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
|
|
|
| - (id)AXBoundsForRange:(id)parameter {
|
| DCHECK([parameter isKindOfClass:[NSValue class]]);
|
| - // TODO(tapted): Provide an accessor on AXPlatformNodeDelegate to obtain this
|
| - // from ui::TextInputClient::GetCompositionCharacterBounds().
|
| - NOTIMPLEMENTED();
|
| + if (ui::TextInputClient* text = node_->GetDelegate()->GetTextInputClient()) {
|
| + gfx::Range actualRange;
|
| + gfx::Rect rect = ui::GetFirstRectForTextInputRange(
|
| + text, gfx::Range([parameter rangeValue]), &actualRange);
|
| + // GetFirstRectForTextInputRange() can "fail", in which case it returns
|
| + // the caret bounds. That might be weird.
|
| + rect.set_width(30);
|
| + DLOG(INFO) << text << " -> " << actualRange.ToString() << " -> "
|
| + << rect.ToString();
|
| + return [NSValue valueWithRect:gfx::ScreenRectToNSRect(rect)];
|
| + } else {
|
| + DLOG(INFO) << "it null";
|
| + }
|
| return nil;
|
| }
|
|
|
|
|