| 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 0d3edd3cd90d08a7564b4c5a0e523ca03ffe124b..3fc824844162e8b2c778f0f81c03ce12890a9b92 100644
|
| --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
|
| @@ -25,9 +25,7 @@
|
| #include "core/layout/svg/LayoutSVGResourceMasker.h"
|
| #include "core/layout/svg/SVGResources.h"
|
| #include "core/layout/svg/SVGResourcesCache.h"
|
| -#include "core/paint/PaintLayer.h"
|
| -#include "core/svg/SVGFilterElement.h"
|
| -
|
| +#include "core/svg/SVGElementProxy.h"
|
| #include "wtf/AutoReset.h"
|
|
|
| namespace blink {
|
| @@ -63,16 +61,17 @@ void LayoutSVGResourceContainer::layout() {
|
| clearInvalidationMask();
|
| }
|
|
|
| +void LayoutSVGResourceContainer::notifyContentChanged() {
|
| + if (SVGElementProxySet* proxySet = elementProxySet())
|
| + proxySet->notifyContentChanged(element()->treeScope());
|
| +}
|
| +
|
| void LayoutSVGResourceContainer::willBeDestroyed() {
|
| // Detach all clients referring to this resource. If the resource itself is
|
| // a client, it will be detached from any such resources by the call to
|
| // LayoutSVGHiddenContainer::willBeDestroyed() below.
|
| detachAllClients();
|
|
|
| - for (SVGResourceClient* client : m_resourceClients)
|
| - client->filterWillBeDestroyed(toSVGFilterElement(element()));
|
| - m_resourceClients.clear();
|
| -
|
| LayoutSVGHiddenContainer::willBeDestroyed();
|
| if (m_registered)
|
| svgExtensionsFromElement(element()).removeResource(m_id);
|
| @@ -121,9 +120,11 @@ void LayoutSVGResourceContainer::idChanged() {
|
|
|
| void LayoutSVGResourceContainer::markAllClientsForInvalidation(
|
| InvalidationMode mode) {
|
| - if ((m_clients.isEmpty() && m_resourceClients.isEmpty()) || m_isInvalidating)
|
| + if (m_isInvalidating)
|
| + return;
|
| + SVGElementProxySet* proxySet = elementProxySet();
|
| + if (m_clients.isEmpty() && (!proxySet || proxySet->isEmpty()))
|
| return;
|
| -
|
| if (m_invalidationMask & mode)
|
| return;
|
|
|
| @@ -132,7 +133,9 @@ void LayoutSVGResourceContainer::markAllClientsForInvalidation(
|
| bool needsLayout = mode == LayoutAndBoundariesInvalidation;
|
| bool markForInvalidation = mode != ParentOnlyInvalidation;
|
|
|
| + // Invalidate clients registered on the this object (via SVGResources).
|
| for (auto* client : m_clients) {
|
| + DCHECK(client->isSVG());
|
| if (client->isSVGResourceContainer()) {
|
| toLayoutSVGResourceContainer(client)->removeAllClientsFromCache(
|
| markForInvalidation);
|
| @@ -146,16 +149,12 @@ void LayoutSVGResourceContainer::markAllClientsForInvalidation(
|
| client, needsLayout);
|
| }
|
|
|
| - markAllResourceClientsForInvalidation();
|
| + // Invalidate clients registered via an SVGElementProxy.
|
| + notifyContentChanged();
|
|
|
| m_isInvalidating = false;
|
| }
|
|
|
| -void LayoutSVGResourceContainer::markAllResourceClientsForInvalidation() {
|
| - for (SVGResourceClient* client : m_resourceClients)
|
| - client->filterNeedsInvalidation();
|
| -}
|
| -
|
| void LayoutSVGResourceContainer::markClientForInvalidation(
|
| LayoutObject* client,
|
| InvalidationMode mode) {
|
| @@ -193,18 +192,6 @@ void LayoutSVGResourceContainer::removeClient(LayoutObject* client) {
|
| m_clients.remove(client);
|
| }
|
|
|
| -void LayoutSVGResourceContainer::addResourceClient(SVGResourceClient* client) {
|
| - ASSERT(client);
|
| - m_resourceClients.add(client);
|
| - clearInvalidationMask();
|
| -}
|
| -
|
| -void LayoutSVGResourceContainer::removeResourceClient(
|
| - SVGResourceClient* client) {
|
| - ASSERT(client);
|
| - m_resourceClients.remove(client);
|
| -}
|
| -
|
| void LayoutSVGResourceContainer::invalidateCacheAndMarkForLayout(
|
| SubtreeLayoutScope* layoutScope) {
|
| if (selfNeedsLayout())
|
| @@ -233,32 +220,18 @@ void LayoutSVGResourceContainer::registerResource() {
|
|
|
| // Update cached resources of pending clients.
|
| for (const auto& pendingClient : *clients) {
|
| - ASSERT(pendingClient->hasPendingResources());
|
| + DCHECK(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())
|
| - continue;
|
| - toLayoutBoxModelObject(layoutObject)
|
| - ->layer()
|
| - ->filterNeedsPaintInvalidation();
|
| - if (!layoutObject->isSVGRoot())
|
| - continue;
|
| - // A root SVG element with a filter, however, still needs to run
|
| - // the full invalidation step below.
|
| - }
|
| + DCHECK(layoutObject->isSVG() && (resourceType() != FilterResourceType ||
|
| + !layoutObject->isSVGRoot()));
|
|
|
| StyleDifference diff;
|
| diff.setNeedsFullLayout();
|
| - SVGResourcesCache::clientStyleChanged(layoutObject, diff, style);
|
| + SVGResourcesCache::clientStyleChanged(layoutObject, diff,
|
| + layoutObject->styleRef());
|
| layoutObject->setNeedsLayoutAndFullPaintInvalidation(
|
| LayoutInvalidationReason::SvgResourceInvalidated);
|
| }
|
|
|