| Index: cc/output/filter_operations_unittest.cc
|
| diff --git a/cc/output/filter_operations_unittest.cc b/cc/output/filter_operations_unittest.cc
|
| index 4939dca83f13512a24efaf84bd1055dd342f27e9..54fb974452ab90e35272a03b06c4d92176393fa8 100644
|
| --- a/cc/output/filter_operations_unittest.cc
|
| +++ b/cc/output/filter_operations_unittest.cc
|
| @@ -6,9 +6,11 @@
|
|
|
| #include "cc/output/filter_operations.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "third_party/skia/include/core/SkXfermode.h"
|
| #include "third_party/skia/include/effects/SkBlurImageFilter.h"
|
| #include "third_party/skia/include/effects/SkDropShadowImageFilter.h"
|
| #include "third_party/skia/include/effects/SkOffsetImageFilter.h"
|
| +#include "third_party/skia/include/effects/SkXfermodeImageFilter.h"
|
| #include "ui/gfx/geometry/point.h"
|
| #include "ui/gfx/geometry/rect.h"
|
|
|
| @@ -275,6 +277,23 @@ TEST(FilterOperationsTest, MapRectReverseDropShadowDoesNotContract) {
|
| ops.MapRectReverse(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| }
|
|
|
| +TEST(FilterOperationsTest, MapRectTypeConversionDoesNotOverflow) {
|
| + // Must be bigger than half of the positive range so that the width/height
|
| + // overflow happens, but small enough that there aren't other issues before
|
| + // the overflow would happen.
|
| + SkScalar big_offset =
|
| + SkFloatToScalar(std::numeric_limits<int>::max()) * 2 / 3;
|
| +
|
| + FilterOperations ops;
|
| + ops.Append(FilterOperation::CreateReferenceFilter(SkXfermodeImageFilter::Make(
|
| + SkXfermode::Make(SkXfermode::kSrcOver_Mode),
|
| + SkOffsetImageFilter::Make(-big_offset, -big_offset, nullptr),
|
| + SkOffsetImageFilter::Make(big_offset, big_offset, nullptr), nullptr)));
|
| + gfx::Rect rect = ops.MapRect(gfx::Rect(-10, -10, 20, 20), SkMatrix::I());
|
| + EXPECT_GT(rect.width(), 0);
|
| + EXPECT_GT(rect.height(), 0);
|
| +}
|
| +
|
| #define SAVE_RESTORE_AMOUNT(filter_name, filter_type, a) \
|
| { \
|
| FilterOperation op = FilterOperation::Create##filter_name##Filter(a); \
|
|
|