Diff
Modified: trunk/Source/Platform/ChangeLog (127867 => 127868)
--- trunk/Source/Platform/ChangeLog 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/Platform/ChangeLog 2012-09-07 15:32:40 UTC (rev 127868)
@@ -1,3 +1,18 @@
+2012-09-07 Ian Vollick <voll...@chromium.org>
+
+ [chromium] We should accelerate all transformations, except when we must blend matrices that cannot be decomposed.
+ https://bugs.webkit.org/show_bug.cgi?id=95855
+
+ Reviewed by James Robinson.
+
+ WebTransformOperations are now able to report if they can successfully blend.
+ WebTransformationMatrix::blend now returns a bool if blending would fail.
+
+ * chromium/public/WebTransformOperations.h:
+ (WebTransformOperations):
+ * chromium/public/WebTransformationMatrix.h:
+ (WebTransformationMatrix):
+
2012-09-07 Nat Duca <nd...@chromium.org>
[chromium] Allow enumeration of WebRenderingStats structure
https://bugs.webkit.org/show_bug.cgi?id=94565
Modified: trunk/Source/Platform/chromium/public/WebTransformOperations.h (127867 => 127868)
--- trunk/Source/Platform/chromium/public/WebTransformOperations.h 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/Platform/chromium/public/WebTransformOperations.h 2012-09-07 15:32:40 UTC (rev 127868)
@@ -68,6 +68,11 @@
// as other and its descendants.
WEBKIT_EXPORT bool matchesTypes(const WebTransformOperations& other) const;
+ // Returns true if these operations can be blended. It will only return
+ // false if we must resort to matrix interpolation, and matrix interpolation
+ // fails (this can happen if either matrix cannot be decomposed).
+ WEBKIT_EXPORT bool canBlendWith(const WebTransformOperations& other) const;
+
WEBKIT_EXPORT void appendTranslate(double x, double y, double z);
WEBKIT_EXPORT void appendRotate(double x, double y, double z, double degrees);
WEBKIT_EXPORT void appendScale(double x, double y, double z);
@@ -82,6 +87,7 @@
WEBKIT_EXPORT void reset();
WEBKIT_EXPORT void initialize();
WEBKIT_EXPORT void initialize(const WebTransformOperations& prototype);
+ WEBKIT_EXPORT bool blendInternal(const WebTransformOperations& from, double progress, WebTransformationMatrix& result) const;
WebPrivateOwnPtr<WebTransformOperationsPrivate> m_private;
};
Modified: trunk/Source/Platform/chromium/public/WebTransformationMatrix.h (127867 => 127868)
--- trunk/Source/Platform/chromium/public/WebTransformationMatrix.h 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/Platform/chromium/public/WebTransformationMatrix.h 2012-09-07 15:32:40 UTC (rev 127868)
@@ -77,7 +77,7 @@
WEBKIT_EXPORT void skewX(double angle);
WEBKIT_EXPORT void skewY(double angle);
WEBKIT_EXPORT void applyPerspective(double p);
- WEBKIT_EXPORT void blend(const WebTransformationMatrix& from, double progress);
+ WEBKIT_EXPORT bool blend(const WebTransformationMatrix& from, double progress);
WEBKIT_EXPORT bool hasPerspective() const;
WEBKIT_EXPORT bool isInvertible() const;
Modified: trunk/Source/WebCore/ChangeLog (127867 => 127868)
--- trunk/Source/WebCore/ChangeLog 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/WebCore/ChangeLog 2012-09-07 15:32:40 UTC (rev 127868)
@@ -1,3 +1,28 @@
+2012-09-07 Ian Vollick <voll...@chromium.org>
+
+ [chromium] We should accelerate all transformations, except when we must blend matrices that cannot be decomposed.
+ https://bugs.webkit.org/show_bug.cgi?id=95855
+
+ Reviewed by James Robinson.
+
+ WebTransformOperations are now able to report if they can successfully blend.
+ WebTransformationMatrix::blend now returns a bool if blending would fail.
+
+ Unit tests:
+ AnimationTranslationUtilTest.createTransformAnimationWithNonDecomposableMatrix
+ AnimationTranslationUtilTest.createTransformAnimationWithNonInvertibleTransform
+
+ * platform/chromium/support/WebTransformOperations.cpp:
+ (WebKit::blendTransformOperations):
+ (WebKit::WebTransformOperations::blend):
+ (WebKit::WebTransformOperations::canBlendWith):
+ (WebKit):
+ (WebKit::WebTransformOperations::blendInternal):
+ * platform/chromium/support/WebTransformationMatrix.cpp:
+ (WebKit::WebTransformationMatrix::blend):
+ * platform/graphics/chromium/AnimationTranslationUtil.cpp:
+ (WebCore::WebTransformAnimationCurve):
+
2012-09-07 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r127780 and r127859.
Modified: trunk/Source/WebCore/platform/chromium/support/WebTransformOperations.cpp (127867 => 127868)
--- trunk/Source/WebCore/platform/chromium/support/WebTransformOperations.cpp 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/WebCore/platform/chromium/support/WebTransformOperations.cpp 2012-09-07 15:32:40 UTC (rev 127868)
@@ -147,12 +147,10 @@
return from * (1 - progress) + to * progress;
}
-static WebTransformationMatrix blendTransformOperations(const WebTransformOperation* from, const WebTransformOperation* to, double progress)
+static bool blendTransformOperations(const WebTransformOperation* from, const WebTransformOperation* to, double progress, WebTransformationMatrix& result)
{
- WebTransformationMatrix toReturn;
-
if (isIdentity(from) && isIdentity(to))
- return toReturn;
+ return true;
WebTransformOperation::Type interpolationType = WebTransformOperation::WebTransformOperationIdentity;
if (isIdentity(to))
@@ -168,9 +166,9 @@
double toX = isIdentity(to) ? 0 : to->translate.x;
double toY = isIdentity(to) ? 0 : to->translate.y;
double toZ = isIdentity(to) ? 0 : to->translate.z;
- toReturn.translate3d(blendDoubles(fromX, toX, progress),
- blendDoubles(fromY, toY, progress),
- blendDoubles(fromZ, toZ, progress));
+ result.translate3d(blendDoubles(fromX, toX, progress),
+ blendDoubles(fromY, toY, progress),
+ blendDoubles(fromZ, toZ, progress));
break;
}
case WebTransformOperation::WebTransformOperationRotate: {
@@ -180,7 +178,7 @@
double fromAngle = 0;
double toAngle = isIdentity(to) ? 0 : to->rotate.angle;
if (shareSameAxis(from, to, axisX, axisY, axisZ, fromAngle))
- toReturn.rotate3d(axisX, axisY, axisZ, blendDoubles(fromAngle, toAngle, progress));
+ result.rotate3d(axisX, axisY, axisZ, blendDoubles(fromAngle, toAngle, progress));
else {
WebTransformationMatrix toMatrix;
if (!isIdentity(to))
@@ -188,8 +186,9 @@
WebTransformationMatrix fromMatrix;
if (!isIdentity(from))
fromMatrix = from->matrix;
- toReturn = toMatrix;
- toReturn.blend(fromMatrix, progress);
+ result = toMatrix;
+ if (!result.blend(fromMatrix, progress))
+ return false;
}
break;
}
@@ -200,9 +199,9 @@
double toX = isIdentity(to) ? 1 : to->scale.x;
double toY = isIdentity(to) ? 1 : to->scale.y;
double toZ = isIdentity(to) ? 1 : to->scale.z;
- toReturn.scale3d(blendDoubles(fromX, toX, progress),
- blendDoubles(fromY, toY, progress),
- blendDoubles(fromZ, toZ, progress));
+ result.scale3d(blendDoubles(fromX, toX, progress),
+ blendDoubles(fromY, toY, progress),
+ blendDoubles(fromZ, toZ, progress));
break;
}
case WebTransformOperation::WebTransformOperationSkew: {
@@ -210,14 +209,14 @@
double fromY = isIdentity(from) ? 0 : from->skew.y;
double toX = isIdentity(to) ? 0 : to->skew.x;
double toY = isIdentity(to) ? 0 : to->skew.y;
- toReturn.skewX(blendDoubles(fromX, toX, progress));
- toReturn.skewY(blendDoubles(fromY, toY, progress));
+ result.skewX(blendDoubles(fromX, toX, progress));
+ result.skewY(blendDoubles(fromY, toY, progress));
break;
}
case WebTransformOperation::WebTransformOperationPerspective: {
double fromPerspectiveDepth = isIdentity(from) ? numeric_limits<double>::max() : from->perspectiveDepth;
double toPerspectiveDepth = isIdentity(to) ? numeric_limits<double>::max() : to->perspectiveDepth;
- toReturn.applyPerspective(blendDoubles(fromPerspectiveDepth, toPerspectiveDepth, progress));
+ result.applyPerspective(blendDoubles(fromPerspectiveDepth, toPerspectiveDepth, progress));
break;
}
case WebTransformOperation::WebTransformOperationMatrix: {
@@ -227,8 +226,9 @@
WebTransformationMatrix fromMatrix;
if (!isIdentity(from))
fromMatrix = from->matrix;
- toReturn = toMatrix;
- toReturn.blend(fromMatrix, progress);
+ result = toMatrix;
+ if (!result.blend(fromMatrix, progress))
+ return false;
break;
}
case WebTransformOperation::WebTransformOperationIdentity:
@@ -236,32 +236,13 @@
break;
}
- return toReturn;
+ return true;
}
WebTransformationMatrix WebTransformOperations::blend(const WebTransformOperations& from, double progress) const
{
WebTransformationMatrix toReturn;
- bool fromIdentity = from.isIdentity();
- bool toIdentity = isIdentity();
- if (fromIdentity && toIdentity)
- return toReturn;
-
- if (matchesTypes(from)) {
- size_t numOperations = max(fromIdentity ? 0 : from.m_private->operations.size(),
- toIdentity ? 0 : m_private->operations.size());
- for (size_t i = 0; i < numOperations; ++i) {
- WebTransformationMatrix blended = blendTransformOperations(
- fromIdentity ? 0 : &from.m_private->operations[i],
- toIdentity ? 0 : &m_private->operations[i],
- progress);
- toReturn.multiply(blended);
- }
- } else {
- toReturn = apply();
- WebTransformationMatrix fromTransform = from.apply();
- toReturn.blend(fromTransform, progress);
- }
+ blendInternal(from, progress, toReturn);
return toReturn;
}
@@ -283,6 +264,12 @@
return true;
}
+bool WebTransformOperations::canBlendWith(const WebTransformOperations& other) const
+{
+ WebTransformationMatrix dummy;
+ return blendInternal(other, 0.5, dummy);
+}
+
void WebTransformOperations::appendTranslate(double x, double y, double z)
{
WebTransformOperation toAdd;
@@ -377,4 +364,31 @@
initialize();
}
+bool WebTransformOperations::blendInternal(const WebTransformOperations& from, double progress, WebTransformationMatrix& result) const
+{
+ bool fromIdentity = from.isIdentity();
+ bool toIdentity = isIdentity();
+ if (fromIdentity && toIdentity)
+ return true;
+
+ if (matchesTypes(from)) {
+ size_t numOperations = max(fromIdentity ? 0 : from.m_private->operations.size(),
+ toIdentity ? 0 : m_private->operations.size());
+ for (size_t i = 0; i < numOperations; ++i) {
+ WebTransformationMatrix blended;
+ if (!blendTransformOperations(fromIdentity ? 0 : &from.m_private->operations[i],
+ toIdentity ? 0 : &m_private->operations[i],
+ progress,
+ blended))
+ return false;
+ result.multiply(blended);
+ }
+ return true;
+ }
+
+ result = apply();
+ WebTransformationMatrix fromTransform = from.apply();
+ return result.blend(fromTransform, progress);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp (127867 => 127868)
--- trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp 2012-09-07 15:32:40 UTC (rev 127868)
@@ -162,9 +162,13 @@
m_private.applyPerspective(p);
}
-void WebTransformationMatrix::blend(const WebTransformationMatrix& from, double progress)
+bool WebTransformationMatrix::blend(const WebTransformationMatrix& from, double progress)
{
+ WebCore::TransformationMatrix::DecomposedType dummy;
+ if (!m_private.decompose(dummy) || !from.m_private.decompose(dummy))
+ return false;
m_private.blend(from.m_private, progress);
+ return true;
}
bool WebTransformationMatrix::hasPerspective() const
Modified: trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp (127867 => 127868)
--- trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp 2012-09-07 15:32:40 UTC (rev 127868)
@@ -152,8 +152,13 @@
template <>
bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize)
{
+ bool canBlend = !lastValue;
WebTransformOperations operations = toWebTransformOperations(*value->value(), boxSize);
- if (operations.apply().isInvertible()) {
+ if (!canBlend) {
+ WebTransformOperations lastOperations = toWebTransformOperations(*lastValue->value(), boxSize);
+ canBlend = lastOperations.canBlendWith(operations);
+ }
+ if (canBlend) {
curve->add(WebTransformKeyframe(keyTime, operations), timingFunctionType);
return true;
}
@@ -163,8 +168,13 @@
template <>
bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize)
{
+ bool canBlend = !lastValue;
WebTransformOperations operations = toWebTransformOperations(*value->value(), boxSize);
- if (operations.apply().isInvertible()) {
+ if (!canBlend) {
+ WebTransformOperations lastOperations = toWebTransformOperations(*lastValue->value(), boxSize);
+ canBlend = lastOperations.canBlendWith(operations);
+ }
+ if (canBlend) {
curve->add(WebTransformKeyframe(keyTime, operations), x1, y1, x2, y2);
return true;
}
Modified: trunk/Source/WebKit/chromium/ChangeLog (127867 => 127868)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-07 15:32:40 UTC (rev 127868)
@@ -1,3 +1,18 @@
+2012-09-07 Ian Vollick <voll...@chromium.org>
+
+ [chromium] We should accelerate all transformations, except when we must blend matrices that cannot be decomposed.
+ https://bugs.webkit.org/show_bug.cgi?id=95855
+
+ Reviewed by James Robinson.
+
+ Added the following unit tests:
+ AnimationTranslationUtilTest.createTransformAnimationWithNonDecomposableMatrix
+ AnimationTranslationUtilTest.createTransformAnimationWithNonInvertibleTransform
+
+ * tests/AnimationTranslationUtilTest.cpp:
+ (WebKit::TEST):
+ (WebKit):
+
2012-09-07 Allan Sandfeld Jensen <allan.jen...@nokia.com>
X11 Global Selection
Modified: trunk/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp (127867 => 127868)
--- trunk/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp 2012-09-07 14:00:11 UTC (rev 127867)
+++ trunk/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp 2012-09-07 15:32:40 UTC (rev 127868)
@@ -31,6 +31,7 @@
#include "IntSize.h"
#include "Matrix3DTransformOperation.h"
#include "RotateTransformOperation.h"
+#include "ScaleTransformOperation.h"
#include "TransformOperations.h"
#include "TranslateTransformOperation.h"
#include <gtest/gtest.h>
@@ -155,7 +156,7 @@
EXPECT_TRUE(animationCanBeTranslated(values, animation.get()));
}
-TEST(AnimationTranslationUtilTest, createTransformAnimationWithSingularMatrix)
+TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonDecomposableMatrix)
{
const double duration = 1;
WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
@@ -177,6 +178,25 @@
EXPECT_FALSE(animationCanBeTranslated(values, animation.get()));
}
+TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonInvertibleTransform)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(ScaleTransformOperation::create(1, 1, 1, TransformOperation::SCALE_3D));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformOperations operations2;
+ operations2.operations().append(ScaleTransformOperation::create(1, 0, 1, TransformOperation::SCALE_3D));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ EXPECT_TRUE(animationCanBeTranslated(values, animation.get()));
+}
+
TEST(AnimationTranslationUtilTest, createReversedAnimation)
{
const double duration = 1;