| 1 | /* |
| 2 | * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 | * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 | * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 | * Copyright (C) 2018-2019 Apple Inc. All rights reserved. |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Library General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Library General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Library General Public License |
| 18 | * along with this library; see the file COPYING.LIB. If not, write to |
| 19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 | * Boston, MA 02110-1301, USA. |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | |
| 25 | #include "SVGExternalResourcesRequired.h" |
| 26 | #include "SVGGraphicsElement.h" |
| 27 | #include "SVGURIReference.h" |
| 28 | #include "SharedStringHash.h" |
| 29 | |
| 30 | namespace WebCore { |
| 31 | |
| 32 | class SVGAElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference { |
| 33 | WTF_MAKE_ISO_ALLOCATED(SVGAElement); |
| 34 | public: |
| 35 | static Ref<SVGAElement> create(const QualifiedName&, Document&); |
| 36 | |
| 37 | String target() const final { return m_target->currentValue(); } |
| 38 | Ref<SVGAnimatedString>& targetAnimated() { return m_target; } |
| 39 | |
| 40 | SharedStringHash visitedLinkHash() const; |
| 41 | |
| 42 | private: |
| 43 | SVGAElement(const QualifiedName&, Document&); |
| 44 | |
| 45 | using PropertyRegistry = SVGPropertyOwnerRegistry<SVGAElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; |
| 46 | const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } |
| 47 | |
| 48 | void parseAttribute(const QualifiedName&, const AtomicString&) final; |
| 49 | void svgAttributeChanged(const QualifiedName&) final; |
| 50 | |
| 51 | RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; |
| 52 | bool childShouldCreateRenderer(const Node&) const final; |
| 53 | |
| 54 | bool isValid() const final { return SVGTests::isValid(); } |
| 55 | String title() const final; |
| 56 | void defaultEventHandler(Event&) final; |
| 57 | |
| 58 | bool supportsFocus() const final; |
| 59 | bool isMouseFocusable() const final; |
| 60 | bool isKeyboardFocusable(KeyboardEvent*) const final; |
| 61 | bool isURLAttribute(const Attribute&) const final; |
| 62 | bool canStartSelection() const final; |
| 63 | int tabIndex() const final; |
| 64 | |
| 65 | bool willRespondToMouseClickEvents() final; |
| 66 | |
| 67 | PropertyRegistry m_propertyRegistry { *this }; |
| 68 | Ref<SVGAnimatedString> m_target { SVGAnimatedString::create(this) }; |
| 69 | |
| 70 | // This is computed only once and must not be affected by subsequent URL changes. |
| 71 | mutable Optional<SharedStringHash> m_storedVisitedLinkHash; |
| 72 | }; |
| 73 | |
| 74 | } // namespace WebCore |
| 75 | |