OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 13 matching lines...) Expand all Loading... |
24 #ifndef RenderSVGResourceFilter_h | 24 #ifndef RenderSVGResourceFilter_h |
25 #define RenderSVGResourceFilter_h | 25 #define RenderSVGResourceFilter_h |
26 | 26 |
27 #include "core/rendering/svg/RenderSVGResourceContainer.h" | 27 #include "core/rendering/svg/RenderSVGResourceContainer.h" |
28 #include "core/svg/SVGFilterElement.h" | 28 #include "core/svg/SVGFilterElement.h" |
29 #include "core/svg/graphics/filters/SVGFilter.h" | 29 #include "core/svg/graphics/filters/SVGFilter.h" |
30 #include "core/svg/graphics/filters/SVGFilterBuilder.h" | 30 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 struct FilterData { | 34 class FilterData final : public NoBaseWillBeGarbageCollected<FilterData> { |
35 WTF_MAKE_FAST_ALLOCATED; | 35 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
36 public: | 36 public: |
37 enum FilterDataState { PaintingSource, Built, CycleDetected }; | 37 enum FilterDataState { PaintingSource, Built, CycleDetected }; |
38 | 38 |
| 39 static PassOwnPtrWillBeRawPtr<FilterData> create() |
| 40 { |
| 41 return adoptPtrWillBeNoop(new FilterData()); |
| 42 } |
| 43 |
| 44 void trace(Visitor*); |
| 45 |
| 46 RefPtrWillBeMember<SVGFilter> filter; |
| 47 RefPtrWillBeMember<SVGFilterBuilder> builder; |
| 48 FloatRect boundaries; |
| 49 FloatRect drawingRegion; |
| 50 FilterDataState state; |
| 51 |
| 52 private: |
39 FilterData() | 53 FilterData() |
40 : state(PaintingSource) | 54 : state(PaintingSource) |
41 { | 55 { |
42 } | 56 } |
43 | 57 |
44 RefPtr<SVGFilter> filter; | |
45 RefPtr<SVGFilterBuilder> builder; | |
46 FloatRect boundaries; | |
47 FloatRect drawingRegion; | |
48 FilterDataState state; | |
49 }; | 58 }; |
50 | 59 |
51 class GraphicsContext; | 60 class GraphicsContext; |
52 | 61 |
53 class RenderSVGResourceFilter final : public RenderSVGResourceContainer { | 62 class RenderSVGResourceFilter final : public RenderSVGResourceContainer { |
54 public: | 63 public: |
55 explicit RenderSVGResourceFilter(SVGFilterElement*); | 64 explicit RenderSVGResourceFilter(SVGFilterElement*); |
| 65 |
56 virtual ~RenderSVGResourceFilter(); | 66 virtual ~RenderSVGResourceFilter(); |
| 67 virtual void trace(Visitor*) override; |
57 virtual void destroy() override; | 68 virtual void destroy() override; |
58 | 69 |
59 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const override; | 70 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const override; |
60 | 71 |
61 virtual const char* renderName() const override { return "RenderSVGResourceF
ilter"; } | 72 virtual const char* renderName() const override { return "RenderSVGResourceF
ilter"; } |
62 virtual bool isOfType(RenderObjectType type) const override { return type ==
RenderObjectSVGResourceFilter || RenderSVGResourceContainer::isOfType(type); } | 73 virtual bool isOfType(RenderObjectType type) const override { return type ==
RenderObjectSVGResourceFilter || RenderSVGResourceContainer::isOfType(type); } |
63 | 74 |
64 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over
ride; | 75 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over
ride; |
65 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) override; | 76 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) override; |
66 | 77 |
67 bool prepareEffect(RenderObject*, GraphicsContext*&); | 78 bool prepareEffect(RenderObject*, GraphicsContext*&); |
68 void finishEffect(RenderObject*, GraphicsContext*&); | 79 void finishEffect(RenderObject*, GraphicsContext*&); |
69 | 80 |
70 FloatRect resourceBoundingBox(const RenderObject*); | 81 FloatRect resourceBoundingBox(const RenderObject*); |
71 | 82 |
72 PassRefPtr<SVGFilterBuilder> buildPrimitives(SVGFilter*); | 83 PassRefPtrWillBeRawPtr<SVGFilterBuilder> buildPrimitives(SVGFilter*); |
73 | 84 |
74 SVGUnitTypes::SVGUnitType filterUnits() const { return toSVGFilterElement(el
ement())->filterUnits()->currentValue()->enumValue(); } | 85 SVGUnitTypes::SVGUnitType filterUnits() const { return toSVGFilterElement(el
ement())->filterUnits()->currentValue()->enumValue(); } |
75 SVGUnitTypes::SVGUnitType primitiveUnits() const { return toSVGFilterElement
(element())->primitiveUnits()->currentValue()->enumValue(); } | 86 SVGUnitTypes::SVGUnitType primitiveUnits() const { return toSVGFilterElement
(element())->primitiveUnits()->currentValue()->enumValue(); } |
76 | 87 |
77 void primitiveAttributeChanged(RenderObject*, const QualifiedName&); | 88 void primitiveAttributeChanged(RenderObject*, const QualifiedName&); |
78 | 89 |
79 static const RenderSVGResourceType s_resourceType = FilterResourceType; | 90 static const RenderSVGResourceType s_resourceType = FilterResourceType; |
80 virtual RenderSVGResourceType resourceType() const override { return s_resou
rceType; } | 91 virtual RenderSVGResourceType resourceType() const override { return s_resou
rceType; } |
81 | 92 |
82 FloatRect drawingRegion(RenderObject*) const; | 93 FloatRect drawingRegion(RenderObject*) const; |
83 private: | 94 private: |
84 typedef HashMap<RenderObject*, OwnPtr<FilterData> > FilterMap; | 95 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderObject>, OwnPtrWillBeMemb
er<FilterData> > FilterMap; |
85 FilterMap m_filter; | 96 FilterMap m_filter; |
86 }; | 97 }; |
87 | 98 |
88 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceFilter, isSVGResourceFilter()); | 99 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceFilter, isSVGResourceFilter()); |
89 | 100 |
90 } | 101 } |
91 | 102 |
92 #endif | 103 #endif |
OLD | NEW |