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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 | 78 |
79 LayoutSVGHiddenContainer::willBeDestroyed(); | 79 LayoutSVGHiddenContainer::willBeDestroyed(); |
80 if (m_registered) | 80 if (m_registered) |
81 svgExtensionsFromElement(element()).removeResource(m_id); | 81 svgExtensionsFromElement(element()).removeResource(m_id); |
82 } | 82 } |
83 | 83 |
84 void LayoutSVGResourceContainer::styleDidChange(StyleDifference diff, | 84 void LayoutSVGResourceContainer::styleDidChange(StyleDifference diff, |
85 const ComputedStyle* oldStyle) { | 85 const ComputedStyle* oldStyle) { |
86 LayoutSVGHiddenContainer::styleDidChange(diff, oldStyle); | 86 LayoutSVGHiddenContainer::styleDidChange(diff, oldStyle); |
87 | 87 |
88 for (auto* client : m_clients) { | |
89 // Check whether delete the old resource or not for client that is NoChange. | |
90 // If ResourceContainer is visible, client is visible, width and height | |
91 // are '0', the old cache should be removed and set pending resource. | |
92 LayoutRect boundingBox = client->visualRect(); | |
93 if (style()->visibility() == EVisibility::Visible && | |
fs
2017/01/05 17:01:47
I think this may be starting to approach the right
| |
94 client->style()->visibility() == EVisibility::Visible && | |
95 !boundingBox.width() && !boundingBox.height()) | |
96 { | |
97 SVGResources* resources = | |
98 SVGResourcesCache::cachedResourcesForLayoutObject(client); | |
99 if (resources) { | |
100 // Remove the old resource. | |
fs
2017/01/05 17:01:47
This looks too heavy-handed, if you wanted to inva
| |
101 resources->resourceDestroyed(this); | |
102 Element* clientElement = toElement(client->node()); | |
103 svgExtensionsFromElement(clientElement) | |
104 .addPendingResource(m_id, clientElement); | |
105 m_registered = false; | |
106 } | |
107 } | |
108 } | |
109 | |
88 if (!m_registered) { | 110 if (!m_registered) { |
89 m_registered = true; | 111 m_registered = true; |
90 registerResource(); | 112 registerResource(); |
91 } | 113 } |
92 } | 114 } |
93 | 115 |
94 void LayoutSVGResourceContainer::detachAllClients() { | 116 void LayoutSVGResourceContainer::detachAllClients() { |
95 for (auto* client : m_clients) { | 117 for (auto* client : m_clients) { |
96 // Unlink the resource from the client's SVGResources. (The actual | 118 // Unlink the resource from the client's SVGResources. (The actual |
97 // removal will be signaled after processing all the clients.) | 119 // removal will be signaled after processing all the clients.) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 // This will process the rest of the ancestors. | 332 // This will process the rest of the ancestors. |
311 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); | 333 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); |
312 break; | 334 break; |
313 } | 335 } |
314 | 336 |
315 current = current->parent(); | 337 current = current->parent(); |
316 } | 338 } |
317 } | 339 } |
318 | 340 |
319 } // namespace blink | 341 } // namespace blink |
OLD | NEW |