From 82ab56a89babd12bbf2fdddaa40fad28487dee5b Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Tue, 24 Feb 2015 20:45:53 -0800 Subject: [PATCH] Remove some dead filters related code. R=abarth@chromium.org Review URL: https://codereview.chromium.org/943333005 --- engine/core/rendering/RenderLayer.cpp | 21 ------- engine/core/rendering/RenderLayer.h | 2 - engine/core/rendering/style/RenderStyle.h | 1 - engine/platform/BUILD.gn | 1 - .../graphics/filters/FilterOperations.cpp | 10 ---- .../graphics/filters/FilterOperations.h | 1 - .../graphics/filters/FilterOperationsTest.cpp | 60 ------------------- 7 files changed, 96 deletions(-) delete mode 100644 engine/platform/graphics/filters/FilterOperationsTest.cpp diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index cfee2f11f7c..cc978cac2fd 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -389,27 +389,6 @@ const RenderLayer* RenderLayer::compositingContainer() const return 0; } -RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) const -{ - const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent(); - for (; curr; curr = curr->parent()) { - if (curr->requiresFullLayerImageForFilters()) - return const_cast(curr); - } - - return 0; -} - -bool RenderLayer::hasAncestorWithFilterOutsets() const -{ - for (const RenderLayer* curr = this; curr; curr = curr->parent()) { - RenderBox* renderer = curr->renderer(); - if (renderer->style()->hasFilterOutsets()) - return true; - } - return false; -} - enum TransparencyClipBoxBehavior { PaintingTransparencyClipBox, HitTestingTransparencyClipBox diff --git a/engine/core/rendering/RenderLayer.h b/engine/core/rendering/RenderLayer.h index 5742a77673e..061a0007ed9 100644 --- a/engine/core/rendering/RenderLayer.h +++ b/engine/core/rendering/RenderLayer.h @@ -138,8 +138,6 @@ public: RenderLayer* enclosingOverflowClipLayer(IncludeSelfOrNot = IncludeSelf) const; const RenderLayer* compositingContainer() const; - RenderLayer* enclosingFilterLayer(IncludeSelfOrNot = IncludeSelf) const; - bool hasAncestorWithFilterOutsets() const; void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) const; void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) const; diff --git a/engine/core/rendering/style/RenderStyle.h b/engine/core/rendering/style/RenderStyle.h index 438658d8885..2c6c3621dfa 100644 --- a/engine/core/rendering/style/RenderStyle.h +++ b/engine/core/rendering/style/RenderStyle.h @@ -343,7 +343,6 @@ public: return imageOutsets(borderImage()); } - bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); } FilterOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); } Order rtlOrdering() const { return static_cast(inherited_flags.m_rtlOrdering); } diff --git a/engine/platform/BUILD.gn b/engine/platform/BUILD.gn index 1e26a8be84c..13585a2e7c2 100644 --- a/engine/platform/BUILD.gn +++ b/engine/platform/BUILD.gn @@ -675,7 +675,6 @@ test("platform_unittests") { "geometry/RoundedRectTest.cpp", "graphics/GraphicsContextTest.cpp", "graphics/ThreadSafeDataTransportTest.cpp", - "graphics/filters/FilterOperationsTest.cpp", "graphics/filters/ImageFilterBuilderTest.cpp", "graphics/gpu/DrawingBufferTest.cpp", "image-decoders/ImageDecoderTest.cpp", diff --git a/engine/platform/graphics/filters/FilterOperations.cpp b/engine/platform/graphics/filters/FilterOperations.cpp index e393c5bf0eb..4f6acb7c2db 100644 --- a/engine/platform/graphics/filters/FilterOperations.cpp +++ b/engine/platform/graphics/filters/FilterOperations.cpp @@ -97,16 +97,6 @@ bool FilterOperations::hasReferenceFilter() const return false; } -bool FilterOperations::hasOutsets() const -{ - for (size_t i = 0; i < m_operations.size(); ++i) { - FilterOperation::OperationType operationType = m_operations.at(i)->type(); - if (operationType == FilterOperation::BLUR || operationType == FilterOperation::DROP_SHADOW || operationType == FilterOperation::REFERENCE) - return true; - } - return false; -} - FilterOutsets FilterOperations::outsets() const { FilterOutsets totalOutsets; diff --git a/engine/platform/graphics/filters/FilterOperations.h b/engine/platform/graphics/filters/FilterOperations.h index b216d60ace0..3caa4fd397d 100644 --- a/engine/platform/graphics/filters/FilterOperations.h +++ b/engine/platform/graphics/filters/FilterOperations.h @@ -64,7 +64,6 @@ public: bool canInterpolateWith(const FilterOperations&) const; - bool hasOutsets() const; FilterOutsets outsets() const; bool hasFilterThatMovesPixels() const; diff --git a/engine/platform/graphics/filters/FilterOperationsTest.cpp b/engine/platform/graphics/filters/FilterOperationsTest.cpp deleted file mode 100644 index 58604f4a118..00000000000 --- a/engine/platform/graphics/filters/FilterOperationsTest.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sky/engine/config.h" -#include "sky/engine/platform/graphics/filters/FilterOperations.h" - -#include - -using namespace blink; - -namespace { - -TEST(FilterOperationsTest, getOutsetsBlur) -{ - FilterOperations ops; - ops.operations().append(BlurFilterOperation::create(Length(20.0, Fixed))); - EXPECT_TRUE(ops.hasOutsets()); - FilterOutsets outsets = ops.outsets(); - EXPECT_EQ(57, outsets.top()); - EXPECT_EQ(57, outsets.right()); - EXPECT_EQ(57, outsets.bottom()); - EXPECT_EQ(57, outsets.left()); -} - -TEST(FilterOperationsTest, getOutsetsDropShadow) -{ - FilterOperations ops; - ops.operations().append(DropShadowFilterOperation::create(IntPoint(3, 8), 20, Color(1, 2, 3))); - EXPECT_TRUE(ops.hasOutsets()); - FilterOutsets outsets = ops.outsets(); - EXPECT_EQ(49, outsets.top()); - EXPECT_EQ(60, outsets.right()); - EXPECT_EQ(65, outsets.bottom()); - EXPECT_EQ(54, outsets.left()); -} - -} -