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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 13984002: Extracting the SVG Filter Reference implementation out of the FilterEffectRenderer into its own typ… Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Updated to ToT, fixed style, warnings Created 7 years, 7 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
« no previous file with comments | « Source/core/rendering/FilterEffectRenderer.cpp ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index e8186688e1b0e2a7a5c1c73199211117e76dfad0..49d364a0f0407e72dc23a1da1e4ec8cd96de9e2d 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -86,6 +86,7 @@
#include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h"
#include "core/platform/graphics/filters/FEColorMatrix.h"
#include "core/platform/graphics/filters/FEMerge.h"
+#include "core/platform/graphics/filters/ReferenceFilter.h"
#include "core/platform/graphics/filters/SourceGraphic.h"
#include "core/platform/graphics/transforms/ScaleTransformOperation.h"
#include "core/platform/graphics/transforms/TransformationMatrix.h"
@@ -111,6 +112,7 @@
#include "core/rendering/RenderTheme.h"
#include "core/rendering/RenderTreeAsText.h"
#include "core/rendering/RenderView.h"
+#include "core/rendering/svg/ReferenceFilterBuilder.h"
#include "core/rendering/svg/RenderSVGResourceClipper.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/StdLibExtras.h>
@@ -6136,13 +6138,6 @@ void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle*
if (shouldUpdateFilters)
backing()->updateFilters(renderer()->style());
updateOrRemoveFilterEffectRenderer();
- // FIXME: Accelerated SVG reference filters still rely on FilterEffectRenderer to build the filter graph.
- // Thus, we have to call updateFilters again, after we have a FilterEffectRenderer.
- // FilterEffectRenderer is intended to render software filters and shouldn't be needed for accelerated filters.
- // We should extract the SVG graph building functionality out of FilterEffectRenderer, and it should happen in RenderLayer::computeFilterOperations.
- // https://bugs.webkit.org/show_bug.cgi?id=114051
- if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter())
- backing()->updateFilters(renderer()->style());
}
void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
@@ -6346,6 +6341,20 @@ bool RenderLayer::isCSSCustomFilterEnabled() const
FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style)
{
const FilterOperations& filters = style->filter();
+ if (filters.hasReferenceFilter()) {
+ for (size_t i = 0; i < filters.size(); ++i) {
+ FilterOperation* filterOperation = filters.operations().at(i).get();
+ if (filterOperation->getOperationType() != FilterOperation::REFERENCE)
+ continue;
+ ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
+ // FIXME: Cache the ReferenceFilter if it didn't change.
+ RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create();
+ referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referenceFilter.get(), renderer(), referenceFilter->sourceGraphic(),
+ referenceOperation));
+ referenceOperation->setFilter(referenceFilter.release());
+ }
+ }
+
if (!filters.hasCustomFilter())
return filters;
@@ -6413,14 +6422,7 @@ void RenderLayer::updateOrRemoveFilterEffectRenderer()
if (RenderLayerFilterInfo* filterInfo = this->filterInfo())
filterInfo->setRenderer(0);
- // FIXME: Accelerated SVG reference filters shouldn't rely on FilterEffectRenderer to build the filter graph.
- // https://bugs.webkit.org/show_bug.cgi?id=114051
-
- // Early-return only if we *don't* have reference filters.
- // For reference filters, we still want the FilterEffect graph built
- // for us, even if we're composited.
- if (!renderer()->style()->filter().hasReferenceFilter())
- return;
+ return;
}
RenderLayerFilterInfo* filterInfo = ensureFilterInfo();
« no previous file with comments | « Source/core/rendering/FilterEffectRenderer.cpp ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698