| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 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/events/ThreadLocalEventNames.h" | 34 #include "core/events/ThreadLocalEventNames.h" |
| 35 #include "core/frame/FrameHost.h" |
| 35 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 36 #include "core/html/HTMLAnchorElement.h" | 37 #include "core/html/HTMLAnchorElement.h" |
| 37 #include "core/html/HTMLFormElement.h" | 38 #include "core/html/HTMLFormElement.h" |
| 38 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
| 39 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
| 40 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
| 41 #include "core/loader/FrameLoaderTypes.h" | 42 #include "core/loader/FrameLoaderTypes.h" |
| 42 #include "core/page/Chrome.h" | 43 #include "core/page/Chrome.h" |
| 43 #include "core/page/ChromeClient.h" | 44 #include "core/page/ChromeClient.h" |
| 44 #include "core/page/Page.h" | 45 #include "core/page/Page.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 FrameLoadRequest frameRequest(&document(), ResourceRequest(document(
).completeURL(url)), target); | 172 FrameLoadRequest frameRequest(&document(), ResourceRequest(document(
).completeURL(url)), target); |
| 172 frameRequest.setTriggeringEvent(event); | 173 frameRequest.setTriggeringEvent(event); |
| 173 frame->loader().load(frameRequest); | 174 frame->loader().load(frameRequest); |
| 174 return; | 175 return; |
| 175 } | 176 } |
| 176 } | 177 } |
| 177 | 178 |
| 178 SVGGraphicsElement::defaultEventHandler(event); | 179 SVGGraphicsElement::defaultEventHandler(event); |
| 179 } | 180 } |
| 180 | 181 |
| 182 short SVGAElement::tabIndex() const |
| 183 { |
| 184 // Skip the supportsFocus check in SVGElement. |
| 185 return Element::tabIndex(); |
| 186 } |
| 187 |
| 181 bool SVGAElement::supportsFocus() const | 188 bool SVGAElement::supportsFocus() const |
| 182 { | 189 { |
| 183 if (rendererIsEditable()) | 190 if (rendererIsEditable()) |
| 184 return SVGGraphicsElement::supportsFocus(); | 191 return SVGGraphicsElement::supportsFocus(); |
| 185 return true; | 192 // If not a link we should still be able to focus the element if it has tabI
ndex. |
| 193 return isLink() || SVGElement::supportsFocus(); |
| 186 } | 194 } |
| 187 | 195 |
| 188 bool SVGAElement::isURLAttribute(const Attribute& attribute) const | 196 bool SVGAElement::isURLAttribute(const Attribute& attribute) const |
| 189 { | 197 { |
| 190 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL
Attribute(attribute); | 198 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL
Attribute(attribute); |
| 191 } | 199 } |
| 192 | 200 |
| 193 bool SVGAElement::isMouseFocusable() const | 201 bool SVGAElement::isMouseFocusable() const |
| 194 { | 202 { |
| 195 return false; | 203 // Links are focusable by default, but only allow links with tabindex or con
tenteditable to be mouse focusable. |
| 204 // https://bugs.webkit.org/show_bug.cgi?id=26856 |
| 205 if (isLink()) |
| 206 return SVGElement::supportsFocus(); |
| 207 |
| 208 return SVGElement::isMouseFocusable(); |
| 196 } | 209 } |
| 197 | 210 |
| 198 bool SVGAElement::isKeyboardFocusable() const | 211 bool SVGAElement::isKeyboardFocusable() const |
| 199 { | 212 { |
| 200 if (!isFocusable()) | 213 if (isFocusable() && Element::supportsFocus()) |
| 201 return false; | 214 return SVGElement::isKeyboardFocusable(); |
| 202 | 215 |
| 203 if (Page* page = document().page()) | 216 if (isLink()) |
| 204 return page->chrome().client().tabsToLinks(); | 217 return document().frameHost()->chrome().client().tabsToLinks(); |
| 205 return false; | 218 return SVGElement::isKeyboardFocusable(); |
| 219 } |
| 220 |
| 221 bool SVGAElement::canStartSelection() const |
| 222 { |
| 223 if (!isLink()) |
| 224 return SVGElement::canStartSelection(); |
| 225 return rendererIsEditable(); |
| 206 } | 226 } |
| 207 | 227 |
| 208 bool SVGAElement::willRespondToMouseClickEvents() | 228 bool SVGAElement::willRespondToMouseClickEvents() |
| 209 { | 229 { |
| 210 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); | 230 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); |
| 211 } | 231 } |
| 212 | 232 |
| 213 } // namespace WebCore | 233 } // namespace WebCore |
| OLD | NEW |