| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // If the xlink:title is set (non-empty string), use it. | 73 // If the xlink:title is set (non-empty string), use it. |
| 74 const AtomicString& title = fastGetAttribute(XLinkNames::titleAttr); | 74 const AtomicString& title = fastGetAttribute(XLinkNames::titleAttr); |
| 75 if (!title.isEmpty()) | 75 if (!title.isEmpty()) |
| 76 return title; | 76 return title; |
| 77 | 77 |
| 78 // Otherwise, use the title of this element. | 78 // Otherwise, use the title of this element. |
| 79 return SVGElement::title(); | 79 return SVGElement::title(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { | 82 void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { |
| 83 // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIReferen
ce changes | 83 // Unlike other SVG*Element classes, SVGAElement only listens to |
| 84 // as none of the other properties changes the linking behaviour for our <a> e
lement. | 84 // SVGURIReference changes as none of the other properties changes the linking |
| 85 // behaviour for our <a> element. |
| 85 if (SVGURIReference::isKnownAttribute(attrName)) { | 86 if (SVGURIReference::isKnownAttribute(attrName)) { |
| 86 SVGElement::InvalidationGuard invalidationGuard(this); | 87 SVGElement::InvalidationGuard invalidationGuard(this); |
| 87 | 88 |
| 88 bool wasLink = isLink(); | 89 bool wasLink = isLink(); |
| 89 setIsLink(!hrefString().isNull()); | 90 setIsLink(!hrefString().isNull()); |
| 90 | 91 |
| 91 if (wasLink || isLink()) { | 92 if (wasLink || isLink()) { |
| 92 pseudoStateChanged(CSSSelector::PseudoLink); | 93 pseudoStateChanged(CSSSelector::PseudoLink); |
| 93 pseudoStateChanged(CSSSelector::PseudoVisited); | 94 pseudoStateChanged(CSSSelector::PseudoVisited); |
| 94 pseudoStateChanged(CSSSelector::PseudoAnyLink); | 95 pseudoStateChanged(CSSSelector::PseudoAnyLink); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 149 } |
| 149 | 150 |
| 150 short SVGAElement::tabIndex() const { | 151 short SVGAElement::tabIndex() const { |
| 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 if (hasEditableStyle(*this)) | 157 if (hasEditableStyle(*this)) |
| 157 return SVGGraphicsElement::supportsFocus(); | 158 return SVGGraphicsElement::supportsFocus(); |
| 158 // If not a link we should still be able to focus the element if it has tabInd
ex. | 159 // If not a link we should still be able to focus the element if it has |
| 160 // tabIndex. |
| 159 return isLink() || SVGGraphicsElement::supportsFocus(); | 161 return isLink() || SVGGraphicsElement::supportsFocus(); |
| 160 } | 162 } |
| 161 | 163 |
| 162 bool SVGAElement::shouldHaveFocusAppearance() const { | 164 bool SVGAElement::shouldHaveFocusAppearance() const { |
| 163 return !m_wasFocusedByMouse || SVGGraphicsElement::supportsFocus(); | 165 return !m_wasFocusedByMouse || SVGGraphicsElement::supportsFocus(); |
| 164 } | 166 } |
| 165 | 167 |
| 166 // TODO(lanwei): Will add the InputDeviceCapabilities when SVGAElement gets focu
s later, see https://crbug.com/476530. | 168 // TODO(lanwei): Will add the InputDeviceCapabilities when SVGAElement gets |
| 169 // focus later, see https://crbug.com/476530. |
| 167 void SVGAElement::dispatchFocusEvent( | 170 void SVGAElement::dispatchFocusEvent( |
| 168 Element* oldFocusedElement, | 171 Element* oldFocusedElement, |
| 169 WebFocusType type, | 172 WebFocusType type, |
| 170 InputDeviceCapabilities* sourceCapabilities) { | 173 InputDeviceCapabilities* sourceCapabilities) { |
| 171 if (type != WebFocusTypePage) | 174 if (type != WebFocusTypePage) |
| 172 m_wasFocusedByMouse = type == WebFocusTypeMouse; | 175 m_wasFocusedByMouse = type == WebFocusTypeMouse; |
| 173 SVGGraphicsElement::dispatchFocusEvent(oldFocusedElement, type, | 176 SVGGraphicsElement::dispatchFocusEvent(oldFocusedElement, type, |
| 174 sourceCapabilities); | 177 sourceCapabilities); |
| 175 } | 178 } |
| 176 | 179 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (!isLink()) | 211 if (!isLink()) |
| 209 return SVGElement::canStartSelection(); | 212 return SVGElement::canStartSelection(); |
| 210 return hasEditableStyle(*this); | 213 return hasEditableStyle(*this); |
| 211 } | 214 } |
| 212 | 215 |
| 213 bool SVGAElement::willRespondToMouseClickEvents() { | 216 bool SVGAElement::willRespondToMouseClickEvents() { |
| 214 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); | 217 return isLink() || SVGGraphicsElement::willRespondToMouseClickEvents(); |
| 215 } | 218 } |
| 216 | 219 |
| 217 } // namespace blink | 220 } // namespace blink |
| OLD | NEW |