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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 1879223002: Support mask images for filter-based -webkit-box-reflect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reflection-refactor
Patch Set: add comment referring to skbug.com/5210 Created 4 years, 8 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/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index 5fc086094bc5ecc62fef7f2fa59f5c5db6e55706..42e097ebae8d8facf8a5a49bdb5514fcaf169e89 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -72,6 +72,7 @@
#include "core/layout/svg/ReferenceFilterBuilder.h"
#include "core/page/Page.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/paint/BoxReflectionUtils.h"
#include "core/paint/FilterEffectBuilder.h"
#include "core/paint/PaintTiming.h"
#include "platform/LengthFunctions.h"
@@ -2652,39 +2653,7 @@ FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
{
FilterOperations filterOperations = style.filter();
if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()->hasReflection() && layoutObject()->isBox()) {
- // TODO(jbroman): Incorporate the mask image.
- const auto* reflectStyle = style.boxReflect();
- FloatRect frameRect(toLayoutBox(layoutObject())->frameRect());
- BoxReflection::ReflectionDirection direction = BoxReflection::VerticalReflection;
- float offset = 0;
- switch (reflectStyle->direction()) {
- case ReflectionAbove:
- direction = BoxReflection::VerticalReflection;
- offset = -floatValueForLength(reflectStyle->offset(), frameRect.height());
- break;
- case ReflectionBelow:
- direction = BoxReflection::VerticalReflection;
- offset = 2 * frameRect.height() + floatValueForLength(reflectStyle->offset(), frameRect.height());
- break;
- case ReflectionLeft:
- direction = BoxReflection::HorizontalReflection;
- offset = -floatValueForLength(reflectStyle->offset(), frameRect.width());
- break;
- case ReflectionRight:
- direction = BoxReflection::HorizontalReflection;
- offset = 2 * frameRect.width() + floatValueForLength(reflectStyle->offset(), frameRect.width());
- break;
- }
-
- // Since the filter origin is the corner of the input bounds, which may
- // include visual overflow (e.g. due to box-shadow), we must adjust the
- // offset to also account for this offset (this is equivalent to using
- // SkLocalMatrixImageFilter, but simpler).
- // The rect used here should match the one used in FilterPainter.
- LayoutRect filterInputBounds = physicalBoundingBoxIncludingReflectionAndStackingChildren(LayoutPoint());
- offset -= 2 * (direction == BoxReflection::VerticalReflection ? filterInputBounds.y() : filterInputBounds.x()).toFloat();
-
- BoxReflection reflection(direction, offset);
+ BoxReflection reflection = boxReflectionForPaintLayer(*this, style);
filterOperations.operations().append(BoxReflectFilterOperation::create(reflection));
}
return computeFilterOperationsHandleReferenceFilters(filterOperations, style.effectiveZoom(), enclosingNode());

Powered by Google App Engine
This is Rietveld 408576698