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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 2772913003: AXObject::performDefaultAction() should focus if it can't click (Closed)
Patch Set: Add test Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 } 1344 }
1345 container->getRelativeBounds(&container, bounds, transform); 1345 container->getRelativeBounds(&container, bounds, transform);
1346 } 1346 }
1347 return LayoutRect(computedBounds); 1347 return LayoutRect(computedBounds);
1348 } 1348 }
1349 1349
1350 // 1350 //
1351 // Modify or take an action on an object. 1351 // Modify or take an action on an object.
1352 // 1352 //
1353 1353
1354 bool AXObject::press() const { 1354 bool AXObject::press() {
1355 Document* document = getDocument();
1356 if (!document)
1357 return false;
1358
1359 UserGestureIndicator gestureIndicator(
1360 DocumentUserGestureToken::create(document, UserGestureToken::NewGesture));
1355 Element* actionElem = actionElement(); 1361 Element* actionElem = actionElement();
1356 if (!actionElem) 1362 if (actionElem) {
1357 return false; 1363 actionElem->accessKeyAction(true);
1358 UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create( 1364 return true;
1359 &actionElem->document(), UserGestureToken::NewGesture)); 1365 }
1360 actionElem->accessKeyAction(true); 1366
1361 return true; 1367 if (canSetFocusAttribute()) {
1368 setFocused(true);
1369 return true;
1370 }
1371
1372 return false;
1362 } 1373 }
1363 1374
1364 void AXObject::scrollToMakeVisible() const { 1375 void AXObject::scrollToMakeVisible() const {
1365 IntRect objectRect = pixelSnappedIntRect(getBoundsInFrameCoordinates()); 1376 IntRect objectRect = pixelSnappedIntRect(getBoundsInFrameCoordinates());
1366 objectRect.setLocation(IntPoint()); 1377 objectRect.setLocation(IntPoint());
1367 scrollToMakeVisibleWithSubFocus(objectRect); 1378 scrollToMakeVisibleWithSubFocus(objectRect);
1368 } 1379 }
1369 1380
1370 // This is a 1-dimensional scroll offset helper function that's applied 1381 // This is a 1-dimensional scroll offset helper function that's applied
1371 // separately in the horizontal and vertical directions, because the 1382 // separately in the horizontal and vertical directions, because the
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 } 1773 }
1763 1774
1764 DEFINE_TRACE(AXObject) { 1775 DEFINE_TRACE(AXObject) {
1765 visitor->trace(m_children); 1776 visitor->trace(m_children);
1766 visitor->trace(m_parent); 1777 visitor->trace(m_parent);
1767 visitor->trace(m_cachedLiveRegionRoot); 1778 visitor->trace(m_cachedLiveRegionRoot);
1768 visitor->trace(m_axObjectCache); 1779 visitor->trace(m_axObjectCache);
1769 } 1780 }
1770 1781
1771 } // namespace blink 1782 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698