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

Unified Diff: third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp

Issue 2401343002: Tracking filter mutation via SVGElementProxy (Closed)
Patch Set: Rebase Created 4 years, 1 month 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/css/resolver/ElementStyleResources.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
index 97bbc8779773203c9f9f874d67edfb4deea98519..c3da62717fd0217cfe228699c1307a38170945be 100644
--- a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
@@ -30,7 +30,6 @@
#include "core/css/CSSURIValue.h"
#include "core/dom/Document.h"
#include "core/fetch/ResourceFetcher.h"
-#include "core/layout/svg/ReferenceFilterBuilder.h"
#include "core/style/ComputedStyle.h"
#include "core/style/ContentData.h"
#include "core/style/CursorData.h"
@@ -42,6 +41,7 @@
#include "core/style/StyleImage.h"
#include "core/style/StyleInvalidImage.h"
#include "core/style/StylePendingImage.h"
+#include "core/svg/SVGElementProxy.h"
namespace blink {
@@ -108,36 +108,23 @@ StyleImage* ElementStyleResources::cursorOrPendingFromValue(
return value.cachedImage(m_deviceScaleFactor);
}
-void ElementStyleResources::addPendingSVGDocument(
- FilterOperation* filterOperation,
- const CSSURIValue* cssUriValue) {
- m_pendingSVGDocuments.set(filterOperation, cssUriValue);
+SVGElementProxy& ElementStyleResources::cachedOrPendingFromValue(
+ const CSSURIValue& value) {
+ return value.ensureElementProxy(*m_document);
}
void ElementStyleResources::loadPendingSVGDocuments(
ComputedStyle* computedStyle) {
- if (!computedStyle->hasFilter() || m_pendingSVGDocuments.isEmpty())
+ if (!computedStyle->hasFilter())
return;
-
FilterOperations::FilterOperationVector& filterOperations =
computedStyle->mutableFilter().operations();
- for (unsigned i = 0; i < filterOperations.size(); ++i) {
- FilterOperation* filterOperation = filterOperations.at(i);
- if (filterOperation->type() == FilterOperation::REFERENCE) {
- ReferenceFilterOperation* referenceFilter =
- toReferenceFilterOperation(filterOperation);
-
- const CSSURIValue* value = m_pendingSVGDocuments.get(referenceFilter);
- if (!value)
- continue;
- DocumentResource* resource = value->load(*m_document);
- if (!resource)
- continue;
-
- // Stash the DocumentResource on the reference filter.
- ReferenceFilterBuilder::setDocumentResourceReference(
- referenceFilter, new DocumentResourceReference(resource));
- }
+ for (auto& filterOperation : filterOperations) {
+ if (filterOperation->type() != FilterOperation::REFERENCE)
+ continue;
+ ReferenceFilterOperation& referenceOperation =
+ toReferenceFilterOperation(*filterOperation);
+ referenceOperation.elementProxy().resolve(*m_document);
}
}

Powered by Google App Engine
This is Rietveld 408576698