| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 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> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef SVGUseElement_h | 21 #ifndef SVGUseElement_h |
| 22 #define SVGUseElement_h | 22 #define SVGUseElement_h |
| 23 | 23 |
| 24 #include "core/events/EventSender.h" | 24 #include "core/events/EventSender.h" |
| 25 #include "core/fetch/DocumentResource.h" | 25 #include "core/fetch/DocumentResource.h" |
| 26 #include "core/svg/SVGAnimatedLength.h" | 26 #include "core/svg/SVGAnimatedLength.h" |
| 27 #include "core/svg/SVGGeometryElement.h" |
| 27 #include "core/svg/SVGGraphicsElement.h" | 28 #include "core/svg/SVGGraphicsElement.h" |
| 28 #include "core/svg/SVGURIReference.h" | 29 #include "core/svg/SVGURIReference.h" |
| 29 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 typedef EventSender<SVGUseElement> SVGUseEventSender; | 34 typedef EventSender<SVGUseElement> SVGUseEventSender; |
| 34 | 35 |
| 35 class SVGUseElement final : public SVGGraphicsElement, | 36 class SVGUseElement final : public SVGGraphicsElement, |
| 36 public SVGURIReference, | 37 public SVGURIReference, |
| 37 public DocumentResourceClient { | 38 public DocumentResourceClient { |
| 38 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
| 39 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGUseElement); | 40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGUseElement); |
| 40 public: | 41 public: |
| 41 static PassRefPtrWillBeRawPtr<SVGUseElement> create(Document&); | 42 static PassRefPtrWillBeRawPtr<SVGUseElement> create(Document&); |
| 42 virtual ~SVGUseElement(); | 43 virtual ~SVGUseElement(); |
| 43 | 44 |
| 44 void invalidateShadowTree(); | 45 void invalidateShadowTree(); |
| 45 | 46 |
| 46 LayoutObject* layoutObjectClipChild() const; | 47 // Return the element that should be used for clipping, |
| 48 // or null if a valid clip element is not directly referenced. |
| 49 SVGGraphicsElement* targetGraphicsElementForClipping() const; |
| 47 | 50 |
| 48 SVGAnimatedLength* x() const { return m_x.get(); } | 51 SVGAnimatedLength* x() const { return m_x.get(); } |
| 49 SVGAnimatedLength* y() const { return m_y.get(); } | 52 SVGAnimatedLength* y() const { return m_y.get(); } |
| 50 SVGAnimatedLength* width() const { return m_width.get(); } | 53 SVGAnimatedLength* width() const { return m_width.get(); } |
| 51 SVGAnimatedLength* height() const { return m_height.get(); } | 54 SVGAnimatedLength* height() const { return m_height.get(); } |
| 52 | 55 |
| 53 virtual void buildPendingResource() override; | 56 virtual void buildPendingResource() override; |
| 54 | 57 |
| 55 void dispatchPendingEvent(SVGUseEventSender*); | 58 void dispatchPendingEvent(SVGUseEventSender*); |
| 59 void toClipPath(Path&) const; |
| 56 | 60 |
| 57 DECLARE_VIRTUAL_TRACE(); | 61 DECLARE_VIRTUAL_TRACE(); |
| 58 | 62 |
| 59 private: | 63 private: |
| 60 explicit SVGUseElement(Document&); | 64 explicit SVGUseElement(Document&); |
| 61 | 65 |
| 62 virtual bool isPresentationAttribute(const QualifiedName&) const override; | 66 virtual bool isPresentationAttribute(const QualifiedName&) const override; |
| 63 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override; | 67 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override; |
| 64 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const o
verride; | 68 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const o
verride; |
| 65 | 69 |
| 66 virtual bool isStructurallyExternal() const override { return !hrefString().
isNull() && isExternalURIReference(hrefString(), document()); } | 70 virtual bool isStructurallyExternal() const override { return !hrefString().
isNull() && isExternalURIReference(hrefString(), document()); } |
| 67 | 71 |
| 68 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 72 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 69 virtual void removedFrom(ContainerNode*) override; | 73 virtual void removedFrom(ContainerNode*) override; |
| 70 | 74 |
| 71 virtual void svgAttributeChanged(const QualifiedName&) override; | 75 virtual void svgAttributeChanged(const QualifiedName&) override; |
| 72 | 76 |
| 73 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override; | 77 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 74 virtual void toClipPath(Path&) override; | |
| 75 | 78 |
| 76 void clearResourceReferences(); | 79 void clearResourceReferences(); |
| 77 void buildShadowAndInstanceTree(SVGElement* target); | 80 void buildShadowAndInstanceTree(SVGElement* target); |
| 78 | 81 |
| 79 void scheduleShadowTreeRecreation(); | 82 void scheduleShadowTreeRecreation(); |
| 80 virtual bool haveLoadedRequiredResources() override { return !isStructurally
External() || m_haveFiredLoadEvent; } | 83 virtual bool haveLoadedRequiredResources() override { return !isStructurally
External() || m_haveFiredLoadEvent; } |
| 81 | 84 |
| 82 virtual bool selfHasRelativeLengths() const override; | 85 virtual bool selfHasRelativeLengths() const override; |
| 83 | 86 |
| 84 // Instance tree handling | 87 // Instance tree handling |
| (...skipping 20 matching lines...) Expand all Loading... |
| 105 | 108 |
| 106 bool m_haveFiredLoadEvent; | 109 bool m_haveFiredLoadEvent; |
| 107 bool m_needsShadowTreeRecreation; | 110 bool m_needsShadowTreeRecreation; |
| 108 RefPtrWillBeMember<SVGElement> m_targetElementInstance; | 111 RefPtrWillBeMember<SVGElement> m_targetElementInstance; |
| 109 ResourcePtr<DocumentResource> m_resource; | 112 ResourcePtr<DocumentResource> m_resource; |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 } // namespace blink | 115 } // namespace blink |
| 113 | 116 |
| 114 #endif // SVGUseElement_h | 117 #endif // SVGUseElement_h |
| OLD | NEW |