Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: Source/core/animation/CompositorAnimationsTest.cpp

Issue 115403003: Fix isCandidateForAnimationOnCompositorKeyframeMultipleCSSProperties (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameMultipleCSSProperties) 240 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameMultipleCSSProperties)
241 { 241 {
242 RefPtr<Keyframe> keyframeGoodMultiple = createDefaultKeyframe(CSSPropertyOpa city, AnimationEffect::CompositeReplace); 242 RefPtr<Keyframe> keyframeGoodMultiple = createDefaultKeyframe(CSSPropertyOpa city, AnimationEffect::CompositeReplace);
243 keyframeGoodMultiple->setPropertyValue(CSSPropertyWebkitTransform, Animatabl eTransform::create(TransformOperations()).get()); 243 keyframeGoodMultiple->setPropertyValue(CSSPropertyWebkitTransform, Animatabl eTransform::create(TransformOperations()).get());
244 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(keyframeGoodMultiple.get())); 244 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(keyframeGoodMultiple.get()));
245 245
246 RefPtr<Keyframe> keyframeBadMultipleOp = createDefaultKeyframe(CSSPropertyOp acity, AnimationEffect::CompositeAdd); 246 RefPtr<Keyframe> keyframeBadMultipleOp = createDefaultKeyframe(CSSPropertyOp acity, AnimationEffect::CompositeAdd);
247 keyframeBadMultipleOp->setPropertyValue(CSSPropertyWebkitTransform, Animatab leDouble::create(10.0).get()); 247 keyframeBadMultipleOp->setPropertyValue(CSSPropertyWebkitTransform, Animatab leDouble::create(10.0).get());
248 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleOp.get()) ); 248 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleOp.get()) );
249 249
250 // Check both an unsupported property which hashes before and after the 250 RefPtr<Keyframe> keyframeBadMultipleID = createDefaultKeyframe(CSSPropertyCo lor, AnimationEffect::CompositeReplace);
251 // supported property. 251 keyframeBadMultipleID->setPropertyValue(CSSPropertyOpacity, AnimatableDouble ::create(10.0).get());
252 typedef DefaultHash<CSSPropertyID>::Hash HashFunctions; 252 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleID.get()) );
253
254 RefPtr<Keyframe> keyframeBadMultiple1ID = createDefaultKeyframe(CSSPropertyC olor, AnimationEffect::CompositeReplace);
255 keyframeBadMultiple1ID->setPropertyValue(CSSPropertyOpacity, AnimatableDoubl e::create(10.0).get());
256 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultiple1ID.get() ));
257 EXPECT_LT(HashFunctions::hash(CSSPropertyColor), HashFunctions::hash(CSSProp ertyOpacity));
258
259 RefPtr<Keyframe> keyframeBadMultiple2ID = createDefaultKeyframe(CSSPropertyW ebkitTransform, AnimationEffect::CompositeReplace);
260 keyframeBadMultiple2ID->setPropertyValue(CSSPropertyWidth, AnimatableDouble: :create(10.0).get());
261 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultiple2ID.get() ));
262 EXPECT_GT(HashFunctions::hash(CSSPropertyWebkitTransform), HashFunctions::ha sh(CSSPropertyWidth));
263 } 253 }
264 254
265 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorAnimationTr ansformDependsOnBoxSize) 255 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorAnimationTr ansformDependsOnBoxSize)
266 { 256 {
267 TransformOperations ops; 257 TransformOperations ops;
268 ops.operations().append(TranslateTransformOperation::create(Length(2, WebCor e::Fixed), Length(2, WebCore::Fixed), TransformOperation::TranslateX)); 258 ops.operations().append(TranslateTransformOperation::create(Length(2, WebCor e::Fixed), Length(2, WebCore::Fixed), TransformOperation::TranslateX));
269 RefPtr<Keyframe> goodKeyframe = createReplaceOpKeyframe(CSSPropertyWebkitTra nsform, AnimatableTransform::create(ops).get()); 259 RefPtr<Keyframe> goodKeyframe = createReplaceOpKeyframe(CSSPropertyWebkitTra nsform, AnimatableTransform::create(ops).get());
270 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(goodKeyframe.get())); 260 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(goodKeyframe.get()));
271 261
272 ops.operations().append(TranslateTransformOperation::create(Length(50, WebCo re::Percent), Length(2, WebCore::Fixed), TransformOperation::TranslateX)); 262 ops.operations().append(TranslateTransformOperation::create(Length(50, WebCo re::Percent), Length(2, WebCore::Fixed), TransformOperation::TranslateX));
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 // Go! 1069 // Go!
1080 setCompositorForTesting(mockCompositor); 1070 setCompositorForTesting(mockCompositor);
1081 Vector<OwnPtr<blink::WebAnimation> > result; 1071 Vector<OwnPtr<blink::WebAnimation> > result;
1082 getAnimationOnCompositor(m_timing, *effect.get(), result); 1072 getAnimationOnCompositor(m_timing, *effect.get(), result);
1083 EXPECT_EQ(1U, result.size()); 1073 EXPECT_EQ(1U, result.size());
1084 result[0].clear(); 1074 result[0].clear();
1085 } 1075 }
1086 1076
1087 1077
1088 } // namespace WebCore 1078 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698