void RenderSVGResourceContainer::registerResource() { SVGDocumentExtensions* extensions = svgExtensionsFromNode(node()); if (!extensions->hasPendingResource(m_id)) { extensions->addResource(m_id, this); return; } OwnPtr<SVGDocumentExtensions::SVGPendingElements> clients(extensions->removePendingResource(m_id)); // Cache us with the new id. extensions->addResource(m_id, this); // Update cached resources of pending clients. const SVGDocumentExtensions::SVGPendingElements::const_iterator end = clients->end(); for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it) { ASSERT((*it)->hasPendingResources()); extensions->clearHasPendingResourcesIfPossible(*it); RenderObject* renderer = (*it)->renderer(); if (!renderer) continue; SVGResourcesCache::clientStyleChanged(renderer, StyleDifferenceLayout, renderer->style()); renderer->setNeedsLayout(true); } }
void SVGElement::insertedIntoDocument() { StyledElement::insertedIntoDocument(); SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); String resourceId = SVGURIReference::getTarget(id()); if (extensions->isPendingResource(resourceId)) { std::auto_ptr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); if (clients->isEmpty()) return; HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); for (; it != end; ++it) (*it)->buildPendingResource(); SVGResource::invalidateClients(*clients); } }