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

Unified Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1299323005: blink: Add backdrop-filter support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed some todos Created 5 years, 4 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: Source/core/paint/DeprecatedPaintLayer.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp
index 83f026517b2d4eb8cec6a02dd67551f9d86ada16..3fcb980bef2de67c417f0d79694772ca2c38ce64 100644
--- a/Source/core/paint/DeprecatedPaintLayer.cpp
+++ b/Source/core/paint/DeprecatedPaintLayer.cpp
@@ -223,6 +223,16 @@ bool DeprecatedPaintLayer::paintsWithFilters() const
return !m_compositedDeprecatedPaintLayerMapping || compositingState() != PaintsIntoOwnBacking;
}
+bool DeprecatedPaintLayer::paintsWithBackdropFilters() const
+{
+ if (!layoutObject()->hasBackdropFilter())
+ return false;
+
+ // https://code.google.com/p/chromium/issues/detail?id=343759
+ DisableCompositingQueryAsserts disabler;
+ return !m_compositedDeprecatedPaintLayerMapping || compositingState() != PaintsIntoOwnBacking;
+}
+
LayoutSize DeprecatedPaintLayer::subpixelAccumulation() const
{
return m_subpixelAccumulation;
@@ -2428,6 +2438,7 @@ bool DeprecatedPaintLayer::hasVisibleBoxDecorations() const
return hasBoxDecorationsOrBackground() || hasOverflowControls();
}
+// TODO(hendrikw): Do we need a function like this for background filters?
void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const ComputedStyle& newStyle)
{
if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter()))
@@ -2530,6 +2541,8 @@ void DeprecatedPaintLayer::styleChanged(StyleDifference diff, const ComputedStyl
updateTransform(oldStyle, layoutObject()->styleRef());
updateFilters(oldStyle, layoutObject()->styleRef());
+ // TODO(hendrikw) updateBackgroundFilters?
+
setNeedsCompositingInputsUpdate();
}
@@ -2541,9 +2554,10 @@ bool DeprecatedPaintLayer::scrollsOverflow() const
return false;
}
-FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedStyle& style)
+namespace {
+
+FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOperations& filters, float effectiveZoom, Node* enclosingElement)
{
- const FilterOperations& filters = style.filter();
if (filters.hasReferenceFilter()) {
for (size_t i = 0; i < filters.size(); ++i) {
FilterOperation* filterOperation = filters.operations().at(i).get();
@@ -2551,7 +2565,7 @@ FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedSty
continue;
ReferenceFilterOperation& referenceOperation = toReferenceFilterOperation(*filterOperation);
// FIXME: Cache the ReferenceFilter if it didn't change.
- RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilterBuilder::build(style.effectiveZoom(), toElement(enclosingElement()), nullptr, referenceOperation);
+ RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilterBuilder::build(effectiveZoom, toElement(enclosingElement), nullptr, referenceOperation);
referenceOperation.setFilter(referenceFilter.release());
}
}
@@ -2559,8 +2573,21 @@ FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedSty
return filters;
}
+} // unnamed namespace
+
+FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedStyle& style)
+{
+ return computeFilterOperationsHandleReferenceFilters(style.filter(), style.effectiveZoom(), enclosingElement());
+}
+
+FilterOperations DeprecatedPaintLayer::computeBackdropFilterOperations(const ComputedStyle& style)
+{
+ return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingElement());
+}
+
void DeprecatedPaintLayer::updateOrRemoveFilterClients()
{
+ // TODO(hendrikw) backdrop filter?
if (!hasFilter()) {
removeFilterInfoIfNeeded();
return;
@@ -2574,6 +2601,8 @@ void DeprecatedPaintLayer::updateOrRemoveFilterClients()
void DeprecatedPaintLayer::updateOrRemoveFilterEffectBuilder()
{
+ // TODO(hendrikw) backdrop filter?
+
// FilterEffectBuilder is only used to render the filters in software mode,
// so we always need to run updateOrRemoveFilterEffectBuilder after the composited
// mode might have changed for this layer.

Powered by Google App Engine
This is Rietveld 408576698