| 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 #include "content/browser/accessibility/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 FixEmptyBounds(&bounds); | 368 FixEmptyBounds(&bounds); |
| 369 return RelativeToAbsoluteBounds(bounds, true); | 369 return RelativeToAbsoluteBounds(bounds, true); |
| 370 } | 370 } |
| 371 | 371 |
| 372 gfx::Rect BrowserAccessibility::GetPageBoundsRect() const { | 372 gfx::Rect BrowserAccessibility::GetPageBoundsRect() const { |
| 373 gfx::RectF bounds = GetLocation(); | 373 gfx::RectF bounds = GetLocation(); |
| 374 FixEmptyBounds(&bounds); | 374 FixEmptyBounds(&bounds); |
| 375 return RelativeToAbsoluteBounds(bounds, false); | 375 return RelativeToAbsoluteBounds(bounds, false); |
| 376 } | 376 } |
| 377 | 377 |
| 378 gfx::Rect BrowserAccessibility::GetScreenBoundsRect() const { | |
| 379 gfx::Rect bounds = GetPageBoundsRect(); | |
| 380 | |
| 381 // Adjust the bounds by the top left corner of the containing view's bounds | |
| 382 // in screen coordinates. | |
| 383 bounds.Offset(manager_->GetViewBounds().OffsetFromOrigin()); | |
| 384 | |
| 385 return bounds; | |
| 386 } | |
| 387 | |
| 388 gfx::Rect BrowserAccessibility::GetPageBoundsForRange(int start, int len) | 378 gfx::Rect BrowserAccessibility::GetPageBoundsForRange(int start, int len) |
| 389 const { | 379 const { |
| 390 DCHECK_GE(start, 0); | 380 DCHECK_GE(start, 0); |
| 391 DCHECK_GE(len, 0); | 381 DCHECK_GE(len, 0); |
| 392 | 382 |
| 393 // Standard text fields such as textarea have an embedded div inside them that | 383 // Standard text fields such as textarea have an embedded div inside them that |
| 394 // holds all the text. | 384 // holds all the text. |
| 395 // TODO(nektar): This is fragile! Replace with code that flattens tree. | 385 // TODO(nektar): This is fragile! Replace with code that flattens tree. |
| 396 if (IsSimpleTextControl() && InternalChildCount() == 1) | 386 if (IsSimpleTextControl() && InternalChildCount() == 1) |
| 397 return InternalGetChild(0)->GetPageBoundsForRange(start, len); | 387 return InternalGetChild(0)->GetPageBoundsForRange(start, len); |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 int BrowserAccessibility::GetChildCount() { | 1346 int BrowserAccessibility::GetChildCount() { |
| 1357 NOTREACHED(); | 1347 NOTREACHED(); |
| 1358 return -1; | 1348 return -1; |
| 1359 } | 1349 } |
| 1360 | 1350 |
| 1361 gfx::NativeViewAccessible BrowserAccessibility::ChildAtIndex(int index) { | 1351 gfx::NativeViewAccessible BrowserAccessibility::ChildAtIndex(int index) { |
| 1362 NOTREACHED(); | 1352 NOTREACHED(); |
| 1363 return nullptr; | 1353 return nullptr; |
| 1364 } | 1354 } |
| 1365 | 1355 |
| 1366 gfx::Vector2d BrowserAccessibility::GetGlobalCoordinateOffset() { | 1356 gfx::Rect BrowserAccessibility::GetScreenBoundsRect() const { |
| 1367 NOTREACHED(); | 1357 gfx::Rect bounds = GetPageBoundsRect(); |
| 1368 return gfx::Vector2d(); | 1358 |
| 1359 // Adjust the bounds by the top left corner of the containing view's bounds |
| 1360 // in screen coordinates. |
| 1361 bounds.Offset(manager_->GetViewBounds().OffsetFromOrigin()); |
| 1362 |
| 1363 return bounds; |
| 1369 } | 1364 } |
| 1370 | 1365 |
| 1371 gfx::NativeViewAccessible BrowserAccessibility::HitTestSync(int x, int y) { | 1366 gfx::NativeViewAccessible BrowserAccessibility::HitTestSync(int x, int y) { |
| 1372 NOTREACHED(); | 1367 NOTREACHED(); |
| 1373 return nullptr; | 1368 return nullptr; |
| 1374 } | 1369 } |
| 1375 | 1370 |
| 1376 gfx::NativeViewAccessible BrowserAccessibility::GetFocus() { | 1371 gfx::NativeViewAccessible BrowserAccessibility::GetFocus() { |
| 1377 NOTREACHED(); | 1372 NOTREACHED(); |
| 1378 return nullptr; | 1373 return nullptr; |
| 1379 } | 1374 } |
| 1380 | 1375 |
| 1381 gfx::AcceleratedWidget | 1376 gfx::AcceleratedWidget |
| 1382 BrowserAccessibility::GetTargetForNativeAccessibilityEvent() { | 1377 BrowserAccessibility::GetTargetForNativeAccessibilityEvent() { |
| 1383 NOTREACHED(); | 1378 NOTREACHED(); |
| 1384 return gfx::kNullAcceleratedWidget; | 1379 return gfx::kNullAcceleratedWidget; |
| 1385 } | 1380 } |
| 1386 | 1381 |
| 1387 bool BrowserAccessibility::AccessibilityPerformAction( | 1382 bool BrowserAccessibility::AccessibilityPerformAction( |
| 1388 const ui::AXActionData& data) { | 1383 const ui::AXActionData& data) { |
| 1389 NOTREACHED(); | 1384 NOTREACHED(); |
| 1390 return false; | 1385 return false; |
| 1391 } | 1386 } |
| 1392 | 1387 |
| 1393 } // namespace content | 1388 } // namespace content |
| OLD | NEW |