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

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: De-duplicate using FocusController; update TestExpectations Created 6 years, 4 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) 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 23 matching lines...) Expand all
34 #include "core/frame/FrameHost.h" 34 #include "core/frame/FrameHost.h"
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/html/HTMLAnchorElement.h" 36 #include "core/html/HTMLAnchorElement.h"
37 #include "core/html/HTMLFormElement.h" 37 #include "core/html/HTMLFormElement.h"
38 #include "core/html/parser/HTMLParserIdioms.h" 38 #include "core/html/parser/HTMLParserIdioms.h"
39 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
40 #include "core/loader/FrameLoader.h" 40 #include "core/loader/FrameLoader.h"
41 #include "core/loader/FrameLoaderTypes.h" 41 #include "core/loader/FrameLoaderTypes.h"
42 #include "core/page/Chrome.h" 42 #include "core/page/Chrome.h"
43 #include "core/page/ChromeClient.h" 43 #include "core/page/ChromeClient.h"
44 #include "core/page/FocusController.h"
44 #include "core/page/Page.h" 45 #include "core/page/Page.h"
45 #include "core/rendering/svg/RenderSVGInline.h" 46 #include "core/rendering/svg/RenderSVGInline.h"
46 #include "core/rendering/svg/RenderSVGText.h" 47 #include "core/rendering/svg/RenderSVGText.h"
47 #include "core/rendering/svg/RenderSVGTransformableContainer.h" 48 #include "core/rendering/svg/RenderSVGTransformableContainer.h"
48 #include "core/svg/animation/SVGSMILElement.h" 49 #include "core/svg/animation/SVGSMILElement.h"
49 #include "platform/PlatformMouseEvent.h" 50 #include "platform/PlatformMouseEvent.h"
50 #include "platform/network/ResourceRequest.h" 51 #include "platform/network/ResourceRequest.h"
51 52
52 namespace blink { 53 namespace blink {
53 54
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 { 151 {
151 // Skip the supportsFocus check in SVGElement. 152 // Skip the supportsFocus check in SVGElement.
152 return Element::tabIndex(); 153 return Element::tabIndex();
153 } 154 }
154 155
155 bool SVGAElement::supportsFocus() const 156 bool SVGAElement::supportsFocus() const
156 { 157 {
157 if (hasEditableStyle()) 158 if (hasEditableStyle())
158 return SVGGraphicsElement::supportsFocus(); 159 return SVGGraphicsElement::supportsFocus();
159 // If not a link we should still be able to focus the element if it has tabI ndex. 160 // If not a link we should still be able to focus the element if it has tabI ndex.
160 return isLink() || Element::supportsFocus(); 161 return isLink() || SVGGraphicsElement::supportsFocus();
162 }
163
164 bool SVGAElement::shouldHaveFocusAppearance() const
165 {
166 ASSERT(focused());
167 return !document().page()->focusController().wasFocusedByMouse() || SVGGraph icsElement::supportsFocus();
pdr. 2014/08/12 02:02:23 Why is this SVGGraphicsElement::supportsFocus inst
robwu 2014/08/12 14:27:49 I noticed that the HTMLAnchorElement refers to HTM
161 } 168 }
162 169
163 bool SVGAElement::isURLAttribute(const Attribute& attribute) const 170 bool SVGAElement::isURLAttribute(const Attribute& attribute) const
164 { 171 {
165 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL Attribute(attribute); 172 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL Attribute(attribute);
166 } 173 }
167 174
168 bool SVGAElement::isMouseFocusable() const 175 bool SVGAElement::isMouseFocusable() const
169 { 176 {
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()) 177 if (isLink())
173 return Element::supportsFocus(); 178 return supportsFocus();
174 179
175 return SVGElement::isMouseFocusable(); 180 return SVGElement::isMouseFocusable();
176 } 181 }
177 182
178 bool SVGAElement::isKeyboardFocusable() const 183 bool SVGAElement::isKeyboardFocusable() const
179 { 184 {
180 if (isFocusable() && Element::supportsFocus()) 185 if (isFocusable() && Element::supportsFocus())
181 return SVGElement::isKeyboardFocusable(); 186 return SVGElement::isKeyboardFocusable();
182 187
183 if (isLink()) 188 if (isLink())
184 return document().frameHost()->chrome().client().tabsToLinks(); 189 return document().frameHost()->chrome().client().tabsToLinks();
185 return SVGElement::isKeyboardFocusable(); 190 return SVGElement::isKeyboardFocusable();
186 } 191 }
187 192
188 bool SVGAElement::canStartSelection() const 193 bool SVGAElement::canStartSelection() const
189 { 194 {
190 if (!isLink()) 195 if (!isLink())
191 return SVGElement::canStartSelection(); 196 return SVGElement::canStartSelection();
192 return hasEditableStyle(); 197 return hasEditableStyle();
193 } 198 }
194 199
195 bool SVGAElement::willRespondToMouseClickEvents() 200 bool SVGAElement::willRespondToMouseClickEvents()
196 { 201 {
197 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); 202 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents();
198 } 203 }
199 204
200 } // namespace blink 205 } // namespace blink
OLDNEW
« Source/core/page/FocusController.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