| 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 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return; | 103 return; |
| 104 | 104 |
| 105 if (m_invalidationMask & mode) | 105 if (m_invalidationMask & mode) |
| 106 return; | 106 return; |
| 107 | 107 |
| 108 m_invalidationMask |= mode; | 108 m_invalidationMask |= mode; |
| 109 m_isInvalidating = true; | 109 m_isInvalidating = true; |
| 110 bool needsLayout = mode == LayoutAndBoundariesInvalidation; | 110 bool needsLayout = mode == LayoutAndBoundariesInvalidation; |
| 111 bool markForInvalidation = mode != ParentOnlyInvalidation; | 111 bool markForInvalidation = mode != ParentOnlyInvalidation; |
| 112 | 112 |
| 113 HashSet<LayoutObject*>::iterator end = m_clients.end(); | 113 for (auto* client : m_clients) { |
| 114 for (HashSet<LayoutObject*>::iterator it = m_clients.begin(); it != end; ++i
t) { | |
| 115 LayoutObject* client = *it; | |
| 116 if (client->isSVGResourceContainer()) { | 114 if (client->isSVGResourceContainer()) { |
| 117 toLayoutSVGResourceContainer(client)->removeAllClientsFromCache(mark
ForInvalidation); | 115 toLayoutSVGResourceContainer(client)->removeAllClientsFromCache(mark
ForInvalidation); |
| 118 continue; | 116 continue; |
| 119 } | 117 } |
| 120 | 118 |
| 121 if (markForInvalidation) | 119 if (markForInvalidation) |
| 122 markClientForInvalidation(client, mode); | 120 markClientForInvalidation(client, mode); |
| 123 | 121 |
| 124 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(c
lient, needsLayout); | 122 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(c
lient, needsLayout); |
| 125 } | 123 } |
| 126 | 124 |
| 127 markAllClientLayersForInvalidation(); | 125 markAllClientLayersForInvalidation(); |
| 128 | 126 |
| 129 m_isInvalidating = false; | 127 m_isInvalidating = false; |
| 130 } | 128 } |
| 131 | 129 |
| 132 void LayoutSVGResourceContainer::markAllClientLayersForInvalidation() | 130 void LayoutSVGResourceContainer::markAllClientLayersForInvalidation() |
| 133 { | 131 { |
| 134 HashSet<DeprecatedPaintLayer*>::iterator layerEnd = m_clientLayers.end(); | 132 for (auto* layer : m_clientLayers) |
| 135 for (HashSet<DeprecatedPaintLayer*>::iterator it = m_clientLayers.begin(); i
t != layerEnd; ++it) | 133 layer->filterNeedsPaintInvalidation(); |
| 136 (*it)->filterNeedsPaintInvalidation(); | |
| 137 } | 134 } |
| 138 | 135 |
| 139 void LayoutSVGResourceContainer::markClientForInvalidation(LayoutObject* client,
InvalidationMode mode) | 136 void LayoutSVGResourceContainer::markClientForInvalidation(LayoutObject* client,
InvalidationMode mode) |
| 140 { | 137 { |
| 141 ASSERT(client); | 138 ASSERT(client); |
| 142 ASSERT(!m_clients.isEmpty()); | 139 ASSERT(!m_clients.isEmpty()); |
| 143 | 140 |
| 144 switch (mode) { | 141 switch (mode) { |
| 145 case LayoutAndBoundariesInvalidation: | 142 case LayoutAndBoundariesInvalidation: |
| 146 case BoundariesInvalidation: | 143 case BoundariesInvalidation: |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if (!dependencies) | 247 if (!dependencies) |
| 251 return; | 248 return; |
| 252 | 249 |
| 253 // We allow cycles in SVGDocumentExtensions reference sets in order to avoid
expensive | 250 // We allow cycles in SVGDocumentExtensions reference sets in order to avoid
expensive |
| 254 // reference graph adjustments on changes, so we need to break possible cycl
es here. | 251 // reference graph adjustments on changes, so we need to break possible cycl
es here. |
| 255 // This strong reference is safe, as it is guaranteed that this set will be
emptied | 252 // This strong reference is safe, as it is guaranteed that this set will be
emptied |
| 256 // at the end of recursion. | 253 // at the end of recursion. |
| 257 typedef WillBeHeapHashSet<RawPtrWillBeMember<SVGElement>> SVGElementSet; | 254 typedef WillBeHeapHashSet<RawPtrWillBeMember<SVGElement>> SVGElementSet; |
| 258 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SVGElementSet>, invalidatingDepen
dencies, (adoptPtrWillBeNoop(new SVGElementSet))); | 255 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SVGElementSet>, invalidatingDepen
dencies, (adoptPtrWillBeNoop(new SVGElementSet))); |
| 259 | 256 |
| 260 SVGElementSet::iterator end = dependencies->end(); | 257 for (auto* element : *dependencies) { |
| 261 for (SVGElementSet::iterator it = dependencies->begin(); it != end; ++it) { | 258 if (LayoutObject* layoutObject = element->layoutObject()) { |
| 262 if (LayoutObject* layoutObject = (*it)->layoutObject()) { | 259 if (UNLIKELY(!invalidatingDependencies->add(element).isNewEntry)) { |
| 263 if (UNLIKELY(!invalidatingDependencies->add(*it).isNewEntry)) { | |
| 264 // Reference cycle: we are in process of invalidating this depen
dant. | 260 // Reference cycle: we are in process of invalidating this depen
dant. |
| 265 continue; | 261 continue; |
| 266 } | 262 } |
| 267 | 263 |
| 268 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidati
on(layoutObject, needsLayout); | 264 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidati
on(layoutObject, needsLayout); |
| 269 invalidatingDependencies->remove(*it); | 265 invalidatingDependencies->remove(element); |
| 270 } | 266 } |
| 271 } | 267 } |
| 272 } | 268 } |
| 273 | 269 |
| 274 void LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(Layo
utObject* object, bool needsLayout) | 270 void LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(Layo
utObject* object, bool needsLayout) |
| 275 { | 271 { |
| 276 ASSERT(object); | 272 ASSERT(object); |
| 277 ASSERT(object->node()); | 273 ASSERT(object->node()); |
| 278 | 274 |
| 279 if (needsLayout && !object->documentBeingDestroyed()) | 275 if (needsLayout && !object->documentBeingDestroyed()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 290 // This will process the rest of the ancestors. | 286 // This will process the rest of the ancestors. |
| 291 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); | 287 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); |
| 292 break; | 288 break; |
| 293 } | 289 } |
| 294 | 290 |
| 295 current = current->parent(); | 291 current = current->parent(); |
| 296 } | 292 } |
| 297 } | 293 } |
| 298 | 294 |
| 299 } | 295 } |
| OLD | NEW |