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 |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #ifndef LayoutSVGResourceFilter_h | 24 #ifndef LayoutSVGResourceFilter_h |
25 #define LayoutSVGResourceFilter_h | 25 #define LayoutSVGResourceFilter_h |
26 | 26 |
27 #include "core/layout/svg/LayoutSVGResourceContainer.h" | 27 #include "core/layout/svg/LayoutSVGResourceContainer.h" |
28 #include "core/svg/SVGFilterElement.h" | 28 #include "core/svg/SVGFilterElement.h" |
29 #include "core/svg/graphics/filters/SVGFilter.h" | |
30 #include "core/svg/graphics/filters/SVGFilterBuilder.h" | 29 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
| 30 #include "platform/graphics/filters/Filter.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class FilterData final : public NoBaseWillBeGarbageCollectedFinalized<FilterData
> { | 34 class FilterData final : public NoBaseWillBeGarbageCollectedFinalized<FilterData
> { |
35 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(FilterData); | 35 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(FilterData); |
36 public: | 36 public: |
37 /* | 37 /* |
38 * The state transitions should follow the following: | 38 * The state transitions should follow the following: |
39 * Initial -> RecordingContent -> ReadyToPaint -> PaintingFilter -> ReadyToP
aint | 39 * Initial -> RecordingContent -> ReadyToPaint -> PaintingFilter -> ReadyToP
aint |
40 * | ^ | ^ | 40 * | ^ | ^ |
(...skipping 11 matching lines...) Expand all Loading... |
52 | 52 |
53 static PassOwnPtrWillBeRawPtr<FilterData> create() | 53 static PassOwnPtrWillBeRawPtr<FilterData> create() |
54 { | 54 { |
55 return adoptPtrWillBeNoop(new FilterData()); | 55 return adoptPtrWillBeNoop(new FilterData()); |
56 } | 56 } |
57 | 57 |
58 void dispose(); | 58 void dispose(); |
59 | 59 |
60 DECLARE_TRACE(); | 60 DECLARE_TRACE(); |
61 | 61 |
62 RefPtrWillBeMember<SVGFilter> filter; | 62 RefPtrWillBeMember<Filter> filter; |
63 RefPtrWillBeMember<SVGFilterBuilder> builder; | 63 RefPtrWillBeMember<SVGFilterBuilder> builder; |
64 FilterDataState m_state; | 64 FilterDataState m_state; |
65 | 65 |
66 private: | 66 private: |
67 FilterData() : m_state(Initial) { } | 67 FilterData() : m_state(Initial) { } |
68 }; | 68 }; |
69 | 69 |
70 class LayoutSVGResourceFilter final : public LayoutSVGResourceContainer { | 70 class LayoutSVGResourceFilter final : public LayoutSVGResourceContainer { |
71 public: | 71 public: |
72 explicit LayoutSVGResourceFilter(SVGFilterElement*); | 72 explicit LayoutSVGResourceFilter(SVGFilterElement*); |
73 ~LayoutSVGResourceFilter() override; | 73 ~LayoutSVGResourceFilter() override; |
74 | 74 |
75 bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override; | 75 bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override; |
76 | 76 |
77 const char* name() const override { return "LayoutSVGResourceFilter"; } | 77 const char* name() const override { return "LayoutSVGResourceFilter"; } |
78 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectSVGResourceFilter || LayoutSVGResourceContainer::isOfType(type); } | 78 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectSVGResourceFilter || LayoutSVGResourceContainer::isOfType(type); } |
79 | 79 |
80 void removeAllClientsFromCache(bool markForInvalidation = true) override; | 80 void removeAllClientsFromCache(bool markForInvalidation = true) override; |
81 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o
verride; | 81 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o
verride; |
82 | 82 |
83 FloatRect resourceBoundingBox(const LayoutObject*); | 83 FloatRect resourceBoundingBox(const LayoutObject*); |
84 | 84 |
85 PassRefPtrWillBeRawPtr<SVGFilterBuilder> buildPrimitives(SVGFilter*); | 85 PassRefPtrWillBeRawPtr<SVGFilterBuilder> buildPrimitives(Filter*); |
86 | 86 |
87 SVGUnitTypes::SVGUnitType filterUnits() const { return toSVGFilterElement(el
ement())->filterUnits()->currentValue()->enumValue(); } | 87 SVGUnitTypes::SVGUnitType filterUnits() const { return toSVGFilterElement(el
ement())->filterUnits()->currentValue()->enumValue(); } |
88 SVGUnitTypes::SVGUnitType primitiveUnits() const { return toSVGFilterElement
(element())->primitiveUnits()->currentValue()->enumValue(); } | 88 SVGUnitTypes::SVGUnitType primitiveUnits() const { return toSVGFilterElement
(element())->primitiveUnits()->currentValue()->enumValue(); } |
89 | 89 |
90 void primitiveAttributeChanged(LayoutObject*, const QualifiedName&); | 90 void primitiveAttributeChanged(LayoutObject*, const QualifiedName&); |
91 | 91 |
92 static const LayoutSVGResourceType s_resourceType = FilterResourceType; | 92 static const LayoutSVGResourceType s_resourceType = FilterResourceType; |
93 LayoutSVGResourceType resourceType() const override { return s_resourceType;
} | 93 LayoutSVGResourceType resourceType() const override { return s_resourceType;
} |
94 | 94 |
95 FilterData* getFilterDataForLayoutObject(LayoutObject* object) { return m_fi
lter.get(object); } | 95 FilterData* getFilterDataForLayoutObject(LayoutObject* object) { return m_fi
lter.get(object); } |
96 void setFilterDataForLayoutObject(LayoutObject* object, PassOwnPtrWillBeRawP
tr<FilterData> filterData) { m_filter.set(object, filterData); } | 96 void setFilterDataForLayoutObject(LayoutObject* object, PassOwnPtrWillBeRawP
tr<FilterData> filterData) { m_filter.set(object, filterData); } |
97 | 97 |
98 protected: | 98 protected: |
99 void willBeDestroyed() override; | 99 void willBeDestroyed() override; |
100 | 100 |
101 private: | 101 private: |
102 void disposeFilterMap(); | 102 void disposeFilterMap(); |
103 | 103 |
104 using FilterMap = WillBePersistentHeapHashMap<LayoutObject*, OwnPtrWillBeMem
ber<FilterData>>; | 104 using FilterMap = WillBePersistentHeapHashMap<LayoutObject*, OwnPtrWillBeMem
ber<FilterData>>; |
105 FilterMap m_filter; | 105 FilterMap m_filter; |
106 }; | 106 }; |
107 | 107 |
108 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceFilter, isSVGResourceFilter()); | 108 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceFilter, isSVGResourceFilter()); |
109 | 109 |
110 } | 110 } |
111 | 111 |
112 #endif | 112 #endif |
OLD | NEW |