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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void SVGResourcesCache::ClientDestroyed(LayoutObject* layout_object) { | 179 void SVGResourcesCache::ClientDestroyed(LayoutObject* layout_object) { |
180 DCHECK(layout_object); | 180 DCHECK(layout_object); |
181 | 181 |
182 SVGResources* resources = CachedResourcesForLayoutObject(layout_object); | 182 SVGResources* resources = CachedResourcesForLayoutObject(layout_object); |
183 if (resources) | 183 if (resources) |
184 resources->RemoveClientFromCache(layout_object); | 184 resources->RemoveClientFromCache(layout_object); |
185 SVGResourcesCache& cache = ResourcesCache(layout_object->GetDocument()); | 185 SVGResourcesCache& cache = ResourcesCache(layout_object->GetDocument()); |
186 cache.RemoveResourcesFromLayoutObject(layout_object); | 186 cache.RemoveResourcesFromLayoutObject(layout_object); |
187 } | 187 } |
188 | 188 |
| 189 SVGResourcesCache::TemporaryStyleScope::TemporaryStyleScope( |
| 190 LayoutObject& layout_object, |
| 191 const ComputedStyle& style, |
| 192 const ComputedStyle& temporary_style) |
| 193 : layout_object_(layout_object), |
| 194 original_style_(style), |
| 195 styles_are_equal_(style == temporary_style) { |
| 196 SwitchTo(temporary_style); |
| 197 } |
| 198 |
| 199 void SVGResourcesCache::TemporaryStyleScope::SwitchTo( |
| 200 const ComputedStyle& style) { |
| 201 DCHECK(LayoutObjectCanHaveResources(&layout_object_)); |
| 202 if (styles_are_equal_) |
| 203 return; |
| 204 SVGResourcesCache& cache = ResourcesCache(layout_object_.GetDocument()); |
| 205 cache.RemoveResourcesFromLayoutObject(&layout_object_); |
| 206 cache.AddResourcesFromLayoutObject(&layout_object_, style); |
| 207 } |
| 208 |
189 } // namespace blink | 209 } // namespace blink |
OLD | NEW |