[chromium] Expose compositor filters to Aura through WebLayer
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Apr 2012 05:28:33 +0000 (05:28 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Apr 2012 05:28:33 +0000 (05:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80054

Reviewed by James Robinson.

Source/Platform:

* chromium/public/WebFilterOperation.h: Added.
(WebKit):
(WebFilterOperation):
(WebKit::WebFilterOperation::WebFilterOperation):
(WebBasicColorMatrixFilterOperation):
(WebKit::WebBasicColorMatrixFilterOperation::WebBasicColorMatrixFilterOperation):
(WebBasicComponentTransferFilterOperation):
(WebKit::WebBasicComponentTransferFilterOperation::WebBasicComponentTransferFilterOperation):
(WebBlurFilterOperation):
(WebKit::WebBlurFilterOperation::WebBlurFilterOperation):
(WebDropShadowFilterOperation):
(WebKit::WebDropShadowFilterOperation::WebDropShadowFilterOperation):
* chromium/public/WebFilterOperations.h: Added.
(WebKit):
(WebFilterOperations):
* chromium/public/WebLayer.h:
(WebKit):
(WebLayer):

Source/WebCore:

Adds WebFilterOperation that wraps WebCore::FilterOperation and
WebFilterOperations that wraps WebCore::FilterOperations.

We add support for most of the FilterOperation subclasses, and
allow the user to set the WebFilterOperations for both layer
content filters and background filters.

* WebCore.gypi:
* platform/chromium/support/WebFilterOperation.cpp: Added.
(WebKit):
(WebKit::WebBasicColorMatrixFilterOperation::toFilterOperation):
(WebKit::WebBasicComponentTransferFilterOperation::toFilterOperation):
(WebKit::WebBlurFilterOperation::toFilterOperation):
(WebKit::WebDropShadowFilterOperation::toFilterOperation):
* platform/chromium/support/WebFilterOperations.cpp: Added.
(WebKit):
(WebKit::WebFilterOperations::WebFilterOperations):
(WebKit::WebFilterOperations::append):
(WebKit::WebFilterOperations::clear):
(WebKit::WebFilterOperations::toFilterOperations):

Source/WebKit/chromium:

* WebKit.gyp:
* src/WebLayer.cpp:
(WebKit::WebLayer::setFilters):
(WebKit):
(WebKit::WebLayer::setBackgroundFilters):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114343 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebFilterOperation.h [new file with mode: 0644]
Source/Platform/chromium/public/WebFilterOperations.h [new file with mode: 0644]
Source/Platform/chromium/public/WebLayer.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/chromium/support/WebFilterOperation.cpp [new file with mode: 0644]
Source/WebCore/platform/chromium/support/WebFilterOperations.cpp [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/src/AssertMatchingEnums.cpp
Source/WebKit/chromium/src/WebLayer.cpp

index 4aadc3b..95d40bd 100644 (file)
@@ -1,3 +1,29 @@
+2012-04-16  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Expose compositor filters to Aura through WebLayer
+        https://bugs.webkit.org/show_bug.cgi?id=80054
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebFilterOperation.h: Added.
+        (WebKit):
+        (WebFilterOperation):
+        (WebKit::WebFilterOperation::WebFilterOperation):
+        (WebBasicColorMatrixFilterOperation):
+        (WebKit::WebBasicColorMatrixFilterOperation::WebBasicColorMatrixFilterOperation):
+        (WebBasicComponentTransferFilterOperation):
+        (WebKit::WebBasicComponentTransferFilterOperation::WebBasicComponentTransferFilterOperation):
+        (WebBlurFilterOperation):
+        (WebKit::WebBlurFilterOperation::WebBlurFilterOperation):
+        (WebDropShadowFilterOperation):
+        (WebKit::WebDropShadowFilterOperation::WebDropShadowFilterOperation):
+        * chromium/public/WebFilterOperations.h: Added.
+        (WebKit):
+        (WebFilterOperations):
+        * chromium/public/WebLayer.h:
+        (WebKit):
+        (WebLayer):
+
 2012-04-13  James Robinson  <jamesr@chromium.org>
 
         [chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
diff --git a/Source/Platform/chromium/public/WebFilterOperation.h b/Source/Platform/chromium/public/WebFilterOperation.h
new file mode 100644 (file)
index 0000000..561cad3
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ */
+
+#ifndef WebFilterOperation_h
+#define WebFilterOperation_h
+
+#include "WebCommon.h"
+
+#include "WebColor.h"
+
+#if WEBKIT_IMPLEMENTATION
+#include <wtf/PassRefPtr.h>
+#endif
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore {
+class FilterOperation;
+}
+#endif
+
+namespace WebKit {
+
+struct WebFilterOperation {
+#if WEBKIT_IMPLEMENTATION
+    virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const = 0;
+#endif
+
+protected:
+    WebFilterOperation() { }
+};
+
+struct WebBasicColorMatrixFilterOperation : public WebFilterOperation {
+    enum FilterType {
+        FilterTypeGrayscale = 1,
+        FilterTypeSepia = 2,
+        FilterTypeSaturate = 3,
+        FilterTypeHueRotate = 4
+    };
+
+    WebBasicColorMatrixFilterOperation(FilterType type, float amount)
+        : type(type)
+        , amount(amount)
+    { }
+
+#if WEBKIT_IMPLEMENTATION
+    virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE;
+#endif
+
+    FilterType type;
+    float amount;
+};
+
+struct WebBasicComponentTransferFilterOperation : public WebFilterOperation {
+    enum FilterType {
+        FilterTypeInvert = 5,
+        FilterTypeBrightness = 7,
+        FilterTypeContrast = 8
+        // Opacity is missing because this is more expensive than just setting opacity on the layer.
+    };
+
+    WebBasicComponentTransferFilterOperation(FilterType type, float amount)
+        : type(type)
+        , amount(amount)
+    { }
+
+#if WEBKIT_IMPLEMENTATION
+    virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE;
+#endif
+
+    FilterType type;
+    float amount;
+};
+
+struct WebBlurFilterOperation : public WebFilterOperation {
+    explicit WebBlurFilterOperation(int pixelRadius) : pixelRadius(pixelRadius) { }
+
+#if WEBKIT_IMPLEMENTATION
+    virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE;
+#endif
+
+    int pixelRadius;
+};
+
+class WebDropShadowFilterOperation : public WebFilterOperation {
+    WebDropShadowFilterOperation(int x, int y, int stdDeviation, WebColor color)
+        : x(x)
+        , y(y)
+        , stdDeviation(stdDeviation)
+        , color(color)
+    { }
+
+#if WEBKIT_IMPLEMENTATION
+    virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE;
+#endif
+
+    int x;
+    int y;
+    int stdDeviation;
+    WebColor color;
+};
+
+}
+
+#endif
diff --git a/Source/Platform/chromium/public/WebFilterOperations.h b/Source/Platform/chromium/public/WebFilterOperations.h
new file mode 100644 (file)
index 0000000..ce6f16b
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+#ifndef WebFilterOperations_h
+#define WebFilterOperations_h
+
+#include "WebCommon.h"
+#include "WebPrivateOwnPtr.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore {
+class FilterOperations;
+}
+#endif
+
+namespace WebKit {
+class WebFilterOperation;
+
+// An ordered set of filter operations.
+class WebFilterOperations {
+public:
+    WebFilterOperations();
+
+    void append(const WebFilterOperation&);
+
+    // Removes all filter operations.
+    void clear();
+
+#if WEBKIT_IMPLEMENTATION
+    const WebCore::FilterOperations& toFilterOperations() const;
+#endif
+
+private:
+    WebPrivateOwnPtr<WebCore::FilterOperations> m_private;
+};
+
+}
+
+#endif
index b257ebc..da974fa 100644 (file)
@@ -34,6 +34,7 @@ class SkMatrix44;
 namespace WebCore { class LayerChromium; }
 
 namespace WebKit {
+class WebFilterOperations;
 struct WebFloatPoint;
 struct WebSize;
 
@@ -98,6 +99,17 @@ public:
     WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
     WEBKIT_EXPORT void setDebugBorderWidth(float);
 
+    // Clear the filters in use by passing in a newly instantiated
+    // WebFilterOperations object.
+    WEBKIT_EXPORT void setFilters(const WebFilterOperations&);
+
+    // Apply filters to pixels that show through the background of this layer.
+    // Note: These filters are only possible on layers that are drawn directly
+    // to the root render surface. This means if an ancestor of the background-
+    // filtered layer sets certain properties (opacity, transforms), it may
+    // conflict and hide the background filters.
+    WEBKIT_EXPORT void setBackgroundFilters(const WebFilterOperations&);
+
     template<typename T> T to()
     {
         T res;
index 896b2eb..314c2fd 100644 (file)
@@ -1,3 +1,31 @@
+2012-04-16  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Expose compositor filters to Aura through WebLayer
+        https://bugs.webkit.org/show_bug.cgi?id=80054
+
+        Reviewed by James Robinson.
+
+        Adds WebFilterOperation that wraps WebCore::FilterOperation and
+        WebFilterOperations that wraps WebCore::FilterOperations.
+
+        We add support for most of the FilterOperation subclasses, and
+        allow the user to set the WebFilterOperations for both layer
+        content filters and background filters.
+
+        * WebCore.gypi:
+        * platform/chromium/support/WebFilterOperation.cpp: Added.
+        (WebKit):
+        (WebKit::WebBasicColorMatrixFilterOperation::toFilterOperation):
+        (WebKit::WebBasicComponentTransferFilterOperation::toFilterOperation):
+        (WebKit::WebBlurFilterOperation::toFilterOperation):
+        (WebKit::WebDropShadowFilterOperation::toFilterOperation):
+        * platform/chromium/support/WebFilterOperations.cpp: Added.
+        (WebKit):
+        (WebKit::WebFilterOperations::WebFilterOperations):
+        (WebKit::WebFilterOperations::append):
+        (WebKit::WebFilterOperations::clear):
+        (WebKit::WebFilterOperations::toFilterOperations):
+
 2012-04-16  Andrei Burago  <aburago@chromium.org>
 
         Auto-sized frames may be taller than expected
index 9647919..651c6ed 100644 (file)
             'platform/chromium/support/WebData.cpp',
             'platform/chromium/support/WebHTTPBody.cpp',
             'platform/chromium/support/WebHTTPLoadInfo.cpp',
+            'platform/chromium/support/WebFilterOperation.cpp',
+            'platform/chromium/support/WebFilterOperations.cpp',
             'platform/chromium/support/WebICECandidateDescriptor.cpp',
             'platform/chromium/support/WebICEOptions.cpp',
             'platform/chromium/support/WebMediaHints.cpp',
diff --git a/Source/WebCore/platform/chromium/support/WebFilterOperation.cpp b/Source/WebCore/platform/chromium/support/WebFilterOperation.cpp
new file mode 100644 (file)
index 0000000..4d5aaf0
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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 "config.h"
+
+#include "FilterOperation.h"
+
+#include <public/WebFilterOperation.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<WebCore::FilterOperation> WebBasicColorMatrixFilterOperation::toFilterOperation() const
+{
+    return BasicColorMatrixFilterOperation::create(amount, static_cast<FilterOperation::OperationType>(type));
+}
+
+PassRefPtr<WebCore::FilterOperation> WebBasicComponentTransferFilterOperation::toFilterOperation() const
+{
+    return BasicComponentTransferFilterOperation::create(amount, static_cast<FilterOperation::OperationType>(type));
+}
+
+PassRefPtr<WebCore::FilterOperation> WebBlurFilterOperation::toFilterOperation() const
+{
+    return BlurFilterOperation::create(Length(pixelRadius, Fixed), FilterOperation::BLUR);
+}
+
+PassRefPtr<WebCore::FilterOperation> WebDropShadowFilterOperation::toFilterOperation() const
+{
+    return DropShadowFilterOperation::create(x, y, stdDeviation, color, FilterOperation::DROP_SHADOW);
+}
+
+} // namespace WebKit
diff --git a/Source/WebCore/platform/chromium/support/WebFilterOperations.cpp b/Source/WebCore/platform/chromium/support/WebFilterOperations.cpp
new file mode 100644 (file)
index 0000000..4755ec2
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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 "config.h"
+
+#include "FilterOperations.h"
+
+#include <public/WebFilterOperation.h>
+#include <public/WebFilterOperations.h>
+#include <wtf/RefPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebFilterOperations::WebFilterOperations()
+{
+    m_private.reset(new FilterOperations());
+}
+
+void WebFilterOperations::append(const WebFilterOperation& filter)
+{
+    m_private->operations().append(filter.toFilterOperation());
+}
+
+void WebFilterOperations::clear()
+{
+    m_private->operations().clear();
+}
+
+const FilterOperations& WebFilterOperations::toFilterOperations() const
+{
+    return *m_private.get();
+}
+
+} // namespace WebKit
index f58d654..f2950c4 100644 (file)
@@ -1,3 +1,16 @@
+2012-04-16  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Expose compositor filters to Aura through WebLayer
+        https://bugs.webkit.org/show_bug.cgi?id=80054
+
+        Reviewed by James Robinson.
+
+        * WebKit.gyp:
+        * src/WebLayer.cpp:
+        (WebKit::WebLayer::setFilters):
+        (WebKit):
+        (WebKit::WebLayer::setBackgroundFilters):
+
 2012-04-16  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled DEPS.
index 23de690..9cbaed7 100644 (file)
                 'public/platform/WebDragData.h',
                 'public/platform/WebExternalTextureLayer.h',
                 'public/platform/WebFileSystem.h',
+                'public/platform/WebFilterOperation.h',
+                'public/platform/WebFilterOperations.h',
                 'public/platform/WebFloatPoint.h',
                 'public/platform/WebFloatQuad.h',
                 'public/platform/WebFloatRect.h',
index 5cf657f..2dbcda6 100644 (file)
@@ -43,6 +43,7 @@
 #include "ExceptionCode.h"
 #include "FileError.h"
 #include "FileMetadata.h"
+#include "FilterOperation.h"
 #include "FontDescription.h"
 #include "FontSmoothingMode.h"
 #include "GeolocationError.h"
 #include "platform/WebMediaStreamSource.h"
 #include "platform/WebPeerConnection00Handler.h"
 #include "platform/WebPeerConnection00HandlerClient.h"
+#include <public/WebFilterOperation.h>
 #include <wtf/Assertions.h>
 #include <wtf/text/StringImpl.h>
 
@@ -317,6 +319,15 @@ COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped);
 COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted);
 COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped);
 
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::FilterTypeGrayscale, FilterOperation::GRAYSCALE);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::FilterTypeSepia, FilterOperation::SEPIA);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::FilterTypeSaturate, FilterOperation::SATURATE);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::FilterTypeHueRotate, FilterOperation::HUE_ROTATE);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::FilterTypeInvert, FilterOperation::INVERT);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::FilterTypeBrightness, FilterOperation::BRIGHTNESS);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::FilterTypeContrast, FilterOperation::CONTRAST);
+
 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyNone, FontDescription::NoFamily);
 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyStandard, FontDescription::StandardFamily);
 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySerif, FontDescription::SerifFamily);
index 59da2f3..f77e373 100644 (file)
 #include "config.h"
 #include "platform/WebLayer.h"
 
-#include "platform/WebFloatPoint.h"
 #include "Color.h"
 #include "LayerChromium.h"
 #include "SkMatrix44.h"
 #include "TransformationMatrix.h"
 #include "WebLayerImpl.h"
+#include "platform/WebFloatPoint.h"
 #include "platform/WebSize.h"
 
+#include <public/WebFilterOperations.h>
+
 using namespace WebCore;
 
 namespace {
@@ -246,6 +248,16 @@ void WebLayer::setDebugBorderWidth(float width)
     m_private->setDebugBorderWidth(width);
 }
 
+void WebLayer::setFilters(const WebFilterOperations& filters)
+{
+    m_private->setFilters(filters.toFilterOperations());
+}
+
+void WebLayer::setBackgroundFilters(const WebFilterOperations& filters)
+{
+    m_private->setBackgroundFilters(filters.toFilterOperations());
+}
+
 WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node)
     : m_private(node)
 {