Diff
Modified: trunk/Source/WebCore/ChangeLog (133046 => 133047)
--- trunk/Source/WebCore/ChangeLog 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebCore/ChangeLog 2012-10-31 18:06:08 UTC (rev 133047)
@@ -1,3 +1,32 @@
+2012-10-31 Noam Rosenthal <[email protected]>
+
+ [Texmap] Enable filter animations in GraphicsLayerAnimation
+ https://bugs.webkit.org/show_bug.cgi?id=100318
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Use the same method of animating filters in WebCore to animate filters for TextureMapper.
+ Added the appropriate methods to GraphicsLayerAnimation and TextureMapperLayer.
+
+ Tested by LayoutTests/css3/filters/filter-animation-hw.html and other tests.
+
+ * platform/graphics/GraphicsLayerAnimation.cpp:
+ (WebCore):
+ (WebCore::blendFunc):
+ (WebCore::applyFilterAnimation):
+ (WebCore::GraphicsLayerAnimation::applyInternal):
+ * platform/graphics/GraphicsLayerAnimation.h:
+ (Client):
+ * platform/graphics/texmap/TextureMapperLayer.cpp:
+ (WebCore::TextureMapperLayer::intermediateSurfaceRect):
+ (WebCore::TextureMapperLayer::shouldPaintToIntermediateSurface):
+ (WebCore::TextureMapperLayer::paintRecursive):
+ (WebCore::TextureMapperLayer::syncAnimations):
+ * platform/graphics/texmap/TextureMapperLayer.h:
+ (TextureMapperLayer):
+ (WebCore::TextureMapperLayer::setFilters):
+ (WebCore::TextureMapperLayer::setAnimatedFilters):
+
2012-10-31 Adam Barth <[email protected]>
[V8] Garbage collection should use opaque roots rather than implicit references
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp (133046 => 133047)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp 2012-10-31 18:06:08 UTC (rev 133047)
@@ -22,12 +22,60 @@
#if USE(ACCELERATED_COMPOSITING)
#include "GraphicsLayerAnimation.h"
+#include "FractionalLayoutSize.h"
#include "UnitBezier.h"
#include <wtf/CurrentTime.h>
namespace WebCore {
+#if ENABLE(CSS_FILTERS)
+static inline PassRefPtr<FilterOperation> blendFunc(FilterOperation* fromOp, FilterOperation* toOp, double progress, const IntSize& size, bool blendToPassthrough = false)
+{
+ ASSERT(toOp);
+ if (toOp->blendingNeedsRendererSize())
+ return toOp->blend(fromOp, progress, LayoutSize(size.width(), size.height()), blendToPassthrough);
+ return toOp->blend(fromOp, progress, blendToPassthrough);
+}
+
+
+static FilterOperations applyFilterAnimation(const FilterOperations* from, const FilterOperations* to, double progress, const IntSize& boxSize)
+{
+ // First frame of an animation.
+ if (!progress)
+ return *from;
+
+ // Last frame of an animation.
+ if (progress == 1)
+ return *to;
+
+ if (!from->operationsMatch(*to))
+ return *to;
+
+ FilterOperations result;
+
+ size_t fromSize = from->operations().size();
+ size_t toSize = to->operations().size();
+ size_t size = std::max(fromSize, toSize);
+ for (size_t i = 0; i < size; i++) {
+ RefPtr<FilterOperation> fromOp = (i < fromSize) ? from->operations()[i].get() : 0;
+ RefPtr<FilterOperation> toOp = (i < toSize) ? to->operations()[i].get() : 0;
+ RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(fromOp.get(), toOp.get(), progress, boxSize) : (fromOp ? blendFunc(0, fromOp.get(), progress, boxSize, true) : 0);
+ if (blendedOp)
+ result.operations().append(blendedOp);
+ else {
+ RefPtr<FilterOperation> identityOp = PassthroughFilterOperation::create();
+ if (progress > 0.5)
+ result.operations().append(toOp ? toOp : identityOp);
+ else
+ result.operations().append(fromOp ? fromOp : identityOp);
+ }
+ }
+
+ return result;
+}
+#endif
+
static bool shouldReverseAnimationValue(Animation::AnimationDirection direction, int loopCount)
{
if (((direction == Animation::AnimationDirectionAlternate) && (loopCount & 1))
@@ -186,6 +234,11 @@
case AnimatedPropertyWebkitTransform:
client->setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch));
return;
+#if ENABLE(CSS_FILTERS)
+ case AnimatedPropertyWebkitFilter:
+ client->setAnimatedFilters(applyFilterAnimation(static_cast<const FilterAnimationValue*>(from)->value(), static_cast<const FilterAnimationValue*>(to)->value(), progress, m_boxSize));
+ return;
+#endif
default:
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h (133046 => 133047)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h 2012-10-31 18:06:08 UTC (rev 133047)
@@ -36,6 +36,9 @@
public:
virtual void setAnimatedTransform(const TransformationMatrix&) = 0;
virtual void setAnimatedOpacity(float) = 0;
+#if ENABLE(CSS_FILTERS)
+ virtual void setAnimatedFilters(const FilterOperations&) = 0;
+#endif
};
GraphicsLayerAnimation()
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (133046 => 133047)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2012-10-31 18:06:08 UTC (rev 133047)
@@ -223,12 +223,12 @@
}
#if ENABLE(CSS_FILTERS)
- if (m_state.filters.hasOutsets()) {
+ if (m_filters.hasOutsets()) {
int leftOutset;
int topOutset;
int bottomOutset;
int rightOutset;
- m_state.filters.getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
+ m_filters.getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
IntRect unfilteredTargetRect(rect);
rect.move(std::max(0, -leftOutset), std::max(0, -topOutset));
rect.expand(leftOutset + rightOutset, topOutset + bottomOutset);
@@ -262,7 +262,7 @@
bool TextureMapperLayer::shouldPaintToIntermediateSurface() const
{
#if ENABLE(CSS_FILTERS)
- if (m_state.filters.size())
+ if (m_filters.size())
return true;
#endif
bool hasOpacity = m_opacity < 0.99;
@@ -381,7 +381,7 @@
maskTexture = 0;
#if ENABLE(CSS_FILTERS)
- surface = applyFilters(m_state.filters, options.textureMapper, surface.get(), surfaceRect);
+ surface = applyFilters(m_filters, options.textureMapper, surface.get(), surfaceRect);
#endif
options.textureMapper->bindSurface(options.surface.get());
@@ -524,6 +524,10 @@
setTransform(m_state.transform);
if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity))
setOpacity(m_state.opacity);
+#if ENABLE(CSS_FILTERS)
+ if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitFilter))
+ setFilters(m_state.filters);
+#endif
}
void TextureMapperLayer::flushCompositingState(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper* textureMapper, int options)
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (133046 => 133047)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2012-10-31 18:06:08 UTC (rev 133047)
@@ -119,6 +119,9 @@
IntSize size() const { return IntSize(m_size.width(), m_size.height()); }
void setTransform(const TransformationMatrix&);
void setOpacity(float value) { m_opacity = value; }
+#if ENABLE(CSS_FILTERS)
+ void setFilters(const FilterOperations& filters) { m_filters = filters; }
+#endif
void setTextureMapper(TextureMapper* texmap) { m_textureMapper = texmap; }
bool descendantsOrSelfHaveRunningAnimations() const;
@@ -165,6 +168,9 @@
// GraphicsLayerAnimation::Client
void setAnimatedTransform(const TransformationMatrix& matrix) { setTransform(matrix); }
void setAnimatedOpacity(float opacity) { setOpacity(opacity); }
+#if ENABLE(CSS_FILTERS)
+ virtual void setAnimatedFilters(const FilterOperations& filters) { setFilters(filters); }
+#endif
void syncAnimations();
bool isVisible() const;
@@ -191,6 +197,9 @@
TextureMapperPlatformLayer* m_contentsLayer;
FloatSize m_size;
float m_opacity;
+#if ENABLE(CSS_FILTERS)
+ FilterOperations m_filters;
+#endif
float m_centerZ;
String m_name;
bool m_shouldUpdateBackingStoreFromLayer;
Modified: trunk/Source/WebKit2/ChangeLog (133046 => 133047)
--- trunk/Source/WebKit2/ChangeLog 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebKit2/ChangeLog 2012-10-31 18:06:08 UTC (rev 133047)
@@ -1,3 +1,16 @@
+2012-10-31 Noam Rosenthal <[email protected]>
+
+ [Texmap] Enable filter animations in GraphicsLayerAnimation
+ https://bugs.webkit.org/show_bug.cgi?id=100318
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Encode/decode KeyframeValues of type FilterOperations.
+
+ * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
+ (CoreIPC::::encode):
+ (CoreIPC::::decode):
+
2012-10-31 Christophe Dumez <[email protected]>
[EFL][WK2][AC] Avoid storing dirty rects in a Vector inside EwkViewImpl
Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp (133046 => 133047)
--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp 2012-10-31 18:02:00 UTC (rev 133046)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp 2012-10-31 18:06:08 UTC (rev 133047)
@@ -609,6 +609,11 @@
case AnimatedPropertyWebkitTransform:
encoder->encode(*static_cast<const TransformAnimationValue*>(value)->value());
break;
+#if ENABLE(CSS_FILTERS)
+ case AnimatedPropertyWebkitFilter:
+ encoder->encode(*static_cast<const FilterAnimationValue*>(value)->value());
+ break;
+#endif
default:
break;
}
@@ -692,6 +697,15 @@
keyframes.insert(new TransformAnimationValue(keyTime, &transform, timingFunction));
break;
}
+#if ENABLE(CSS_FILTERS)
+ case AnimatedPropertyWebkitFilter: {
+ FilterOperations filter;
+ if (!decoder->decode(filter))
+ return false;
+ keyframes.insert(new FilterAnimationValue(keyTime, &filter, timingFunction));
+ break;
+ }
+#endif
default:
break;
}