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

Side by Side Diff: Source/core/html/HTMLAnchorElement.cpp

Issue 15238002: Disallow tabsToLinks setting to prevent tabbing to anchor with tabIndex. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests update Created 7 years, 7 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) 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) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (isLink()) 130 if (isLink())
131 // Only allow links with tabIndex or contentEditable to be mouse focusab le. 131 // Only allow links with tabIndex or contentEditable to be mouse focusab le.
132 return HTMLElement::supportsFocus(); 132 return HTMLElement::supportsFocus();
133 133
134 // Allow tab index etc to control focus. 134 // Allow tab index etc to control focus.
135 return HTMLElement::isMouseFocusable(); 135 return HTMLElement::isMouseFocusable();
136 } 136 }
137 137
138 bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const 138 bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
139 { 139 {
140 if (!isLink()) 140 if (!isFocusable())
141 return false;
142
143 // If tab index set explicitly, decide focus regardless of the tabsToLinks s etting.
dmazzoni 2013/08/01 21:48:15 Well, technically you're also skipping the test th
rchl 2013/08/20 17:58:10 I can't say for sure but the first "!isLink()" con
144 if (Element::supportsFocus())
141 return HTMLElement::isKeyboardFocusable(event); 145 return HTMLElement::isKeyboardFocusable(event);
142 146
143 if (!isFocusable())
144 return false;
145
146 Page* page = document()->page(); 147 Page* page = document()->page();
147 if (!page) 148 if (!page)
148 return false; 149 return false;
149 150
150 if (!page->chrome()->client()->tabsToLinks()) 151 if (!page->chrome()->client()->tabsToLinks())
151 return false; 152 return false;
152 153
153 if (isInCanvasSubtree()) 154 if (isInCanvasSubtree())
154 return true; 155 return true;
155 156
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 HistogramSupport::histogramCustomCounts("MouseEventPrefetch.TapDownDurat ion_Click", tapDownDuration * 1000, 0, 10000, 100); 748 HistogramSupport::histogramCustomCounts("MouseEventPrefetch.TapDownDurat ion_Click", tapDownDuration * 1000, 0, 10000, 100);
748 } 749 }
749 750
750 int flags = (m_hadTapUnconfirmed ? 2 : 0) | (capturedTapDown ? 1 : 0); 751 int flags = (m_hadTapUnconfirmed ? 2 : 0) | (capturedTapDown ? 1 : 0);
751 HistogramSupport::histogramEnumeration("MouseEventPrefetch.PreTapEventsFollo wedByClick", flags, 4); 752 HistogramSupport::histogramEnumeration("MouseEventPrefetch.PreTapEventsFollo wedByClick", flags, 4);
752 753
753 reset(); 754 reset();
754 } 755 }
755 756
756 } 757 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698