Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp |
index 6bfb64b4d40e99dad8fb6f6fbf6be7633253c801..a79b0ef368db447b2cc6859ef204190305a64d2f 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp |
@@ -85,6 +85,28 @@ void LayoutSVGResourceContainer::styleDidChange(StyleDifference diff, |
const ComputedStyle* oldStyle) { |
LayoutSVGHiddenContainer::styleDidChange(diff, oldStyle); |
+ for (auto* client : m_clients) { |
+ // Check whether delete the old resource or not for client that is NoChange. |
+ // If ResourceContainer is visible, client is visible, width and height |
+ // are '0', the old cache should be removed and set pending resource. |
+ LayoutRect boundingBox = client->visualRect(); |
+ if (style()->visibility() == EVisibility::Visible && |
fs
2017/01/05 17:01:47
I think this may be starting to approach the right
|
+ client->style()->visibility() == EVisibility::Visible && |
+ !boundingBox.width() && !boundingBox.height()) |
+ { |
+ SVGResources* resources = |
+ SVGResourcesCache::cachedResourcesForLayoutObject(client); |
+ if (resources) { |
+ // Remove the old resource. |
fs
2017/01/05 17:01:47
This looks too heavy-handed, if you wanted to inva
|
+ resources->resourceDestroyed(this); |
+ Element* clientElement = toElement(client->node()); |
+ svgExtensionsFromElement(clientElement) |
+ .addPendingResource(m_id, clientElement); |
+ m_registered = false; |
+ } |
+ } |
+ } |
+ |
if (!m_registered) { |
m_registered = true; |
registerResource(); |