| OLD | NEW |
| 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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 // static | 1318 // static |
| 1319 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { | 1319 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { |
| 1320 return (abs(delta.x()) > GetHorizontalDragThreshold() || | 1320 return (abs(delta.x()) > GetHorizontalDragThreshold() || |
| 1321 abs(delta.y()) > GetVerticalDragThreshold()); | 1321 abs(delta.y()) > GetVerticalDragThreshold()); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 // Accessibility---------------------------------------------------------------- | 1324 // Accessibility---------------------------------------------------------------- |
| 1325 | 1325 |
| 1326 gfx::NativeViewAccessible View::GetNativeViewAccessible() { | 1326 NativeViewAccessibility* View::GetNativeViewAccessibility() { |
| 1327 if (!native_view_accessibility_) | 1327 if (!native_view_accessibility_) |
| 1328 native_view_accessibility_ = NativeViewAccessibility::Create(this); | 1328 native_view_accessibility_ = NativeViewAccessibility::Create(this); |
| 1329 if (native_view_accessibility_) | 1329 return native_view_accessibility_; |
| 1330 return native_view_accessibility_->GetNativeObject(); | 1330 } |
| 1331 return NULL; | 1331 |
| 1332 gfx::NativeViewAccessible View::GetNativeViewAccessible() { |
| 1333 if (GetNativeViewAccessibility()) |
| 1334 return GetNativeViewAccessibility()->GetNativeObject(); |
| 1335 return nullptr; |
| 1332 } | 1336 } |
| 1333 | 1337 |
| 1334 void View::NotifyAccessibilityEvent( | 1338 void View::NotifyAccessibilityEvent( |
| 1335 ui::AXEvent event_type, | 1339 ui::AXEvent event_type, |
| 1336 bool send_native_event) { | 1340 bool send_native_event) { |
| 1337 if (ViewsDelegate::GetInstance()) | 1341 if (ViewsDelegate::GetInstance()) |
| 1338 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type); | 1342 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type); |
| 1339 | 1343 |
| 1340 if (send_native_event && GetWidget()) { | 1344 if (send_native_event && GetWidget()) { |
| 1341 if (!native_view_accessibility_) | 1345 if (GetNativeViewAccessibility()) |
| 1342 native_view_accessibility_ = NativeViewAccessibility::Create(this); | 1346 GetNativeViewAccessibility()->NotifyAccessibilityEvent(event_type); |
| 1343 if (native_view_accessibility_) | |
| 1344 native_view_accessibility_->NotifyAccessibilityEvent(event_type); | |
| 1345 } | 1347 } |
| 1346 } | 1348 } |
| 1347 | 1349 |
| 1348 // Scrolling ------------------------------------------------------------------- | 1350 // Scrolling ------------------------------------------------------------------- |
| 1349 | 1351 |
| 1350 void View::ScrollRectToVisible(const gfx::Rect& rect) { | 1352 void View::ScrollRectToVisible(const gfx::Rect& rect) { |
| 1351 // We must take RTL UI mirroring into account when adjusting the position of | 1353 // We must take RTL UI mirroring into account when adjusting the position of |
| 1352 // the region. | 1354 // the region. |
| 1353 if (parent_) { | 1355 if (parent_) { |
| 1354 gfx::Rect scroll_rect(rect); | 1356 gfx::Rect scroll_rect(rect); |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2418 // Message the RootView to do the drag and drop. That way if we're removed | 2420 // Message the RootView to do the drag and drop. That way if we're removed |
| 2419 // the RootView can detect it and avoid calling us back. | 2421 // the RootView can detect it and avoid calling us back. |
| 2420 gfx::Point widget_location(event.location()); | 2422 gfx::Point widget_location(event.location()); |
| 2421 ConvertPointToWidget(this, &widget_location); | 2423 ConvertPointToWidget(this, &widget_location); |
| 2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2423 // WARNING: we may have been deleted. | 2425 // WARNING: we may have been deleted. |
| 2424 return true; | 2426 return true; |
| 2425 } | 2427 } |
| 2426 | 2428 |
| 2427 } // namespace views | 2429 } // namespace views |
| OLD | NEW |