Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.h

Issue 2350063002: Replace FilterData::filter with lastEffect (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/SVGUnitTypes.h"
29 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
30 #include "platform/graphics/filters/Filter.h"
31 29
32 namespace blink { 30 namespace blink {
33 31
32 class FilterEffect;
33 class SVGFilterElement;
34 class SVGFilterGraphNodeMap;
35
34 class FilterData final : public GarbageCollected<FilterData> { 36 class FilterData final : public GarbageCollected<FilterData> {
35 public: 37 public:
36 /* 38 /*
37 * The state transitions should follow the following: 39 * The state transitions should follow the following:
38 * Initial -> RecordingContent -> ReadyToPaint -> PaintingFilter -> ReadyToP aint 40 * Initial -> RecordingContent -> ReadyToPaint -> PaintingFilter -> ReadyToP aint
39 * | ^ | ^ 41 * | ^ | ^
40 * v | v | 42 * v | v |
41 * RecordingContentCycleDetected PaintingFilterCycle 43 * RecordingContentCycleDetected PaintingFilterCycle
42 */ 44 */
43 enum FilterDataState { 45 enum FilterDataState {
44 Initial, 46 Initial,
45 RecordingContent, 47 RecordingContent,
46 RecordingContentCycleDetected, 48 RecordingContentCycleDetected,
47 ReadyToPaint, 49 ReadyToPaint,
48 PaintingFilter, 50 PaintingFilter,
49 PaintingFilterCycleDetected 51 PaintingFilterCycleDetected
50 }; 52 };
51 53
52 static FilterData* create() 54 static FilterData* create()
53 { 55 {
54 return new FilterData(); 56 return new FilterData();
55 } 57 }
56 58
57 void dispose(); 59 void dispose();
58 60
59 DECLARE_TRACE(); 61 DECLARE_TRACE();
60 62
61 Member<Filter> filter; 63 Member<FilterEffect> lastEffect;
62 Member<SVGFilterGraphNodeMap> nodeMap; 64 Member<SVGFilterGraphNodeMap> nodeMap;
63 FilterDataState m_state; 65 FilterDataState m_state;
64 66
65 private: 67 private:
66 FilterData() : m_state(Initial) { } 68 FilterData() : m_state(Initial) { }
67 }; 69 };
68 70
69 class LayoutSVGResourceFilter final : public LayoutSVGResourceContainer { 71 class LayoutSVGResourceFilter final : public LayoutSVGResourceContainer {
70 public: 72 public:
71 explicit LayoutSVGResourceFilter(SVGFilterElement*); 73 explicit LayoutSVGResourceFilter(SVGFilterElement*);
72 ~LayoutSVGResourceFilter() override; 74 ~LayoutSVGResourceFilter() override;
73 75
74 bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override; 76 bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
75 77
76 const char* name() const override { return "LayoutSVGResourceFilter"; } 78 const char* name() const override { return "LayoutSVGResourceFilter"; }
77 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectSVGResourceFilter || LayoutSVGResourceContainer::isOfType(type); } 79 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectSVGResourceFilter || LayoutSVGResourceContainer::isOfType(type); }
78 80
79 void removeAllClientsFromCache(bool markForInvalidation = true) override; 81 void removeAllClientsFromCache(bool markForInvalidation = true) override;
80 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o verride; 82 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o verride;
81 83
82 FloatRect resourceBoundingBox(const LayoutObject*); 84 FloatRect resourceBoundingBox(const LayoutObject*);
83 85
84 SVGUnitTypes::SVGUnitType filterUnits() const { return toSVGFilterElement(el ement())->filterUnits()->currentValue()->enumValue(); } 86 SVGUnitTypes::SVGUnitType filterUnits() const;
85 SVGUnitTypes::SVGUnitType primitiveUnits() const { return toSVGFilterElement (element())->primitiveUnits()->currentValue()->enumValue(); } 87 SVGUnitTypes::SVGUnitType primitiveUnits() const;
86 88
87 void primitiveAttributeChanged(LayoutObject*, const QualifiedName&); 89 void primitiveAttributeChanged(LayoutObject*, const QualifiedName&);
88 90
89 static const LayoutSVGResourceType s_resourceType = FilterResourceType; 91 static const LayoutSVGResourceType s_resourceType = FilterResourceType;
90 LayoutSVGResourceType resourceType() const override { return s_resourceType; } 92 LayoutSVGResourceType resourceType() const override { return s_resourceType; }
91 93
92 FilterData* getFilterDataForLayoutObject(const LayoutObject* object) { retur n m_filter.get(const_cast<LayoutObject*>(object)); } 94 FilterData* getFilterDataForLayoutObject(const LayoutObject* object) { retur n m_filter.get(const_cast<LayoutObject*>(object)); }
93 void setFilterDataForLayoutObject(LayoutObject* object, FilterData* filterDa ta) { m_filter.set(object, filterData); } 95 void setFilterDataForLayoutObject(LayoutObject* object, FilterData* filterDa ta) { m_filter.set(object, filterData); }
94 96
95 protected: 97 protected:
96 void willBeDestroyed() override; 98 void willBeDestroyed() override;
97 99
98 private: 100 private:
99 void disposeFilterMap(); 101 void disposeFilterMap();
100 102
101 using FilterMap = PersistentHeapHashMap<LayoutObject*, Member<FilterData>>; 103 using FilterMap = PersistentHeapHashMap<LayoutObject*, Member<FilterData>>;
102 FilterMap m_filter; 104 FilterMap m_filter;
103 }; 105 };
104 106
105 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceFilter, isSVGResourceFilter()); 107 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceFilter, isSVGResourceFilter());
106 108
107 } // namespace blink 109 } // namespace blink
108 110
109 #endif 111 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698