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
+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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
namespace WebCore { class LayerChromium; }
namespace WebKit {
+class WebFilterOperations;
struct WebFloatPoint;
struct WebSize;
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;
+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
'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',
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
+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.
'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',
#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>
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);
#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 {
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)
{