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

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

Issue 1870793004: Move common logic between BoxReflectFilterOperation and FEBoxReflect into BoxReflection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-filter-outsets-2
Patch Set: 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 25a704b56969c89dc4eeefb4a840f081c2c18e94..d7832079f768b81f1b9d64c590f935bb2f22db75 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -2639,23 +2639,23 @@ FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
// TODO(jbroman): Incorporate the mask image.
const auto* reflectStyle = style.boxReflect();
FloatRect frameRect(toLayoutBox(layoutObject())->frameRect());
- ReflectionDirection direction = VerticalReflection;
+ BoxReflection::ReflectionDirection direction = BoxReflection::VerticalReflection;
float offset = 0;
switch (reflectStyle->direction()) {
case ReflectionAbove:
- direction = VerticalReflection;
+ direction = BoxReflection::VerticalReflection;
offset = -floatValueForLength(reflectStyle->offset(), frameRect.height());
break;
case ReflectionBelow:
- direction = VerticalReflection;
+ direction = BoxReflection::VerticalReflection;
offset = 2 * frameRect.height() + floatValueForLength(reflectStyle->offset(), frameRect.height());
break;
case ReflectionLeft:
- direction = HorizontalReflection;
+ direction = BoxReflection::HorizontalReflection;
offset = -floatValueForLength(reflectStyle->offset(), frameRect.width());
break;
case ReflectionRight:
- direction = HorizontalReflection;
+ direction = BoxReflection::HorizontalReflection;
offset = 2 * frameRect.width() + floatValueForLength(reflectStyle->offset(), frameRect.width());
break;
}
@@ -2666,9 +2666,10 @@ FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
// SkLocalMatrixImageFilter, but simpler).
// The rect used here should match the one used in FilterPainter.
LayoutRect filterInputBounds = physicalBoundingBoxIncludingReflectionAndStackingChildren(LayoutPoint());
- offset -= 2 * (direction == VerticalReflection ? filterInputBounds.y() : filterInputBounds.x()).toFloat();
+ offset -= 2 * (direction == BoxReflection::VerticalReflection ? filterInputBounds.y() : filterInputBounds.x()).toFloat();
- filterOperations.operations().append(BoxReflectFilterOperation::create(direction, offset));
+ BoxReflection reflection(direction, offset);
+ filterOperations.operations().append(BoxReflectFilterOperation::create(reflection));
}
return computeFilterOperationsHandleReferenceFilters(filterOperations, style.effectiveZoom(), enclosingNode());
}

Powered by Google App Engine
This is Rietveld 408576698