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

Side by Side Diff: ui/views/view.cc

Issue 2210763002: MacViews a11y: Sync VoiceOver cursor with keyboard focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move accessibilityFocusedUIElement from BrowserCrApplication to BridgedContentView. Created 4 years, 4 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
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 } 1314 }
1315 1315
1316 // static 1316 // static
1317 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { 1317 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) {
1318 return (abs(delta.x()) > GetHorizontalDragThreshold() || 1318 return (abs(delta.x()) > GetHorizontalDragThreshold() ||
1319 abs(delta.y()) > GetVerticalDragThreshold()); 1319 abs(delta.y()) > GetVerticalDragThreshold());
1320 } 1320 }
1321 1321
1322 // Accessibility---------------------------------------------------------------- 1322 // Accessibility----------------------------------------------------------------
1323 1323
1324 gfx::NativeViewAccessible View::GetNativeViewAccessible() { 1324 NativeViewAccessibility* View::GetNativeViewAccessibility() {
1325 if (!native_view_accessibility_) 1325 if (!native_view_accessibility_)
1326 native_view_accessibility_ = NativeViewAccessibility::Create(this); 1326 native_view_accessibility_ = NativeViewAccessibility::Create(this);
1327 if (native_view_accessibility_) 1327 return native_view_accessibility_;
1328 return native_view_accessibility_->GetNativeObject(); 1328 }
1329 return NULL; 1329
1330 gfx::NativeViewAccessible View::GetNativeViewAccessible() {
1331 if (GetNativeViewAccessibility())
1332 return GetNativeViewAccessibility()->GetNativeObject();
1333 return nullptr;
1330 } 1334 }
1331 1335
1332 void View::NotifyAccessibilityEvent( 1336 void View::NotifyAccessibilityEvent(
1333 ui::AXEvent event_type, 1337 ui::AXEvent event_type,
1334 bool send_native_event) { 1338 bool send_native_event) {
1335 if (ViewsDelegate::GetInstance()) 1339 if (ViewsDelegate::GetInstance())
1336 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type); 1340 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type);
1337 1341
1338 if (send_native_event && GetWidget()) { 1342 if (send_native_event && GetWidget()) {
1339 if (!native_view_accessibility_) 1343 if (GetNativeViewAccessibility())
1340 native_view_accessibility_ = NativeViewAccessibility::Create(this); 1344 GetNativeViewAccessibility()->NotifyAccessibilityEvent(event_type);
1341 if (native_view_accessibility_)
1342 native_view_accessibility_->NotifyAccessibilityEvent(event_type);
1343 } 1345 }
1344 } 1346 }
1345 1347
1346 // Scrolling ------------------------------------------------------------------- 1348 // Scrolling -------------------------------------------------------------------
1347 1349
1348 void View::ScrollRectToVisible(const gfx::Rect& rect) { 1350 void View::ScrollRectToVisible(const gfx::Rect& rect) {
1349 // We must take RTL UI mirroring into account when adjusting the position of 1351 // We must take RTL UI mirroring into account when adjusting the position of
1350 // the region. 1352 // the region.
1351 if (parent_) { 1353 if (parent_) {
1352 gfx::Rect scroll_rect(rect); 1354 gfx::Rect scroll_rect(rect);
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 // Message the RootView to do the drag and drop. That way if we're removed 2422 // Message the RootView to do the drag and drop. That way if we're removed
2421 // the RootView can detect it and avoid calling us back. 2423 // the RootView can detect it and avoid calling us back.
2422 gfx::Point widget_location(event.location()); 2424 gfx::Point widget_location(event.location());
2423 ConvertPointToWidget(this, &widget_location); 2425 ConvertPointToWidget(this, &widget_location);
2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2426 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2425 // WARNING: we may have been deleted. 2427 // WARNING: we may have been deleted.
2426 return true; 2428 return true;
2427 } 2429 }
2428 2430
2429 } // namespace views 2431 } // namespace views
OLDNEW
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698