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

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

Issue 2852763002: Added a system caret used for accessibility on Windows. (Closed)
Patch Set: Added a fake caret for accessibility. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_fake_caret_win.h" 5 #include "ui/accessibility/platform/ax_fake_caret_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/accessibility/ax_enums.h" 10 #include "ui/accessibility/ax_enums.h"
11 #include "ui/accessibility/platform/ax_platform_node_win.h" 11 #include "ui/accessibility/platform/ax_platform_node_win.h"
12 #include "ui/accessibility/platform/ax_platform_unique_id.h" 12 #include "ui/accessibility/platform/ax_platform_unique_id.h"
13 #include "ui/gfx/geometry/rect_conversions.h" 13 #include "ui/gfx/geometry/rect_conversions.h"
14 #include "ui/gfx/geometry/rect_f.h" 14 #include "ui/gfx/geometry/rect_f.h"
15 15
16 namespace ui { 16 namespace ui {
17 17
18 AXFakeCaretWin::AXFakeCaretWin(gfx::AcceleratedWidget event_target) 18 AXFakeCaretWin::AXFakeCaretWin(gfx::AcceleratedWidget event_target)
19 : event_target_(event_target) { 19 : event_target_(event_target) {
20 caret_ = static_cast<AXPlatformNodeWin*>(AXPlatformNodeWin::Create(this)); 20 caret_ = static_cast<AXPlatformNodeWin*>(AXPlatformNodeWin::Create(this));
21 data_.id = GetNextAXPlatformNodeUniqueId(); 21 data_.id = GetNextAXPlatformNodeUniqueId();
22 data_.role = AX_ROLE_CARET; 22 data_.role = AX_ROLE_CARET;
23 // |get_accState| should return 0 which means that the caret is visible.
23 data_.state = 0; 24 data_.state = 0;
24 data_.SetName(L"caret"); 25 // According to MSDN, "Edit" should be the name of the caret object.
26 data_.SetName(L"Edit");
25 data_.offset_container_id = -1; 27 data_.offset_container_id = -1;
26 } 28 }
27 29
28 AXFakeCaretWin::~AXFakeCaretWin() { 30 AXFakeCaretWin::~AXFakeCaretWin() {
29 caret_->Destroy(); 31 caret_->Destroy();
30 caret_ = nullptr; 32 caret_ = nullptr;
31 } 33 }
32 34
33 base::win::ScopedComPtr<IAccessible> AXFakeCaretWin::GetCaret() const { 35 base::win::ScopedComPtr<IAccessible> AXFakeCaretWin::GetCaret() const {
34 base::win::ScopedComPtr<IAccessible> caret_accessible; 36 base::win::ScopedComPtr<IAccessible> caret_accessible;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 99
98 bool AXFakeCaretWin::AccessibilityPerformAction(const ui::AXActionData& data) { 100 bool AXFakeCaretWin::AccessibilityPerformAction(const ui::AXActionData& data) {
99 return false; 101 return false;
100 } 102 }
101 103
102 bool AXFakeCaretWin::ShouldIgnoreHoveredStateForTesting() { 104 bool AXFakeCaretWin::ShouldIgnoreHoveredStateForTesting() {
103 return true; 105 return true;
104 } 106 }
105 107
106 } // namespace ui 108 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698