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

Side by Side Diff: Source/core/svg/SVGAElement.cpp

Issue 455223002: Make anchors mouse-focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_wasFocusedByMouse to elementData().m_shouldHideFocusRingOnMouseFocus Created 6 years, 3 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
« Source/core/dom/ElementData.h ('K') | « Source/core/svg/SVGAElement.h ('k') | 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) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2010 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 { 150 {
151 // Skip the supportsFocus check in SVGElement. 151 // Skip the supportsFocus check in SVGElement.
152 return Element::tabIndex(); 152 return Element::tabIndex();
153 } 153 }
154 154
155 bool SVGAElement::supportsFocus() const 155 bool SVGAElement::supportsFocus() const
156 { 156 {
157 if (hasEditableStyle()) 157 if (hasEditableStyle())
158 return SVGGraphicsElement::supportsFocus(); 158 return SVGGraphicsElement::supportsFocus();
159 // If not a link we should still be able to focus the element if it has tabI ndex. 159 // If not a link we should still be able to focus the element if it has tabI ndex.
160 return isLink() || Element::supportsFocus(); 160 return isLink() || SVGGraphicsElement::supportsFocus();
161 }
162
163 bool SVGAElement::shouldShowFocusRingOnMouseFocus() const
164 {
165 return SVGGraphicsElement::supportsFocus();
161 } 166 }
162 167
163 bool SVGAElement::isURLAttribute(const Attribute& attribute) const 168 bool SVGAElement::isURLAttribute(const Attribute& attribute) const
164 { 169 {
165 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL Attribute(attribute); 170 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL Attribute(attribute);
166 } 171 }
167 172
168 bool SVGAElement::isMouseFocusable() const 173 bool SVGAElement::isMouseFocusable() const
169 { 174 {
170 // Links are focusable by default, but only allow links with tabindex or con tenteditable to be mouse focusable.
171 // https://bugs.webkit.org/show_bug.cgi?id=26856
172 if (isLink()) 175 if (isLink())
173 return Element::supportsFocus(); 176 return supportsFocus();
174 177
175 return SVGElement::isMouseFocusable(); 178 return SVGElement::isMouseFocusable();
176 } 179 }
177 180
178 bool SVGAElement::isKeyboardFocusable() const 181 bool SVGAElement::isKeyboardFocusable() const
179 { 182 {
180 if (isFocusable() && Element::supportsFocus()) 183 if (isFocusable() && Element::supportsFocus())
181 return SVGElement::isKeyboardFocusable(); 184 return SVGElement::isKeyboardFocusable();
182 185
183 if (isLink()) 186 if (isLink())
184 return document().frameHost()->chrome().client().tabsToLinks(); 187 return document().frameHost()->chrome().client().tabsToLinks();
185 return SVGElement::isKeyboardFocusable(); 188 return SVGElement::isKeyboardFocusable();
186 } 189 }
187 190
188 bool SVGAElement::canStartSelection() const 191 bool SVGAElement::canStartSelection() const
189 { 192 {
190 if (!isLink()) 193 if (!isLink())
191 return SVGElement::canStartSelection(); 194 return SVGElement::canStartSelection();
192 return hasEditableStyle(); 195 return hasEditableStyle();
193 } 196 }
194 197
195 bool SVGAElement::willRespondToMouseClickEvents() 198 bool SVGAElement::willRespondToMouseClickEvents()
196 { 199 {
197 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); 200 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents();
198 } 201 }
199 202
200 } // namespace blink 203 } // namespace blink
OLDNEW
« Source/core/dom/ElementData.h ('K') | « Source/core/svg/SVGAElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698