Title: [205659] trunk
Revision
205659
Author
[email protected]
Date
2016-09-08 13:54:24 -0700 (Thu, 08 Sep 2016)

Log Message

Don't run transitions to or from undefined Lengths
https://bugs.webkit.org/show_bug.cgi?id=161750
rdar://problem/28170460

Reviewed by Zalan Bujtas.

Source/WebCore:

For properties like max-height whose default value is 'none', we would erroneously
attempt to run transitions/animations, and then assert when one of the endpoints
was undefined.

So don't attempt to blend such Length values, just as do when they are auto.

Fixes some transitions on apple.com and developer.apple.com.

Test: transitions/transition-to-from-undefined.html

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimation::blendProperties):
* platform/Length.cpp:
(WebCore::blend):

LayoutTests:

* transitions/transition-to-from-undefined-expected.txt: Added.
* transitions/transition-to-from-undefined.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205658 => 205659)


--- trunk/LayoutTests/ChangeLog	2016-09-08 20:35:55 UTC (rev 205658)
+++ trunk/LayoutTests/ChangeLog	2016-09-08 20:54:24 UTC (rev 205659)
@@ -1,3 +1,14 @@
+2016-09-08  Simon Fraser  <[email protected]>
+
+        Don't run transitions to or from undefined Lengths
+        https://bugs.webkit.org/show_bug.cgi?id=161750
+        rdar://problem/28170460
+
+        Reviewed by Zalan Bujtas.
+
+        * transitions/transition-to-from-undefined-expected.txt: Added.
+        * transitions/transition-to-from-undefined.html: Added.
+
 2016-09-08  Myles C. Maxfield  <[email protected]>
 
         Support new emoji group candidates

Added: trunk/LayoutTests/transitions/transition-to-from-undefined-expected.txt (0 => 205659)


--- trunk/LayoutTests/transitions/transition-to-from-undefined-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-to-from-undefined-expected.txt	2016-09-08 20:54:24 UTC (rev 205659)
@@ -0,0 +1,4 @@
+PASS - "max-height" property for "test1" element at 1s saw something close to: none
+PASS - "max-height" property for "test2" element at 1s saw something close to: 100
+PASS - "max-height" property for "test3" element at 1s saw something close to: 50
+

Added: trunk/LayoutTests/transitions/transition-to-from-undefined.html (0 => 205659)


--- trunk/LayoutTests/transitions/transition-to-from-undefined.html	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-to-from-undefined.html	2016-09-08 20:54:24 UTC (rev 205659)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    .box {
+        position: relative;
+        height: 100px;
+        width: 100px;
+        margin: 10px;
+        background-color: gray;
+        transition: max-height 2s linear;
+    }
+    
+    #test1 {
+        max-height: 100px;
+    }
+    
+    body.final #test1 {
+        max-height: none;
+    }
+
+    #test2 {
+        max-height: none;
+    }
+    
+    body.final #test2 {
+        max-height: 100px
+    }
+
+    #test3 {
+        max-height: 0;
+    }
+    
+    body.final #test3 {
+        max-height: 100px
+    }
+  </style>
+  <script src=""
+  <script type="text/_javascript_">
+
+    const expectedValues = [
+      // [time, element-id, property, expected-value, tolerance]
+      [1, 'test1', 'max-height', 'none', 2],
+      [1, 'test2', 'max-height', '100', 2],
+      [1, 'test3', 'max-height', '50', 2],
+    ];
+  
+    function setupTest()
+    {
+        document.body.classList.add('final');
+    }
+    
+    runTransitionTest(expectedValues, setupTest, usePauseAPI);
+  </script>
+</head>
+<body>
+  <div id="test1" class="box"></div>
+  <div id="test2" class="box"></div>
+  <div id="test3" class="box"></div>
+
+  <div id="result"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (205658 => 205659)


--- trunk/Source/WebCore/ChangeLog	2016-09-08 20:35:55 UTC (rev 205658)
+++ trunk/Source/WebCore/ChangeLog	2016-09-08 20:54:24 UTC (rev 205659)
@@ -1,3 +1,26 @@
+2016-09-08  Simon Fraser  <[email protected]>
+
+        Don't run transitions to or from undefined Lengths
+        https://bugs.webkit.org/show_bug.cgi?id=161750
+        rdar://problem/28170460
+
+        Reviewed by Zalan Bujtas.
+
+        For properties like max-height whose default value is 'none', we would erroneously
+        attempt to run transitions/animations, and then assert when one of the endpoints
+        was undefined.
+
+        So don't attempt to blend such Length values, just as do when they are auto.
+
+        Fixes some transitions on apple.com and developer.apple.com.
+
+        Test: transitions/transition-to-from-undefined.html
+
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimation::blendProperties):
+        * platform/Length.cpp:
+        (WebCore::blend):
+
 2016-09-08  Myles C. Maxfield  <[email protected]>
 
         Support new emoji group candidates

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (205658 => 205659)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2016-09-08 20:35:55 UTC (rev 205658)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2016-09-08 20:54:24 UTC (rev 205659)
@@ -1547,10 +1547,10 @@
 
     AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
     if (wrapper) {
-        wrapper->blend(anim, dst, a, b, progress);
 #if !LOG_DISABLED
         wrapper->logBlend(a, b, dst, progress);
 #endif
+        wrapper->blend(anim, dst, a, b, progress);
         return !wrapper->animationIsAccelerated() || !anim->isAccelerated();
     }
     return false;

Modified: trunk/Source/WebCore/platform/Length.cpp (205658 => 205659)


--- trunk/Source/WebCore/platform/Length.cpp	2016-09-08 20:35:55 UTC (rev 205658)
+++ trunk/Source/WebCore/platform/Length.cpp	2016-09-08 20:54:24 UTC (rev 205659)
@@ -298,7 +298,7 @@
 
 Length blend(const Length& from, const Length& to, double progress)
 {
-    if (from.isAuto() || to.isAuto())
+    if (from.isAuto() || from.isUndefined() || to.isAuto() || to.isUndefined())
         return to;
 
     if (from.type() == Calculated || to.type() == Calculated)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to