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/LayoutSVGResourceContainer.h

Issue 2490163002: Reland of "Tracking reference filter mutation via SVGElementProxy" (Closed)
Patch Set: Fix double observer unregistration; simplify scope selection; add tests Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef LayoutSVGResourceContainer_h 20 #ifndef LayoutSVGResourceContainer_h
21 #define LayoutSVGResourceContainer_h 21 #define LayoutSVGResourceContainer_h
22 22
23 #include "core/layout/svg/LayoutSVGHiddenContainer.h" 23 #include "core/layout/svg/LayoutSVGHiddenContainer.h"
24 #include "core/svg/SVGDocumentExtensions.h" 24 #include "core/svg/SVGDocumentExtensions.h"
25 #include "core/svg/SVGResourceClient.h"
26 #include "platform/heap/Handle.h"
27 25
28 namespace blink { 26 namespace blink {
29 27
28 class SVGElementProxySet;
29
30 enum LayoutSVGResourceType { 30 enum LayoutSVGResourceType {
31 MaskerResourceType, 31 MaskerResourceType,
32 MarkerResourceType, 32 MarkerResourceType,
33 PatternResourceType, 33 PatternResourceType,
34 LinearGradientResourceType, 34 LinearGradientResourceType,
35 RadialGradientResourceType, 35 RadialGradientResourceType,
36 FilterResourceType, 36 FilterResourceType,
37 ClipperResourceType 37 ClipperResourceType
38 }; 38 };
39 39
(...skipping 16 matching lines...) Expand all
56 virtual LayoutSVGResourceType resourceType() const = 0; 56 virtual LayoutSVGResourceType resourceType() const = 0;
57 57
58 bool isSVGPaintServer() const { 58 bool isSVGPaintServer() const {
59 LayoutSVGResourceType resourceType = this->resourceType(); 59 LayoutSVGResourceType resourceType = this->resourceType();
60 return resourceType == PatternResourceType || 60 return resourceType == PatternResourceType ||
61 resourceType == LinearGradientResourceType || 61 resourceType == LinearGradientResourceType ||
62 resourceType == RadialGradientResourceType; 62 resourceType == RadialGradientResourceType;
63 } 63 }
64 64
65 void idChanged(); 65 void idChanged();
66 void addResourceClient(SVGResourceClient*);
67 void removeResourceClient(SVGResourceClient*);
68 66
69 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr); 67 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr);
70 68
71 static void markForLayoutAndParentResourceInvalidation( 69 static void markForLayoutAndParentResourceInvalidation(
72 LayoutObject*, 70 LayoutObject*,
73 bool needsLayout = true); 71 bool needsLayout = true);
74 72
75 void clearInvalidationMask() { m_invalidationMask = 0; } 73 void clearInvalidationMask() { m_invalidationMask = 0; }
76 74
77 protected: 75 protected:
78 // When adding modes, make sure we don't overflow m_invalidationMask below. 76 // When adding modes, make sure we don't overflow m_invalidationMask below.
79 enum InvalidationMode { 77 enum InvalidationMode {
80 LayoutAndBoundariesInvalidation = 1 << 0, 78 LayoutAndBoundariesInvalidation = 1 << 0,
81 BoundariesInvalidation = 1 << 1, 79 BoundariesInvalidation = 1 << 1,
82 PaintInvalidation = 1 << 2, 80 PaintInvalidation = 1 << 2,
83 ParentOnlyInvalidation = 1 << 3 81 ParentOnlyInvalidation = 1 << 3
84 }; 82 };
85 83
86 // Used from the invalidateClient/invalidateClients methods from classes, 84 // Used from the invalidateClient/invalidateClients methods from classes,
87 // inheriting from us. 85 // inheriting from us.
88 void markAllClientsForInvalidation(InvalidationMode); 86 void markAllClientsForInvalidation(InvalidationMode);
89 void markAllResourceClientsForInvalidation();
90 void markClientForInvalidation(LayoutObject*, InvalidationMode); 87 void markClientForInvalidation(LayoutObject*, InvalidationMode);
91 88
89 void notifyContentChanged();
90 virtual SVGElementProxySet* elementProxySet() { return nullptr; }
91
92 void willBeDestroyed() override; 92 void willBeDestroyed() override;
93 93
94 bool m_isInLayout; 94 bool m_isInLayout;
95 95
96 private: 96 private:
97 friend class SVGResourcesCache; 97 friend class SVGResourcesCache;
98 void addClient(LayoutObject*); 98 void addClient(LayoutObject*);
99 void removeClient(LayoutObject*); 99 void removeClient(LayoutObject*);
100 void detachAllClients(); 100 void detachAllClients();
101 101
102 void registerResource(); 102 void registerResource();
103 103
104 AtomicString m_id; 104 AtomicString m_id;
105 // Track global (markAllClientsForInvalidation) invals to avoid redundant 105 // Track global (markAllClientsForInvalidation) invals to avoid redundant
106 // crawls. 106 // crawls.
107 unsigned m_invalidationMask : 8; 107 unsigned m_invalidationMask : 8;
108 108
109 unsigned m_registered : 1; 109 unsigned m_registered : 1;
110 unsigned m_isInvalidating : 1; 110 unsigned m_isInvalidating : 1;
111 // 22 padding bits available 111 // 22 padding bits available
112 112
113 HashSet<LayoutObject*> m_clients; 113 HashSet<LayoutObject*> m_clients;
114 PersistentHeapHashSet<WeakMember<SVGResourceClient>> m_resourceClients;
115 }; 114 };
116 115
117 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById( 116 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById(
118 TreeScope& treeScope, 117 TreeScope& treeScope,
119 const AtomicString& id) { 118 const AtomicString& id) {
120 if (id.isEmpty()) 119 if (id.isEmpty())
121 return nullptr; 120 return nullptr;
122 121
123 if (LayoutSVGResourceContainer* layoutResource = 122 if (LayoutSVGResourceContainer* layoutResource =
124 treeScope.document().accessSVGExtensions().resourceById(id)) 123 treeScope.document().accessSVGExtensions().resourceById(id))
(...skipping 16 matching lines...) Expand all
141 isSVGResourceContainer()); 140 isSVGResourceContainer());
142 141
143 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ 142 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \
144 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ 143 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \
145 resource->resourceType() == typeName, \ 144 resource->resourceType() == typeName, \
146 resource.resourceType() == typeName) 145 resource.resourceType() == typeName)
147 146
148 } // namespace blink 147 } // namespace blink
149 148
150 #endif 149 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698