Title: [160973] trunk/Source/WebCore
Revision
160973
Author
[email protected]
Date
2013-12-21 23:01:57 -0800 (Sat, 21 Dec 2013)

Log Message

Start refactoring Filter code to reuse CachedSVGDocument for clipPath
https://bugs.webkit.org/show_bug.cgi?id=126069

Reviewed by Andreas Kling.

Smaller refactoring of the CSS filter style resolver code. Previously the code
requested the FilterOperations list from RenderStyle and compared the content
in this list with an internal map. Then the resource loading was triggered.
With the refactoring we do not request the list from RenderStyle anymore but
rely on the hash map data entirely.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::loadPendingSVGDocuments):
* platform/graphics/filters/FilterOperation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160972 => 160973)


--- trunk/Source/WebCore/ChangeLog	2013-12-22 02:45:02 UTC (rev 160972)
+++ trunk/Source/WebCore/ChangeLog	2013-12-22 07:01:57 UTC (rev 160973)
@@ -1,3 +1,20 @@
+2013-12-21  Dirk Schulze  <[email protected]>
+
+        Start refactoring Filter code to reuse CachedSVGDocument for clipPath
+        https://bugs.webkit.org/show_bug.cgi?id=126069
+
+        Reviewed by Andreas Kling.
+
+        Smaller refactoring of the CSS filter style resolver code. Previously the code
+        requested the FilterOperations list from RenderStyle and compared the content
+        in this list with an internal map. Then the resource loading was triggered.
+        With the refactoring we do not request the list from RenderStyle anymore but
+        rely on the hash map data entirely.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::loadPendingSVGDocuments):
+        * platform/graphics/filters/FilterOperation.h:
+
 2013-12-20  Andy Estes  <[email protected]>
 
         [Mac] Soft-link WebContentAnalysis.framework

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (160972 => 160973)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-12-22 02:45:02 UTC (rev 160972)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-12-22 07:01:57 UTC (rev 160973)
@@ -3418,22 +3418,18 @@
         return;
 
     CachedResourceLoader* cachedResourceLoader = state.document().cachedResourceLoader();
-    Vector<RefPtr<FilterOperation>>& filterOperations = state.style()->mutableFilter().operations();
-    for (unsigned i = 0; i < filterOperations.size(); ++i) {
-        RefPtr<FilterOperation> filterOperation = filterOperations.at(i);
-        if (filterOperation->type() == FilterOperation::REFERENCE) {
-            ReferenceFilterOperation* referenceFilter = static_cast<ReferenceFilterOperation*>(filterOperation.get());
+    for (auto it = state.pendingSVGDocuments().begin(), end = state.pendingSVGDocuments().end(); it != end; ++it) {
+        WebKitCSSSVGDocumentValue* value = it->value.get();
+        // FIXME: It is unclear why it should be null. Maybe an ASSERT instead?
+        if (!value)
+            continue;
+        CachedSVGDocument* cachedDocument = value->load(cachedResourceLoader);
+        if (!cachedDocument)
+            continue;
 
-            WebKitCSSSVGDocumentValue* value = state.pendingSVGDocuments().get(referenceFilter);
-            if (!value)
-                continue;
-            CachedSVGDocument* cachedDocument = value->load(cachedResourceLoader);
-            if (!cachedDocument)
-                continue;
-
-            // Stash the CachedSVGDocument on the reference filter.
-            referenceFilter->setCachedSVGDocumentReference(adoptPtr(new CachedSVGDocumentReference(cachedDocument)));
-        }
+        // Stash the CachedSVGDocument on the reference filter.
+        ReferenceFilterOperation& referenceFilter = *toReferenceFilterOperation(it->key);
+        referenceFilter.setCachedSVGDocumentReference(adoptPtr(new CachedSVGDocumentReference(cachedDocument)));
     }
     state.pendingSVGDocuments().clear();
 }

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h (160972 => 160973)


--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2013-12-22 02:45:02 UTC (rev 160972)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2013-12-22 07:01:57 UTC (rev 160973)
@@ -338,6 +338,11 @@
     Color m_color;
 };
 
+#define FILTER_OPERATION_CASTS(ToValueTypeName, predicate) \
+    TYPE_CASTS_BASE(ToValueTypeName, FilterOperation, operation, operation->type() == FilterOperation::predicate, operation.type() == FilterOperation::predicate)
+
+FILTER_OPERATION_CASTS(ReferenceFilterOperation, REFERENCE)
+
 } // namespace WebCore
 
 #endif // ENABLE(CSS_FILTERS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to