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

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

Issue 166163005: [SVG2] Add tabindex handling in svg. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make SVGElement::supportsFocus return false Created 6 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
« no previous file with comments | « Source/core/svg/SVGAElement.h ('k') | Source/core/svg/SVGCircleElement.h » ('j') | 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 13 matching lines...) Expand all
24 24
25 #include "core/svg/SVGAElement.h" 25 #include "core/svg/SVGAElement.h"
26 26
27 #include "SVGNames.h" 27 #include "SVGNames.h"
28 #include "XLinkNames.h" 28 #include "XLinkNames.h"
29 #include "core/dom/Attr.h" 29 #include "core/dom/Attr.h"
30 #include "core/dom/Attribute.h" 30 #include "core/dom/Attribute.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/events/KeyboardEvent.h" 32 #include "core/events/KeyboardEvent.h"
33 #include "core/events/MouseEvent.h" 33 #include "core/events/MouseEvent.h"
34 #include "core/frame/FrameHost.h"
34 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
35 #include "core/html/HTMLAnchorElement.h" 36 #include "core/html/HTMLAnchorElement.h"
36 #include "core/html/HTMLFormElement.h" 37 #include "core/html/HTMLFormElement.h"
37 #include "core/html/parser/HTMLParserIdioms.h" 38 #include "core/html/parser/HTMLParserIdioms.h"
38 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
39 #include "core/loader/FrameLoader.h" 40 #include "core/loader/FrameLoader.h"
40 #include "core/loader/FrameLoaderTypes.h" 41 #include "core/loader/FrameLoaderTypes.h"
41 #include "core/page/Chrome.h" 42 #include "core/page/Chrome.h"
42 #include "core/page/ChromeClient.h" 43 #include "core/page/ChromeClient.h"
43 #include "core/page/Page.h" 44 #include "core/page/Page.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 FrameLoadRequest frameRequest(&document(), ResourceRequest(document( ).completeURL(url)), target); 168 FrameLoadRequest frameRequest(&document(), ResourceRequest(document( ).completeURL(url)), target);
168 frameRequest.setTriggeringEvent(event); 169 frameRequest.setTriggeringEvent(event);
169 frame->loader().load(frameRequest); 170 frame->loader().load(frameRequest);
170 return; 171 return;
171 } 172 }
172 } 173 }
173 174
174 SVGGraphicsElement::defaultEventHandler(event); 175 SVGGraphicsElement::defaultEventHandler(event);
175 } 176 }
176 177
178 short SVGAElement::tabIndex() const
179 {
180 // Skip the supportsFocus check in SVGElement.
181 return Element::tabIndex();
182 }
183
177 bool SVGAElement::supportsFocus() const 184 bool SVGAElement::supportsFocus() const
178 { 185 {
179 if (rendererIsEditable()) 186 if (rendererIsEditable())
180 return SVGGraphicsElement::supportsFocus(); 187 return SVGGraphicsElement::supportsFocus();
181 return true; 188 // If not a link we should still be able to focus the element if it has tabI ndex.
189 return isLink() || Element::supportsFocus();
182 } 190 }
183 191
184 bool SVGAElement::isURLAttribute(const Attribute& attribute) const 192 bool SVGAElement::isURLAttribute(const Attribute& attribute) const
185 { 193 {
186 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL Attribute(attribute); 194 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL Attribute(attribute);
187 } 195 }
188 196
189 bool SVGAElement::isMouseFocusable() const 197 bool SVGAElement::isMouseFocusable() const
190 { 198 {
191 return false; 199 // Links are focusable by default, but only allow links with tabindex or con tenteditable to be mouse focusable.
200 // https://bugs.webkit.org/show_bug.cgi?id=26856
201 if (isLink())
202 return SVGElement::supportsFocus();
fs 2014/04/29 12:30:16 Nit: Element::supportsFocus?
203
204 return SVGElement::isMouseFocusable();
192 } 205 }
193 206
194 bool SVGAElement::isKeyboardFocusable() const 207 bool SVGAElement::isKeyboardFocusable() const
195 { 208 {
196 if (!isFocusable()) 209 if (isFocusable() && Element::supportsFocus())
197 return false; 210 return SVGElement::isKeyboardFocusable();
198 211
199 if (Page* page = document().page()) 212 if (isLink())
200 return page->chrome().client().tabsToLinks(); 213 return document().frameHost()->chrome().client().tabsToLinks();
201 return false; 214 return SVGElement::isKeyboardFocusable();
215 }
216
217 bool SVGAElement::canStartSelection() const
218 {
219 if (!isLink())
220 return SVGElement::canStartSelection();
221 return rendererIsEditable();
202 } 222 }
203 223
204 bool SVGAElement::willRespondToMouseClickEvents() 224 bool SVGAElement::willRespondToMouseClickEvents()
205 { 225 {
206 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); 226 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents();
207 } 227 }
208 228
209 } // namespace WebCore 229 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAElement.h ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698