darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 1 | /* |
zimmermann@webkit.org | 711245f | 2010-08-03 19:39:01 +0000 | [diff] [blame] | 2 | * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 | * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
darin@apple.com | d872127 | 2015-01-26 03:22:09 +0000 | [diff] [blame] | 4 | * Copyright (C) 2015 Apple Inc. All rights reserved. |
zimmermann@webkit.org | 711245f | 2010-08-03 19:39:01 +0000 | [diff] [blame] | 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 | */ |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 21 | |
eseidel | 8eddecf | 2007-01-16 00:49:43 +0000 | [diff] [blame] | 22 | #ifndef SVGUseElement_h |
| 23 | #define SVGUseElement_h |
zimmermann | 58e4e14 | 2006-12-17 12:16:31 +0000 | [diff] [blame] | 24 | |
andersca@apple.com | 0920f1b | 2013-04-05 00:08:09 +0000 | [diff] [blame] | 25 | #include "CachedResourceHandle.h" |
| 26 | #include "CachedSVGDocumentClient.h" |
zimmermann@webkit.org | e50a8b1 | 2010-12-03 09:44:21 +0000 | [diff] [blame] | 27 | #include "SVGAnimatedBoolean.h" |
zimmermann@webkit.org | 001d252 | 2010-10-21 10:25:25 +0000 | [diff] [blame] | 28 | #include "SVGAnimatedLength.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 29 | #include "SVGExternalResourcesRequired.h" |
ch.dumez@sisa.samsung.com | a47b618 | 2013-06-28 15:58:03 +0000 | [diff] [blame] | 30 | #include "SVGGraphicsElement.h" |
rwlbuis | 7ccc98a | 2006-10-13 12:56:42 +0000 | [diff] [blame] | 31 | #include "SVGURIReference.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 32 | |
zimmermann@webkit.org | 52b39ec | 2008-02-03 23:18:53 +0000 | [diff] [blame] | 33 | namespace WebCore { |
| 34 | |
reni@webkit.org | ff4b9f2 | 2012-03-14 08:52:35 +0000 | [diff] [blame] | 35 | class CachedSVGDocument; |
darin@apple.com | d872127 | 2015-01-26 03:22:09 +0000 | [diff] [blame] | 36 | class SVGGElement; |
zimmermann | 995e15b | 2007-01-19 14:03:41 +0000 | [diff] [blame] | 37 | |
darin@apple.com | 43c2746 | 2015-02-12 03:53:48 +0000 | [diff] [blame] | 38 | class SVGUseElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference, private CachedSVGDocumentClient { |
zimmermann@webkit.org | abd8845 | 2008-10-09 03:34:43 +0000 | [diff] [blame] | 39 | |
zimmermann@webkit.org | a285742 | 2011-07-09 11:26:10 +0000 | [diff] [blame] | 40 | BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGUseElement) |
| 41 | DECLARE_ANIMATED_LENGTH(X, x) |
| 42 | DECLARE_ANIMATED_LENGTH(Y, y) |
| 43 | DECLARE_ANIMATED_LENGTH(Width, width) |
| 44 | DECLARE_ANIMATED_LENGTH(Height, height) |
zandobersek@gmail.com | 7d97f1c | 2015-06-12 13:44:43 +0000 | [diff] [blame] | 45 | DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) |
| 46 | DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) |
zimmermann@webkit.org | a285742 | 2011-07-09 11:26:10 +0000 | [diff] [blame] | 47 | END_DECLARE_ANIMATED_PROPERTIES |
zimmermann@webkit.org | ab0da70 | 2010-12-01 12:17:12 +0000 | [diff] [blame] | 48 | |
darin@apple.com | 43c2746 | 2015-02-12 03:53:48 +0000 | [diff] [blame] | 49 | public: |
| 50 | static Ref<SVGUseElement> create(const QualifiedName&, Document&); |
| 51 | virtual ~SVGUseElement(); |
| 52 | |
| 53 | void invalidateShadowTree(); |
| 54 | |
| 55 | RenderElement* rendererClipChild() const; |
| 56 | |
| 57 | private: |
| 58 | SVGUseElement(const QualifiedName&, Document&); |
| 59 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 60 | bool isValid() const override; |
| 61 | InsertionNotificationRequest insertedInto(ContainerNode&) override; |
| 62 | void removedFrom(ContainerNode&) override; |
| 63 | void buildPendingResource() override; |
| 64 | void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 65 | void svgAttributeChanged(const QualifiedName&) override; |
antti@apple.com | e7468a4 | 2016-04-01 09:54:12 +0000 | [diff] [blame] | 66 | bool willRecalcStyle(Style::Change) override; |
antti@apple.com | de6dae7b | 2016-04-24 13:54:59 +0000 | [diff] [blame^] | 67 | RenderPtr<RenderElement> createElementRenderer(std::unique_ptr<RenderStyle>, const RenderTreePosition&) override; |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 68 | void toClipPath(Path&) override; |
| 69 | bool haveLoadedRequiredResources() override; |
| 70 | void finishParsingChildren() override; |
| 71 | bool selfHasRelativeLengths() const override; |
| 72 | void setHaveFiredLoadEvent(bool) override; |
| 73 | bool haveFiredLoadEvent() const override; |
| 74 | Timer* svgLoadEventTimer() override; |
| 75 | void notifyFinished(CachedResource*) override; |
reni@webkit.org | ff4b9f2 | 2012-03-14 08:52:35 +0000 | [diff] [blame] | 76 | |
darin@apple.com | 43c2746 | 2015-02-12 03:53:48 +0000 | [diff] [blame] | 77 | Document* externalDocument() const; |
| 78 | void updateExternalDocument(); |
zimmermann@webkit.org | 684359d | 2012-03-14 16:59:16 +0000 | [diff] [blame] | 79 | |
darin@apple.com | 43c2746 | 2015-02-12 03:53:48 +0000 | [diff] [blame] | 80 | SVGElement* findTarget(String* targetID = nullptr) const; |
| 81 | |
| 82 | void cloneTarget(ContainerNode&, SVGElement& target) const; |
| 83 | SVGElement* targetClone() const; |
| 84 | |
| 85 | void updateShadowTree(); |
| 86 | void expandUseElementsInShadowTree() const; |
| 87 | void expandSymbolElementsInShadowTree() const; |
| 88 | void transferEventListenersToShadowTree() const; |
| 89 | void transferSizeAttributesToTargetClone(SVGElement&) const; |
| 90 | |
| 91 | void clearShadowTree(); |
| 92 | void invalidateDependentShadowTrees(); |
| 93 | |
| 94 | bool m_haveFiredLoadEvent { false }; |
| 95 | bool m_shadowTreeNeedsUpdate { true }; |
| 96 | CachedResourceHandle<CachedSVGDocument> m_externalDocument; |
jer.noble@apple.com | 50862fe | 2014-11-06 23:06:03 +0000 | [diff] [blame] | 97 | Timer m_svgLoadEventTimer; |
zimmermann@webkit.org | ab0da70 | 2010-12-01 12:17:12 +0000 | [diff] [blame] | 98 | }; |
weinig | ab5f09e | 2006-07-29 23:15:25 +0000 | [diff] [blame] | 99 | |
zimmermann@webkit.org | a975c40 | 2010-01-21 23:22:56 +0000 | [diff] [blame] | 100 | } |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 101 | |
zimmermann@webkit.org | a975c40 | 2010-01-21 23:22:56 +0000 | [diff] [blame] | 102 | #endif |