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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 815573002: Spatial Navigation: Make non-SVG elements with event listener not focusable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 bool Element::supportsSpatialNavigationFocus() const 2210 bool Element::supportsSpatialNavigationFocus() const
2211 { 2211 {
2212 // This function checks whether the element satisfies the extended criteria 2212 // This function checks whether the element satisfies the extended criteria
2213 // for the element to be focusable, introduced by spatial navigation feature , 2213 // for the element to be focusable, introduced by spatial navigation feature ,
2214 // i.e. checks if click or keyboard event handler is specified. 2214 // i.e. checks if click or keyboard event handler is specified.
2215 // This is the way to make it possible to navigate to (focus) elements 2215 // This is the way to make it possible to navigate to (focus) elements
2216 // which web designer meant for being active (made them respond to click eve nts). 2216 // which web designer meant for being active (made them respond to click eve nts).
2217 2217
2218 if (!isSpatialNavigationEnabled(document().frame())) 2218 if (!isSpatialNavigationEnabled(document().frame()))
2219 return false; 2219 return false;
2220 if (hasEventListeners(EventTypeNames::click) 2220 if (!isSVGElement())
2221 return false;
2222 return hasEventListeners(EventTypeNames::click)
2221 || hasEventListeners(EventTypeNames::keydown) 2223 || hasEventListeners(EventTypeNames::keydown)
2222 || hasEventListeners(EventTypeNames::keypress) 2224 || hasEventListeners(EventTypeNames::keypress)
2223 || hasEventListeners(EventTypeNames::keyup)) 2225 || hasEventListeners(EventTypeNames::keyup)
2224 return true; 2226 || hasEventListeners(EventTypeNames::focus)
2225 if (!isSVGElement())
2226 return false;
2227 return (hasEventListeners(EventTypeNames::focus)
2228 || hasEventListeners(EventTypeNames::blur) 2227 || hasEventListeners(EventTypeNames::blur)
2229 || hasEventListeners(EventTypeNames::focusin) 2228 || hasEventListeners(EventTypeNames::focusin)
2230 || hasEventListeners(EventTypeNames::focusout)); 2229 || hasEventListeners(EventTypeNames::focusout);
2231 } 2230 }
2232 2231
2233 bool Element::isFocusable() const 2232 bool Element::isFocusable() const
2234 { 2233 {
2235 return inDocument() && supportsFocus() && !isInert() && rendererIsFocusable( ); 2234 return inDocument() && supportsFocus() && !isInert() && rendererIsFocusable( );
2236 } 2235 }
2237 2236
2238 bool Element::isKeyboardFocusable() const 2237 bool Element::isKeyboardFocusable() const
2239 { 2238 {
2240 return isFocusable() && tabIndex() >= 0; 2239 return isFocusable() && tabIndex() >= 0;
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 return wrapper; 3403 return wrapper;
3405 3404
3406 CustomElementBinding* binding = perContextData->customElementBinding(customE lementDefinition()); 3405 CustomElementBinding* binding = perContextData->customElementBinding(customE lementDefinition());
3407 3406
3408 wrapper->SetPrototype(binding->prototype()); 3407 wrapper->SetPrototype(binding->prototype());
3409 3408
3410 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper); 3409 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper);
3411 } 3410 }
3412 3411
3413 } // namespace blink 3412 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698