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

Side by Side Diff: content/browser/accessibility/browser_accessibility.cc

Issue 2795543002: Add GetScreenBoundsRect to ui::AXPlatformNodeDelegate (Closed)
Patch Set: Remove GetGlobalCoordinateOffset Created 3 years, 8 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
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 #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 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 FixEmptyBounds(&bounds); 367 FixEmptyBounds(&bounds);
368 return RelativeToAbsoluteBounds(bounds, true); 368 return RelativeToAbsoluteBounds(bounds, true);
369 } 369 }
370 370
371 gfx::Rect BrowserAccessibility::GetPageBoundsRect() const { 371 gfx::Rect BrowserAccessibility::GetPageBoundsRect() const {
372 gfx::RectF bounds = GetLocation(); 372 gfx::RectF bounds = GetLocation();
373 FixEmptyBounds(&bounds); 373 FixEmptyBounds(&bounds);
374 return RelativeToAbsoluteBounds(bounds, false); 374 return RelativeToAbsoluteBounds(bounds, false);
375 } 375 }
376 376
377 gfx::Rect BrowserAccessibility::GetScreenBoundsRect() const {
378 gfx::Rect bounds = GetPageBoundsRect();
379
380 // Adjust the bounds by the top left corner of the containing view's bounds
381 // in screen coordinates.
382 bounds.Offset(manager_->GetViewBounds().OffsetFromOrigin());
383
384 return bounds;
385 }
386
387 gfx::Rect BrowserAccessibility::GetPageBoundsForRange(int start, int len) 377 gfx::Rect BrowserAccessibility::GetPageBoundsForRange(int start, int len)
388 const { 378 const {
389 DCHECK_GE(start, 0); 379 DCHECK_GE(start, 0);
390 DCHECK_GE(len, 0); 380 DCHECK_GE(len, 0);
391 381
392 // Standard text fields such as textarea have an embedded div inside them that 382 // Standard text fields such as textarea have an embedded div inside them that
393 // holds all the text. 383 // holds all the text.
394 // TODO(nektar): This is fragile! Replace with code that flattens tree. 384 // TODO(nektar): This is fragile! Replace with code that flattens tree.
395 if (IsSimpleTextControl() && InternalChildCount() == 1) 385 if (IsSimpleTextControl() && InternalChildCount() == 1)
396 return InternalGetChild(0)->GetPageBoundsForRange(start, len); 386 return InternalGetChild(0)->GetPageBoundsForRange(start, len);
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 int BrowserAccessibility::GetChildCount() { 1237 int BrowserAccessibility::GetChildCount() {
1248 NOTREACHED(); 1238 NOTREACHED();
1249 return -1; 1239 return -1;
1250 } 1240 }
1251 1241
1252 gfx::NativeViewAccessible BrowserAccessibility::ChildAtIndex(int index) { 1242 gfx::NativeViewAccessible BrowserAccessibility::ChildAtIndex(int index) {
1253 NOTREACHED(); 1243 NOTREACHED();
1254 return nullptr; 1244 return nullptr;
1255 } 1245 }
1256 1246
1257 gfx::Vector2d BrowserAccessibility::GetGlobalCoordinateOffset() { 1247 gfx::Rect BrowserAccessibility::GetScreenBoundsRect() const {
1258 NOTREACHED(); 1248 gfx::Rect bounds = GetPageBoundsRect();
1259 return gfx::Vector2d(); 1249
1250 // Adjust the bounds by the top left corner of the containing view's bounds
1251 // in screen coordinates.
1252 bounds.Offset(manager_->GetViewBounds().OffsetFromOrigin());
1253
1254 return bounds;
1260 } 1255 }
1261 1256
1262 gfx::NativeViewAccessible BrowserAccessibility::HitTestSync(int x, int y) { 1257 gfx::NativeViewAccessible BrowserAccessibility::HitTestSync(int x, int y) {
1263 NOTREACHED(); 1258 NOTREACHED();
1264 return nullptr; 1259 return nullptr;
1265 } 1260 }
1266 1261
1267 gfx::NativeViewAccessible BrowserAccessibility::GetFocus() { 1262 gfx::NativeViewAccessible BrowserAccessibility::GetFocus() {
1268 NOTREACHED(); 1263 NOTREACHED();
1269 return nullptr; 1264 return nullptr;
1270 } 1265 }
1271 1266
1272 gfx::AcceleratedWidget 1267 gfx::AcceleratedWidget
1273 BrowserAccessibility::GetTargetForNativeAccessibilityEvent() { 1268 BrowserAccessibility::GetTargetForNativeAccessibilityEvent() {
1274 NOTREACHED(); 1269 NOTREACHED();
1275 return gfx::kNullAcceleratedWidget; 1270 return gfx::kNullAcceleratedWidget;
1276 } 1271 }
1277 1272
1278 bool BrowserAccessibility::AccessibilityPerformAction( 1273 bool BrowserAccessibility::AccessibilityPerformAction(
1279 const ui::AXActionData& data) { 1274 const ui::AXActionData& data) {
1280 NOTREACHED(); 1275 NOTREACHED();
1281 return false; 1276 return false;
1282 } 1277 }
1283 1278
1284 void BrowserAccessibility::DoDefaultAction() { 1279 void BrowserAccessibility::DoDefaultAction() {
1285 NOTREACHED(); 1280 NOTREACHED();
1286 } 1281 }
1287 1282
1288 } // namespace content 1283 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698