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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/accessibility/AXObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
index 090017264ba18ce12195f96f8bb0e5fac2064b7c..1671402dcd5fb2400ead7a92e9c4bf9a26b00e83 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -1351,14 +1351,25 @@ LayoutRect AXObject::getBoundsInFrameCoordinates() const {
// Modify or take an action on an object.
//
-bool AXObject::press() const {
- Element* actionElem = actionElement();
- if (!actionElem)
+bool AXObject::press() {
+ Document* document = getDocument();
+ if (!document)
return false;
- UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
- &actionElem->document(), UserGestureToken::NewGesture));
- actionElem->accessKeyAction(true);
- return true;
+
+ UserGestureIndicator gestureIndicator(
+ DocumentUserGestureToken::create(document, UserGestureToken::NewGesture));
+ Element* actionElem = actionElement();
+ if (actionElem) {
+ actionElem->accessKeyAction(true);
+ return true;
+ }
+
+ if (canSetFocusAttribute()) {
+ setFocused(true);
+ return true;
+ }
+
+ return false;
}
void AXObject::scrollToMakeVisible() const {

Powered by Google App Engine
This is Rietveld 408576698