1 | /* |
2 | * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 | * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 | * Copyright (C) 2018-2019 Apple Inc. All rights reserved. |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #pragma once |
23 | |
24 | #include "SVGElement.h" |
25 | #include "SVGExternalResourcesRequired.h" |
26 | #include "SVGTests.h" |
27 | #include "SVGURIReference.h" |
28 | |
29 | namespace WebCore { |
30 | |
31 | class CSSCursorImageValue; |
32 | |
33 | class SVGCursorElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests, public SVGURIReference { |
34 | WTF_MAKE_ISO_ALLOCATED(SVGCursorElement); |
35 | public: |
36 | static Ref<SVGCursorElement> create(const QualifiedName&, Document&); |
37 | |
38 | virtual ~SVGCursorElement(); |
39 | |
40 | void addClient(CSSCursorImageValue&); |
41 | void removeClient(CSSCursorImageValue&); |
42 | |
43 | const SVGLengthValue& x() const { return m_x->currentValue(); } |
44 | const SVGLengthValue& y() const { return m_y->currentValue(); } |
45 | |
46 | SVGAnimatedLength& xAnimated() { return m_x; } |
47 | SVGAnimatedLength& yAnimated() { return m_y; } |
48 | |
49 | private: |
50 | SVGCursorElement(const QualifiedName&, Document&); |
51 | |
52 | using PropertyRegistry = SVGPropertyOwnerRegistry<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>; |
53 | const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } |
54 | |
55 | void parseAttribute(const QualifiedName&, const AtomicString&) final; |
56 | void svgAttributeChanged(const QualifiedName&) final; |
57 | |
58 | bool isValid() const final { return SVGTests::isValid(); } |
59 | bool rendererIsNeeded(const RenderStyle&) final { return false; } |
60 | |
61 | void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; |
62 | |
63 | PropertyRegistry m_propertyRegistry { *this }; |
64 | Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) }; |
65 | Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) }; |
66 | HashSet<CSSCursorImageValue*> m_clients; |
67 | }; |
68 | |
69 | } // namespace WebCore |
70 | |