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 #include "config.h" | 20 #include "config.h" |
21 | 21 |
22 #include "core/rendering/svg/RenderSVGResourceContainer.h" | 22 #include "core/rendering/svg/RenderSVGResourceContainer.h" |
23 | 23 |
| 24 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
24 #include "core/rendering/RenderLayer.h" | 25 #include "core/rendering/RenderLayer.h" |
25 #include "core/rendering/RenderView.h" | 26 #include "core/rendering/RenderView.h" |
26 #include "core/rendering/svg/SVGRenderingContext.h" | 27 #include "core/rendering/svg/SVGRenderingContext.h" |
27 #include "core/rendering/svg/SVGResourcesCache.h" | 28 #include "core/rendering/svg/SVGResourcesCache.h" |
28 #include "core/svg/SVGGraphicsElement.h" | 29 #include "core/svg/SVGGraphicsElement.h" |
29 | 30 |
30 #include "wtf/TemporaryChange.h" | 31 #include "wtf/TemporaryChange.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Remove old id, that is guaranteed to be present in cache. | 93 // Remove old id, that is guaranteed to be present in cache. |
93 SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); | 94 SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); |
94 extensions.removeResource(m_id); | 95 extensions.removeResource(m_id); |
95 m_id = element()->getIdAttribute(); | 96 m_id = element()->getIdAttribute(); |
96 | 97 |
97 registerResource(); | 98 registerResource(); |
98 } | 99 } |
99 | 100 |
100 void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode
mode) | 101 void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode
mode) |
101 { | 102 { |
102 if ((m_clients.isEmpty() && m_clientLayers.isEmpty()) || m_isInvalidating) | 103 if ((m_clients.isEmpty()) || m_isInvalidating) |
103 return; | 104 return; |
104 | 105 |
105 if (m_invalidationMask & mode) | 106 if (m_invalidationMask & mode) |
106 return; | 107 return; |
107 | 108 |
108 m_invalidationMask |= mode; | 109 m_invalidationMask |= mode; |
109 m_isInvalidating = true; | 110 m_isInvalidating = true; |
110 bool needsLayout = mode == LayoutAndBoundariesInvalidation; | 111 bool needsLayout = mode == LayoutAndBoundariesInvalidation; |
111 bool markForInvalidation = mode != ParentOnlyInvalidation; | 112 bool markForInvalidation = mode != ParentOnlyInvalidation; |
112 | 113 |
113 HashSet<RenderObject*>::iterator end = m_clients.end(); | 114 HashSet<RenderObject*>::iterator end = m_clients.end(); |
114 for (HashSet<RenderObject*>::iterator it = m_clients.begin(); it != end; ++i
t) { | 115 for (HashSet<RenderObject*>::iterator it = m_clients.begin(); it != end; ++i
t) { |
115 RenderObject* client = *it; | 116 RenderObject* client = *it; |
116 if (client->isSVGResourceContainer()) { | 117 if (client->isSVGResourceContainer()) { |
117 toRenderSVGResourceContainer(client)->removeAllClientsFromCache(mark
ForInvalidation); | 118 toRenderSVGResourceContainer(client)->removeAllClientsFromCache(mark
ForInvalidation); |
118 continue; | 119 continue; |
119 } | 120 } |
120 | 121 |
121 if (markForInvalidation) | 122 if (markForInvalidation) |
122 markClientForInvalidation(client, mode); | 123 markClientForInvalidation(client, mode); |
123 | 124 |
124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, ne
edsLayout); | 125 RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, ne
edsLayout); |
125 } | 126 } |
126 | 127 |
127 markAllClientLayersForInvalidation(); | |
128 | |
129 m_isInvalidating = false; | 128 m_isInvalidating = false; |
130 } | 129 } |
131 | 130 |
132 void RenderSVGResourceContainer::markAllClientLayersForInvalidation() | |
133 { | |
134 HashSet<RenderLayer*>::iterator layerEnd = m_clientLayers.end(); | |
135 for (HashSet<RenderLayer*>::iterator it = m_clientLayers.begin(); it != laye
rEnd; ++it) | |
136 (*it)->filterNeedsPaintInvalidation(); | |
137 } | |
138 | |
139 void RenderSVGResourceContainer::markClientForInvalidation(RenderObject* client,
InvalidationMode mode) | 131 void RenderSVGResourceContainer::markClientForInvalidation(RenderObject* client,
InvalidationMode mode) |
140 { | 132 { |
141 ASSERT(client); | 133 ASSERT(client); |
142 ASSERT(!m_clients.isEmpty()); | 134 ASSERT(!m_clients.isEmpty()); |
143 | 135 |
| 136 { |
| 137 DeprecatedScheduleStyleRecalcDuringLayout marker(client->document().life
cycle()); |
| 138 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl
e recalc, which |
| 139 // is a problem because this function can be called while performing lay
out. |
| 140 // Presumably this represents an illegal data flow of layout or composit
ing |
| 141 // information into the style system. |
| 142 toElement(client->node())->scheduleSVGFilterLayerUpdateHack(); |
| 143 } |
| 144 |
144 switch (mode) { | 145 switch (mode) { |
145 case LayoutAndBoundariesInvalidation: | 146 case LayoutAndBoundariesInvalidation: |
146 case BoundariesInvalidation: | 147 case BoundariesInvalidation: |
147 client->setNeedsBoundariesUpdate(); | 148 client->setNeedsBoundariesUpdate(); |
148 break; | 149 break; |
149 case RepaintInvalidation: | 150 case RepaintInvalidation: |
150 if (client->view()) { | 151 if (client->view()) { |
151 if (frameView()->isInPerformLayout()) | 152 if (frameView()->isInPerformLayout()) |
152 client->setShouldDoFullPaintInvalidation(true); | 153 client->setShouldDoFullPaintInvalidation(true); |
153 else | 154 else |
(...skipping 12 matching lines...) Expand all Loading... |
166 clearInvalidationMask(); | 167 clearInvalidationMask(); |
167 } | 168 } |
168 | 169 |
169 void RenderSVGResourceContainer::removeClient(RenderObject* client) | 170 void RenderSVGResourceContainer::removeClient(RenderObject* client) |
170 { | 171 { |
171 ASSERT(client); | 172 ASSERT(client); |
172 removeClientFromCache(client, false); | 173 removeClientFromCache(client, false); |
173 m_clients.remove(client); | 174 m_clients.remove(client); |
174 } | 175 } |
175 | 176 |
176 void RenderSVGResourceContainer::addClientRenderLayer(Node* node) | |
177 { | |
178 ASSERT(node); | |
179 if (!node->renderer() || !node->renderer()->hasLayer()) | |
180 return; | |
181 m_clientLayers.add(toRenderLayerModelObject(node->renderer())->layer()); | |
182 clearInvalidationMask(); | |
183 } | |
184 | |
185 void RenderSVGResourceContainer::addClientRenderLayer(RenderLayer* client) | |
186 { | |
187 ASSERT(client); | |
188 m_clientLayers.add(client); | |
189 clearInvalidationMask(); | |
190 } | |
191 | |
192 void RenderSVGResourceContainer::removeClientRenderLayer(RenderLayer* client) | |
193 { | |
194 ASSERT(client); | |
195 m_clientLayers.remove(client); | |
196 } | |
197 | |
198 void RenderSVGResourceContainer::invalidateCacheAndMarkForLayout(SubtreeLayoutSc
ope* layoutScope) | 177 void RenderSVGResourceContainer::invalidateCacheAndMarkForLayout(SubtreeLayoutSc
ope* layoutScope) |
199 { | 178 { |
200 if (selfNeedsLayout()) | 179 if (selfNeedsLayout()) |
201 return; | 180 return; |
202 | 181 |
203 setNeedsLayoutAndFullPaintInvalidation(MarkContainingBlockChain, layoutScope
); | 182 setNeedsLayoutAndFullPaintInvalidation(MarkContainingBlockChain, layoutScope
); |
204 | 183 |
205 if (everHadLayout()) | 184 if (everHadLayout()) |
206 removeAllClientsFromCache(); | 185 removeAllClientsFromCache(); |
207 } | 186 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (!object->isSVGShape()) | 257 if (!object->isSVGShape()) |
279 return resourceTransform; | 258 return resourceTransform; |
280 | 259 |
281 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); | 260 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); |
282 AffineTransform transform = element->getScreenCTM(SVGGraphicsElement::Disall
owStyleUpdate); | 261 AffineTransform transform = element->getScreenCTM(SVGGraphicsElement::Disall
owStyleUpdate); |
283 transform *= resourceTransform; | 262 transform *= resourceTransform; |
284 return transform; | 263 return transform; |
285 } | 264 } |
286 | 265 |
287 } | 266 } |
OLD | NEW |