| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 SVGResourcesCache::~SVGResourcesCache() | 35 SVGResourcesCache::~SVGResourcesCache() |
| 36 { | 36 { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void SVGResourcesCache::addResourcesFromLayoutObject(LayoutObject* object, const
ComputedStyle& style) | 39 void SVGResourcesCache::addResourcesFromLayoutObject(LayoutObject* object, const
ComputedStyle& style) |
| 40 { | 40 { |
| 41 ASSERT(object); | 41 ASSERT(object); |
| 42 ASSERT(!m_cache.contains(object)); | 42 ASSERT(!m_cache.contains(object)); |
| 43 | 43 |
| 44 const SVGComputedStyle& svgStyle = style.svgStyle(); | |
| 45 | |
| 46 // Build a list of all resources associated with the passed LayoutObject. | 44 // Build a list of all resources associated with the passed LayoutObject. |
| 47 std::unique_ptr<SVGResources> newResources = SVGResources::buildResources(ob
ject, svgStyle); | 45 std::unique_ptr<SVGResources> newResources = SVGResources::buildResources(ob
ject, style); |
| 48 if (!newResources) | 46 if (!newResources) |
| 49 return; | 47 return; |
| 50 | 48 |
| 51 // Put object in cache. | 49 // Put object in cache. |
| 52 SVGResources* resources = m_cache.set(object, std::move(newResources)).store
dValue->value.get(); | 50 SVGResources* resources = m_cache.set(object, std::move(newResources)).store
dValue->value.get(); |
| 53 | 51 |
| 54 // Run cycle-detection _afterwards_, so self-references can be caught as wel
l. | 52 // Run cycle-detection _afterwards_, so self-references can be caught as wel
l. |
| 55 SVGResourcesCycleSolver solver(object, resources); | 53 SVGResourcesCycleSolver solver(object, resources); |
| 56 solver.resolveCycles(); | 54 solver.resolveCycles(); |
| 57 | 55 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 ASSERT(layoutObject); | 161 ASSERT(layoutObject); |
| 164 | 162 |
| 165 SVGResources* resources = cachedResourcesForLayoutObject(layoutObject); | 163 SVGResources* resources = cachedResourcesForLayoutObject(layoutObject); |
| 166 if (resources) | 164 if (resources) |
| 167 resources->removeClientFromCache(layoutObject); | 165 resources->removeClientFromCache(layoutObject); |
| 168 SVGResourcesCache& cache = resourcesCache(layoutObject->document()); | 166 SVGResourcesCache& cache = resourcesCache(layoutObject->document()); |
| 169 cache.removeResourcesFromLayoutObject(layoutObject); | 167 cache.removeResourcesFromLayoutObject(layoutObject); |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |