Title: [156506] trunk
Revision
156506
Author
[email protected]
Date
2013-09-26 15:29:07 -0700 (Thu, 26 Sep 2013)

Log Message

Expose a setting to disable hardware accelerated animations
https://bugs.webkit.org/show_bug.cgi?id=121978
<rdar://problem/15091284>

Reviewed by Eric Carlson.

Source/WebCore:

Expose acceleratedCompositedAnimationsEnabled
to disable CoreAnimation animations.

Test: LayoutTests/animations/transform-non-accelerated.html

* WebCore.exp.in: Export new method.
* page/Settings.in: Add new setting.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::startAnimation): Don't go
to GraphicsLayer if the setting is false.

LayoutTests:

* animations/resources/animation-test-helpers.js: Add a callback
for when the tests finish. Minor cleanup.
(endTest):
(.else):
(runAnimationTest):
* animations/transform-non-accelerated.html: New test.
* animations/transform-non-accelerated-expected.txt: Result.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156505 => 156506)


--- trunk/LayoutTests/ChangeLog	2013-09-26 22:25:40 UTC (rev 156505)
+++ trunk/LayoutTests/ChangeLog	2013-09-26 22:29:07 UTC (rev 156506)
@@ -1,3 +1,19 @@
+2013-09-26  Dean Jackson  <[email protected]>
+
+        Expose a setting to disable hardware accelerated animations
+        https://bugs.webkit.org/show_bug.cgi?id=121978
+        <rdar://problem/15091284>
+
+        Reviewed by Eric Carlson.
+
+        * animations/resources/animation-test-helpers.js: Add a callback
+        for when the tests finish. Minor cleanup.
+        (endTest):
+        (.else):
+        (runAnimationTest):
+        * animations/transform-non-accelerated.html: New test.
+        * animations/transform-non-accelerated-expected.txt: Result.
+
 2013-09-26  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r156464 and r156480.

Modified: trunk/LayoutTests/animations/resources/animation-test-helpers.js (156505 => 156506)


--- trunk/LayoutTests/animations/resources/animation-test-helpers.js	2013-09-26 22:25:40 UTC (rev 156505)
+++ trunk/LayoutTests/animations/resources/animation-test-helpers.js	2013-09-26 22:29:07 UTC (rev 156506)
@@ -510,10 +510,13 @@
     return result;
 }
 
-function endTest()
+function endTest(finishCallback)
 {
     document.getElementById('result').innerHTML = result;
 
+    if (finishCallback)
+        finishCallback();
+
     if (window.testRunner)
         testRunner.notifyDone();
 }
@@ -524,13 +527,13 @@
 }
 
 var testStarted = false;
-function startTest(expected, callback)
+function startTest(expected, startCallback, finishCallback)
 {
     if (testStarted) return;
     testStarted = true;
 
-    if (callback)
-        callback();
+    if (startCallback)
+        startCallback();
 
     var maxTime = 0;
 
@@ -551,15 +554,17 @@
     }
 
     if (maxTime > 0)
-        window.setTimeout(endTest, maxTime * 1000 + 50);
+        window.setTimeout(function () {
+            endTest(finishCallback);
+        }, maxTime * 1000 + 50);
     else
-        endTest();
+        endTest(finishCallback);
 }
 
 var result = "";
 var hasPauseAnimationAPI;
 
-function runAnimationTest(expected, callback, event, disablePauseAnimationAPI, doPixelTest)
+function runAnimationTest(expected, startCallback, event, disablePauseAnimationAPI, doPixelTest, finishCallback)
 {
     hasPauseAnimationAPI = 'internals' in window;
     if (disablePauseAnimationAPI)
@@ -576,10 +581,10 @@
     
     var target = document;
     if (event == undefined)
-        waitForAnimationToStart(target, function() { startTest(expected, callback); });
+        waitForAnimationToStart(target, function() { startTest(expected, startCallback, finishCallback); });
     else if (event == "load")
         window.addEventListener(event, function() {
-            startTest(expected, callback);
+            startTest(expected, startCallback, finishCallback);
         }, false);
 }
 

Added: trunk/LayoutTests/animations/transform-non-accelerated-expected.txt (0 => 156506)


--- trunk/LayoutTests/animations/transform-non-accelerated-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/animations/transform-non-accelerated-expected.txt	2013-09-26 22:29:07 UTC (rev 156506)
@@ -0,0 +1,4 @@
+During the animation, the box should flip in the horizontal axis. It should not disappear into a single point (i.e. the visual width should not change).
+
+PASS - "webkitTransform" property for "box" element at 0.5s saw something close to: 0,0,0,0,0,0
+
Property changes on: trunk/LayoutTests/animations/transform-non-accelerated-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/animations/transform-non-accelerated.html (0 => 156506)


--- trunk/LayoutTests/animations/transform-non-accelerated.html	                        (rev 0)
+++ trunk/LayoutTests/animations/transform-non-accelerated.html	2013-09-26 22:29:07 UTC (rev 156506)
@@ -0,0 +1,49 @@
+<style>
+  #box {
+      position: absolute;
+      left: 0;
+      top: 0;
+      height: 100px;
+      width: 100px;
+      background-color: red;
+      -webkit-animation-name: flip;
+      -webkit-animation-duration: 1s;
+      -webkit-animation-timing-function: linear;
+  }
+
+  @-webkit-keyframes flip {
+      from { -webkit-transform: matrix( 1,  0,  0, 1, 0, 0); }
+      to   { -webkit-transform: matrix( 1,  0,  0, -1, 0, 0); }
+  }
+
+  p {
+    position: relative;
+    top: 150px;
+  }
+  #result {
+    position: relative;
+    top: 200px;
+  }
+</style>
+<script src=""
+<script>
+const expectedValues = [
+  // [animation-name, time, element-id, property, expected-value, tolerance]
+  ["flip", 0.5, "box", "webkitTransform", [0, 0, 0, 0, 0, 0], 0.3],
+];
+
+if (window.internals)
+    window.internals.settings.setAcceleratedCompositedAnimationsEnabled(false);
+
+runAnimationTest(expectedValues, null, null, true, null, function () {
+    if (window.internals)
+        window.internals.settings.setAcceleratedCompositedAnimationsEnabled(true);
+});
+</script>
+
+<div id="box"></div>
+<p>
+  During the animation, the box should flip in the horizontal axis. It should
+  not disappear into a single point (i.e. the visual width should not change).
+</p>
+<div id="result"></div>
Property changes on: trunk/LayoutTests/animations/transform-non-accelerated.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (156505 => 156506)


--- trunk/Source/WebCore/ChangeLog	2013-09-26 22:25:40 UTC (rev 156505)
+++ trunk/Source/WebCore/ChangeLog	2013-09-26 22:29:07 UTC (rev 156506)
@@ -1,3 +1,22 @@
+2013-09-26  Dean Jackson  <[email protected]>
+
+        Expose a setting to disable hardware accelerated animations
+        https://bugs.webkit.org/show_bug.cgi?id=121978
+        <rdar://problem/15091284>
+
+        Reviewed by Eric Carlson.
+
+        Expose acceleratedCompositedAnimationsEnabled
+        to disable CoreAnimation animations.
+
+        Test: LayoutTests/animations/transform-non-accelerated.html
+
+        * WebCore.exp.in: Export new method.
+        * page/Settings.in: Add new setting.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::startAnimation): Don't go
+        to GraphicsLayer if the setting is false.
+
 2013-09-26  Julien Brianceau  <[email protected]>
 
         [Qt] Fix build after r156487.

Modified: trunk/Source/WebCore/WebCore.exp.in (156505 => 156506)


--- trunk/Source/WebCore/WebCore.exp.in	2013-09-26 22:25:40 UTC (rev 156505)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-09-26 22:29:07 UTC (rev 156506)
@@ -1119,6 +1119,7 @@
 __ZN7WebCore8Settings33setAggressiveTileRetentionEnabledEb
 __ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
 __ZN7WebCore8Settings38setLowPowerVideoAudioBufferSizeEnabledEb
+__ZN7WebCore8Settings41setAcceleratedCompositedAnimationsEnabledEb
 __ZN7WebCore8Settings42setHiddenPageCSSAnimationSuspensionEnabledEb
 __ZN7WebCore8Settings45setShouldRespectPriorityInCSSAttributeSettersEb
 __ZN7WebCore8blankURLEv

Modified: trunk/Source/WebCore/page/Settings.in (156505 => 156506)


--- trunk/Source/WebCore/page/Settings.in	2013-09-26 22:25:40 UTC (rev 156505)
+++ trunk/Source/WebCore/page/Settings.in	2013-09-26 22:29:07 UTC (rev 156506)
@@ -58,6 +58,7 @@
 textAreasAreResizable initial=false, setNeedsStyleRecalcInAllFrames=1
 authorAndUserStylesEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
 acceleratedCompositingEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
+acceleratedCompositedAnimationsEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
 showDebugBorders initial=false, setNeedsStyleRecalcInAllFrames=1
 showRepaintCounter initial=false, setNeedsStyleRecalcInAllFrames=1
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (156505 => 156506)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-09-26 22:25:40 UTC (rev 156505)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-09-26 22:29:07 UTC (rev 156506)
@@ -2139,8 +2139,11 @@
 #endif
     }
 
+    if (renderer().frame().page() && !renderer().frame().page()->settings().acceleratedCompositedAnimationsEnabled())
+        return false;
+
     bool didAnimate = false;
-    
+
     if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer()).pixelSnappedBorderBoxRect().size(), anim, keyframes.animationName(), timeOffset))
         didAnimate = true;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to