| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/win/scoped_comptr.h" | 13 #include "base/win/scoped_comptr.h" |
| 14 #include "base/win/scoped_variant.h" | 14 #include "base/win/scoped_variant.h" |
| 15 #include "third_party/iaccessible2/ia2_api_all.h" | 15 #include "third_party/iaccessible2/ia2_api_all.h" |
| 16 #include "ui/accessibility/ax_node_data.h" | 16 #include "ui/accessibility/ax_node_data.h" |
| 17 #include "ui/accessibility/ax_text_utils.h" | 17 #include "ui/accessibility/ax_text_utils.h" |
| 18 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 18 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
| 19 #include "ui/accessibility/platform/ax_platform_node_win.h" | 19 #include "ui/accessibility/platform/ax_platform_node_win.h" |
| 20 #include "ui/base/win/atl_module.h" | 20 #include "ui/base/win/atl_module.h" |
| 21 #include "ui/gfx/geometry/rect_conversions.h" |
| 21 | 22 |
| 22 // | 23 // |
| 23 // Macros to use at the top of any AXPlatformNodeWin function that implements | 24 // Macros to use at the top of any AXPlatformNodeWin function that implements |
| 24 // a COM interface. Because COM objects are reference counted and clients | 25 // a COM interface. Because COM objects are reference counted and clients |
| 25 // are completely untrusted, it's important to always first check that our | 26 // are completely untrusted, it's important to always first check that our |
| 26 // object is still valid, and then check that all pointer arguments are | 27 // object is still valid, and then check that all pointer arguments are |
| 27 // not NULL. | 28 // not NULL. |
| 28 // | 29 // |
| 29 | 30 |
| 30 #define COM_OBJECT_VALIDATE() \ | 31 #define COM_OBJECT_VALIDATE() \ |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 251 |
| 251 HRESULT AXPlatformNodeWin::accDoDefaultAction(VARIANT var_id) { | 252 HRESULT AXPlatformNodeWin::accDoDefaultAction(VARIANT var_id) { |
| 252 COM_OBJECT_VALIDATE_VAR_ID(var_id); | 253 COM_OBJECT_VALIDATE_VAR_ID(var_id); |
| 253 delegate_->DoDefaultAction(); | 254 delegate_->DoDefaultAction(); |
| 254 return S_OK; | 255 return S_OK; |
| 255 } | 256 } |
| 256 | 257 |
| 257 STDMETHODIMP AXPlatformNodeWin::accLocation( | 258 STDMETHODIMP AXPlatformNodeWin::accLocation( |
| 258 LONG* x_left, LONG* y_top, LONG* width, LONG* height, VARIANT var_id) { | 259 LONG* x_left, LONG* y_top, LONG* width, LONG* height, VARIANT var_id) { |
| 259 COM_OBJECT_VALIDATE_VAR_ID_4_ARGS(var_id, x_left, y_top, width, height); | 260 COM_OBJECT_VALIDATE_VAR_ID_4_ARGS(var_id, x_left, y_top, width, height); |
| 260 gfx::Rect bounds = GetData().location; | 261 gfx::Rect bounds = gfx::ToEnclosingRect(GetData().location); |
| 261 bounds += delegate_->GetGlobalCoordinateOffset(); | 262 bounds += delegate_->GetGlobalCoordinateOffset(); |
| 262 *x_left = bounds.x(); | 263 *x_left = bounds.x(); |
| 263 *y_top = bounds.y(); | 264 *y_top = bounds.y(); |
| 264 *width = bounds.width(); | 265 *width = bounds.width(); |
| 265 *height = bounds.height(); | 266 *height = bounds.height(); |
| 266 | 267 |
| 267 if (bounds.IsEmpty()) | 268 if (bounds.IsEmpty()) |
| 268 return S_FALSE; | 269 return S_FALSE; |
| 269 | 270 |
| 270 return S_OK; | 271 return S_OK; |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 LONG start_offset, | 1143 LONG start_offset, |
| 1143 ui::TextBoundaryDirection direction) { | 1144 ui::TextBoundaryDirection direction) { |
| 1144 HandleSpecialTextOffset(text, &start_offset); | 1145 HandleSpecialTextOffset(text, &start_offset); |
| 1145 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 1146 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
| 1146 std::vector<int32_t> line_breaks; | 1147 std::vector<int32_t> line_breaks; |
| 1147 return static_cast<LONG>(ui::FindAccessibleTextBoundary( | 1148 return static_cast<LONG>(ui::FindAccessibleTextBoundary( |
| 1148 text, line_breaks, boundary, start_offset, direction)); | 1149 text, line_breaks, boundary, start_offset, direction)); |
| 1149 } | 1150 } |
| 1150 | 1151 |
| 1151 } // namespace ui | 1152 } // namespace ui |
| OLD | NEW |