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

Unified Diff: ui/accessibility/platform/ax_platform_node_mac.mm

Issue 2955073002: Manky attempt with TextInputClient
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_delegate.h ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_delegate.h ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698