| 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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 // static | 1314 // static |
| 1315 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { | 1315 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { |
| 1316 return (abs(delta.x()) > GetHorizontalDragThreshold() || | 1316 return (abs(delta.x()) > GetHorizontalDragThreshold() || |
| 1317 abs(delta.y()) > GetVerticalDragThreshold()); | 1317 abs(delta.y()) > GetVerticalDragThreshold()); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 // Accessibility---------------------------------------------------------------- | 1320 // Accessibility---------------------------------------------------------------- |
| 1321 | 1321 |
| 1322 gfx::NativeViewAccessible View::GetNativeViewAccessible() { | 1322 NativeViewAccessibility* View::GetNativeViewAccessibility() { |
| 1323 if (!native_view_accessibility_) | 1323 if (!native_view_accessibility_) |
| 1324 native_view_accessibility_ = NativeViewAccessibility::Create(this); | 1324 native_view_accessibility_ = NativeViewAccessibility::Create(this); |
| 1325 if (native_view_accessibility_) | 1325 return native_view_accessibility_; |
| 1326 return native_view_accessibility_->GetNativeObject(); | 1326 } |
| 1327 return NULL; | 1327 |
| 1328 gfx::NativeViewAccessible View::GetNativeViewAccessible() { |
| 1329 if (GetNativeViewAccessibility()) |
| 1330 return GetNativeViewAccessibility()->GetNativeObject(); |
| 1331 return nullptr; |
| 1328 } | 1332 } |
| 1329 | 1333 |
| 1330 void View::NotifyAccessibilityEvent( | 1334 void View::NotifyAccessibilityEvent( |
| 1331 ui::AXEvent event_type, | 1335 ui::AXEvent event_type, |
| 1332 bool send_native_event) { | 1336 bool send_native_event) { |
| 1333 if (ViewsDelegate::GetInstance()) | 1337 if (ViewsDelegate::GetInstance()) |
| 1334 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type); | 1338 ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(this, event_type); |
| 1335 | 1339 |
| 1336 if (send_native_event && GetWidget()) { | 1340 if (send_native_event && GetWidget()) { |
| 1337 if (!native_view_accessibility_) | 1341 if (GetNativeViewAccessibility()) |
| 1338 native_view_accessibility_ = NativeViewAccessibility::Create(this); | 1342 GetNativeViewAccessibility()->NotifyAccessibilityEvent(event_type); |
| 1339 if (native_view_accessibility_) | |
| 1340 native_view_accessibility_->NotifyAccessibilityEvent(event_type); | |
| 1341 } | 1343 } |
| 1342 } | 1344 } |
| 1343 | 1345 |
| 1344 // Scrolling ------------------------------------------------------------------- | 1346 // Scrolling ------------------------------------------------------------------- |
| 1345 | 1347 |
| 1346 void View::ScrollRectToVisible(const gfx::Rect& rect) { | 1348 void View::ScrollRectToVisible(const gfx::Rect& rect) { |
| 1347 // We must take RTL UI mirroring into account when adjusting the position of | 1349 // We must take RTL UI mirroring into account when adjusting the position of |
| 1348 // the region. | 1350 // the region. |
| 1349 if (parent_) { | 1351 if (parent_) { |
| 1350 gfx::Rect scroll_rect(rect); | 1352 gfx::Rect scroll_rect(rect); |
| (...skipping 1067 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 |