OLD | NEW |
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/SVGTreeScopeResources.h" |
24 | 25 |
25 namespace blink { | 26 namespace blink { |
26 | 27 |
27 class SVGElementProxySet; | 28 class SVGElementProxySet; |
28 | 29 |
29 enum LayoutSVGResourceType { | 30 enum LayoutSVGResourceType { |
30 kMaskerResourceType, | 31 kMaskerResourceType, |
31 kMarkerResourceType, | 32 kMarkerResourceType, |
32 kPatternResourceType, | 33 kPatternResourceType, |
33 kLinearGradientResourceType, | 34 kLinearGradientResourceType, |
(...skipping 20 matching lines...) Expand all Loading... |
54 | 55 |
55 virtual LayoutSVGResourceType ResourceType() const = 0; | 56 virtual LayoutSVGResourceType ResourceType() const = 0; |
56 | 57 |
57 bool IsSVGPaintServer() const { | 58 bool IsSVGPaintServer() const { |
58 LayoutSVGResourceType resource_type = this->ResourceType(); | 59 LayoutSVGResourceType resource_type = this->ResourceType(); |
59 return resource_type == kPatternResourceType || | 60 return resource_type == kPatternResourceType || |
60 resource_type == kLinearGradientResourceType || | 61 resource_type == kLinearGradientResourceType || |
61 resource_type == kRadialGradientResourceType; | 62 resource_type == kRadialGradientResourceType; |
62 } | 63 } |
63 | 64 |
64 void IdChanged(const AtomicString& old_id, const AtomicString& new_id); | 65 // Detach all clients from this resource, and add them as watches to the tree |
65 void DetachAllClients(const AtomicString& to_id); | 66 // scope's resource entry (the argument.) |
| 67 void MakeClientsPending(SVGTreeScopeResources::Resource&); |
| 68 bool HasClients() const { return !clients_.IsEmpty(); } |
66 | 69 |
67 void InvalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr); | 70 void InvalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr); |
68 | 71 |
69 static void MarkForLayoutAndParentResourceInvalidation( | 72 static void MarkForLayoutAndParentResourceInvalidation( |
70 LayoutObject*, | 73 LayoutObject*, |
71 bool needs_layout = true); | 74 bool needs_layout = true); |
72 | 75 |
73 void ClearInvalidationMask() { invalidation_mask_ = 0; } | 76 void ClearInvalidationMask() { invalidation_mask_ = 0; } |
74 | 77 |
75 protected: | 78 protected: |
(...skipping 11 matching lines...) Expand all Loading... |
87 void MarkClientForInvalidation(LayoutObject*, InvalidationMode); | 90 void MarkClientForInvalidation(LayoutObject*, InvalidationMode); |
88 | 91 |
89 void NotifyContentChanged(); | 92 void NotifyContentChanged(); |
90 SVGElementProxySet* ElementProxySet(); | 93 SVGElementProxySet* ElementProxySet(); |
91 | 94 |
92 void WillBeDestroyed() override; | 95 void WillBeDestroyed() override; |
93 | 96 |
94 bool is_in_layout_; | 97 bool is_in_layout_; |
95 | 98 |
96 private: | 99 private: |
97 friend class SVGTreeScopeResources; | |
98 // The m_registered flag is updated by SVGTreeScopeResources, and indicates | |
99 // that this resource is the one that is resident in the id->resource map. | |
100 void SetRegistered(bool registered) { registered_ = registered; } | |
101 bool IsRegistered() const { return registered_; } | |
102 | |
103 friend class SVGResourcesCache; | 100 friend class SVGResourcesCache; |
104 void AddClient(LayoutObject*); | 101 void AddClient(LayoutObject*); |
105 void RemoveClient(LayoutObject*); | 102 bool RemoveClient(LayoutObject*); |
106 | 103 |
107 // Track global (markAllClientsForInvalidation) invals to avoid redundant | 104 // Track global (markAllClientsForInvalidation) invalidations to avoid |
108 // crawls. | 105 // redundant crawls. |
109 unsigned invalidation_mask_ : 8; | 106 unsigned invalidation_mask_ : 8; |
110 | 107 |
111 unsigned registered_ : 1; | |
112 unsigned is_invalidating_ : 1; | 108 unsigned is_invalidating_ : 1; |
113 // 22 padding bits available | 109 // 23 padding bits available |
114 | 110 |
115 HashSet<LayoutObject*> clients_; | 111 HashSet<LayoutObject*> clients_; |
116 }; | 112 }; |
117 | 113 |
118 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer, | 114 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer, |
119 IsSVGResourceContainer()); | 115 IsSVGResourceContainer()); |
120 | 116 |
121 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 117 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
122 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ | 118 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ |
123 resource->ResourceType() == typeName, \ | 119 resource->ResourceType() == typeName, \ |
124 resource.ResourceType() == typeName) | 120 resource.ResourceType() == typeName) |
125 | 121 |
126 } // namespace blink | 122 } // namespace blink |
127 | 123 |
128 #endif | 124 #endif |
OLD | NEW |