StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) const { // Note, we use .get() on each DataRef below because DataRef::operator== will do a deep // compare, which is duplicate work when we're going to compare each property inside // this function anyway. StyleDifference diff; if (diffNeedsFullLayout(other)) { diff.setNeedsFullLayout(); } else if (position() != StaticPosition && surround->offset != other.surround->offset) { // Optimize for the case where a positioned layer is moving but not changing size. if (positionedObjectMovedOnly(surround->offset, other.surround->offset, m_box->width())) diff.setNeedsPositionedMovementLayout(); else diff.setNeedsFullLayout(); } updatePropertySpecificDifferences(other, diff); // Cursors are not checked, since they will be set appropriately in response to mouse events, // so they don't need to cause any paint invalidation or layout. return diff; }
void RenderSVGResourceContainer::registerResource() { SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); 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; StyleDifference diff; diff.setNeedsFullLayout(); SVGResourcesCache::clientStyleChanged(renderer, diff, renderer->style()); renderer->setNeedsLayoutAndFullPaintInvalidation(); } }
StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const { StyleDifference styleDifference; if (diffNeedsLayoutAndPaintInvalidation(other)) { styleDifference.setNeedsFullLayout(); styleDifference.setNeedsPaintInvalidationObject(); } else if (diffNeedsPaintInvalidation(other)) { styleDifference.setNeedsPaintInvalidationObject(); } return styleDifference; }
StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const { StyleDifference styleDifference; if (diffNeedsLayoutAndRepaint(other)) { styleDifference.setNeedsFullLayout(); styleDifference.setNeedsRepaintObject(); } else if (diffNeedsRepaint(other)) { styleDifference.setNeedsRepaintObject(); } return styleDifference; }
void LayoutSVGResourceContainer::registerResource() { SVGDocumentExtensions& extensions = svgExtensionsFromElement(element()); if (!extensions.hasPendingResource(m_id)) { extensions.addResource(m_id, this); return; } SVGDocumentExtensions::SVGPendingElements* clients(extensions.removePendingResource(m_id)); // Cache us with the new id. extensions.addResource(m_id, this); // Update cached resources of pending clients. for (const auto& pendingClient : *clients) { ASSERT(pendingClient->hasPendingResources()); extensions.clearHasPendingResourcesIfPossible(pendingClient); LayoutObject* layoutObject = pendingClient->layoutObject(); if (!layoutObject) continue; const ComputedStyle& style = layoutObject->styleRef(); // If the client has a layer (is a non-SVGElement) we need to signal // invalidation in the same way as is done in markAllResourceClientsForInvalidation above. if (layoutObject->hasLayer() && resourceType() == FilterResourceType) { if (style.hasFilter()) toLayoutBoxModelObject(layoutObject)->layer()->filterNeedsPaintInvalidation(); // If this is the SVG root, we could have both 'filter' and // '-webkit-filter' applied, so we need to do the invalidation // below as well, unless we can optimistically determine that // 'filter' does not apply to the element in question. if (!layoutObject->isSVGRoot() || !style.svgStyle().hasFilter()) continue; } StyleDifference diff; diff.setNeedsFullLayout(); SVGResourcesCache::clientStyleChanged(layoutObject, diff, style); layoutObject->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::SvgResourceInvalidated); } }