Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/accessibility/platform/ax_fake_caret_win.h" | |
| 6 | |
| 7 #include "ui/accessibility/ax_enums.h" | |
| 8 #include "ui/accessibility/platform/ax_platform_node_win.h" | |
| 9 #include "ui/gfx/geometry/rect_conversions.h" | |
| 10 #include "ui/gfx/geometry/rect_f.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 | |
| 14 AXFakeCaretWin::AXFakeCaretWin() { | |
| 15 caret_ = static_cast<AXPlatformNodeWin*>(AXPlatformNodeWin::Create(this)); | |
| 16 data_.id = 0; | |
| 17 data_.role = AX_ROLE_DIV; | |
|
dmazzoni
2017/04/17 05:07:35
We should create AX_ROLE_CARET and map it to ROLE_
| |
| 18 data_.state = 0; | |
| 19 data_.SetName(L"caret"); | |
| 20 data_.offset_container_id = -1; | |
| 21 } | |
| 22 | |
| 23 AXFakeCaretWin::~AXFakeCaretWin() { | |
| 24 caret_->Destroy(); | |
| 25 caret_ = nullptr; | |
| 26 } | |
| 27 | |
| 28 base::win::ScopedComPtr<IAccessible> AXFakeCaretWin::GetCaret() const { | |
| 29 base::win::ScopedComPtr<IAccessible> caret_accessible; | |
|
dmazzoni
2017/04/17 05:07:35
I don't think you need this. Just call caret_->Get
| |
| 30 HRESULT hr = caret_->QueryInterface( | |
| 31 IID_IAccessible, reinterpret_cast<void**>(caret_accessible.Receive())); | |
| 32 DCHECK(SUCCEEDED(hr)); | |
| 33 return caret_accessible; | |
| 34 } | |
| 35 | |
| 36 void AXFakeCaretWin::SetBounds(gfx::Rect bounds) { | |
| 37 caret_->Lock(); | |
|
dmazzoni
2017/04/17 05:07:35
Why are you locking / unlocking? It's not clear wh
| |
| 38 data_.location = gfx::RectF(bounds); | |
| 39 caret_->Unlock(); | |
| 40 } | |
| 41 | |
| 42 const AXNodeData& AXFakeCaretWin::GetData() const { | |
| 43 return data_; | |
| 44 } | |
| 45 | |
| 46 gfx::NativeWindow AXFakeCaretWin::GetTopLevelWidget() { | |
| 47 return nullptr; | |
| 48 } | |
| 49 | |
| 50 gfx::NativeViewAccessible AXFakeCaretWin::GetParent() { | |
| 51 return nullptr; | |
| 52 } | |
| 53 | |
| 54 int AXFakeCaretWin::GetChildCount() { | |
| 55 return 0; | |
| 56 } | |
| 57 | |
| 58 gfx::NativeViewAccessible AXFakeCaretWin::ChildAtIndex(int index) { | |
| 59 return nullptr; | |
| 60 } | |
| 61 | |
| 62 gfx::Rect AXFakeCaretWin::GetScreenBoundsRect() const { | |
| 63 caret_->Lock(); | |
| 64 gfx::Rect bounds = ToEnclosingRect(data_.location); | |
| 65 caret_->Unlock(); | |
| 66 return bounds; | |
| 67 } | |
| 68 | |
| 69 gfx::NativeViewAccessible AXFakeCaretWin::HitTestSync(int x, int y) { | |
| 70 return nullptr; | |
| 71 } | |
| 72 | |
| 73 gfx::NativeViewAccessible AXFakeCaretWin::GetFocus() { | |
| 74 return nullptr; | |
| 75 } | |
| 76 | |
| 77 gfx::AcceleratedWidget AXFakeCaretWin::GetTargetForNativeAccessibilityEvent() { | |
| 78 return gfx::kNullAcceleratedWidget; | |
| 79 } | |
| 80 | |
| 81 bool AXFakeCaretWin::AccessibilityPerformAction(const ui::AXActionData& data) { | |
| 82 return false; | |
| 83 } | |
| 84 | |
| 85 } // namespace ui | |
| OLD | NEW |