Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp

Issue 2714473002: Move LayoutSVGResourceContainer registration to SVGTreeScopeResources (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f7056fd2bd0098cb316a574e9499cd9fd3719185..f3f7f85e16b1386236777172bf8704303111ddad 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
@@ -82,10 +82,10 @@ void LayoutSVGResourceContainer::styleDidChange(StyleDifference diff,
const ComputedStyle* oldStyle) {
LayoutSVGHiddenContainer::styleDidChange(diff, oldStyle);
- if (!m_registered) {
- m_registered = true;
- registerResource();
- }
+ if (m_registered)
+ return;
+ m_registered = true;
+ svgTreeScopeResourcesFromElement(element()).updateResource(m_id, this);
}
void LayoutSVGResourceContainer::detachAllClients() {
@@ -116,8 +116,7 @@ void LayoutSVGResourceContainer::idChanged() {
svgTreeScopeResourcesFromElement(element());
treeScopeResources.removeResource(m_id);
m_id = element()->getIdAttribute();
-
- registerResource();
+ treeScopeResources.updateResource(m_id, this);
}
void LayoutSVGResourceContainer::markAllClientsForInvalidation(
@@ -209,38 +208,6 @@ void LayoutSVGResourceContainer::invalidateCacheAndMarkForLayout(
removeAllClientsFromCache();
}
-void LayoutSVGResourceContainer::registerResource() {
- SVGTreeScopeResources& treeScopeResources =
- svgTreeScopeResourcesFromElement(element());
- if (!treeScopeResources.hasPendingResource(m_id)) {
- treeScopeResources.addResource(m_id, this);
- return;
- }
-
- SVGTreeScopeResources::SVGPendingElements* clients(
- treeScopeResources.removePendingResource(m_id));
-
- // Cache us with the new id.
- treeScopeResources.addResource(m_id, this);
-
- // Update cached resources of pending clients.
- for (const auto& pendingClient : *clients) {
- DCHECK(pendingClient->hasPendingResources());
- treeScopeResources.clearHasPendingResourcesIfPossible(pendingClient);
- LayoutObject* layoutObject = pendingClient->layoutObject();
- if (!layoutObject)
- continue;
- DCHECK(layoutObject->isSVG());
-
- StyleDifference diff;
- diff.setNeedsFullLayout();
- SVGResourcesCache::clientStyleChanged(layoutObject, diff,
- layoutObject->styleRef());
- layoutObject->setNeedsLayoutAndFullPaintInvalidation(
- LayoutInvalidationReason::SvgResourceInvalidated);
- }
-}
-
static inline void removeFromCacheAndInvalidateDependencies(
LayoutObject* object,
bool needsLayout) {

Powered by Google App Engine
This is Rietveld 408576698