REGRESSION (r193610): Drop down menu doesn’t expand at allofbach.com
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2016 15:27:02 +0000 (15:27 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2016 15:27:02 +0000 (15:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157445

Reviewed by Simon Fraser.

When we don't run transitions (becasuse of to/from 'auto' values) we should also not
report the 'from' value and behave as if we finished the transition already.

Source/WebCore:

Test: fast/animation/height-auto-transition-computed-value.html

* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): This is a revert of
looping the 'to' value back to the first keyframe when reverse animation is at the start value (last keyframe).

* platform/Length.cpp:
(WebCore::blend):

LayoutTests:

* fast/animation/height-auto-transition-computed-value-expected.html: Added.
* fast/animation/height-auto-transition-computed-value.html: Added.
* imported/blink/transitions/transition-not-interpolable-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200622 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/animation/height-auto-transition-computed-value-expected.html [new file with mode: 0644]
LayoutTests/fast/animation/height-auto-transition-computed-value.html [new file with mode: 0644]
LayoutTests/imported/blink/transitions/transition-not-interpolable-expected.txt
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/animation/KeyframeAnimation.cpp
Source/WebCore/platform/Length.cpp

index 1540bf1..4fc122b 100644 (file)
@@ -1,3 +1,17 @@
+2016-05-10  Zalan Bujtas  <zalan@apple.com>
+
+        REGRESSION (r193610): Drop down menu doesn’t expand at allofbach.com
+        https://bugs.webkit.org/show_bug.cgi?id=157445
+
+        Reviewed by Simon Fraser.
+
+        When we don't run transitions (becasuse of to/from 'auto' values) we should also not
+        report the 'from' value and behave as if we finished the transition already.
+
+        * fast/animation/height-auto-transition-computed-value-expected.html: Added.
+        * fast/animation/height-auto-transition-computed-value.html: Added.
+        * imported/blink/transitions/transition-not-interpolable-expected.txt:
+
 2016-05-09  Dean Jackson  <dino@apple.com>
 
         [iOS] <select> elements should render right-aligned when in RTL mode
diff --git a/LayoutTests/fast/animation/height-auto-transition-computed-value-expected.html b/LayoutTests/fast/animation/height-auto-transition-computed-value-expected.html
new file mode 100644 (file)
index 0000000..1db6ba1
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that auto transition returns the proper computed value.</title>
+<style>
+#dropdown {
+    overflow: hidden;
+    border: 1px solid red;
+    height: 18px;
+    transition: height 1s ease-out;
+}
+</style>
+</head>
+<body>
+<div id=dropdown></div>
+PASS if you can see foobar above.
+</body>
+</html>
diff --git a/LayoutTests/fast/animation/height-auto-transition-computed-value.html b/LayoutTests/fast/animation/height-auto-transition-computed-value.html
new file mode 100644 (file)
index 0000000..b9275b0
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that auto transition returns the proper computed value.</title>
+<style>
+#dropdown {
+    font-size: 16px;
+    font-family: ahem;
+    color: white;
+    overflow: hidden;
+    border: 1px solid red;
+    height: 0px;
+    transition: height 1s ease-out;
+}
+</style>
+</head>
+<body>
+<div id=dropdown>foobar</div>
+PASS if you can see foobar above.
+
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+setTimeout(function() {
+    var element = document.getElementById("dropdown");
+    element.style.height = 'auto';
+    var h = element.offsetHeight;
+    element.style.height = h + 'px';
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, 0);
+</script>
+</body>
+</html>
index 66c14dd..2391969 100644 (file)
@@ -2949,6 +2949,7 @@ fast/overflow/overflow-hidden-scroll-into-view.html [ ImageOnlyFailure ]
 fast/regions/layers/region-removed-during-animation.html [ ImageOnlyFailure ]
 fast/sub-pixel/table-with-subpixel-cell-size.html [ ImageOnlyFailure ]
 svg/text/tspan-multiple-outline.svg [ ImageOnlyFailure ]
+fast/animation/height-auto-transition-computed-value.html [ ImageOnlyFailure ]
 
 webkit.org/b/155174 svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html [ Skip ]
 
index 24a2d7f..e85db71 100644 (file)
@@ -1,3 +1,22 @@
+2016-05-10  Zalan Bujtas  <zalan@apple.com>
+
+        REGRESSION (r193610): Drop down menu doesn’t expand at allofbach.com
+        https://bugs.webkit.org/show_bug.cgi?id=157445
+
+        Reviewed by Simon Fraser.
+
+        When we don't run transitions (becasuse of to/from 'auto' values) we should also not
+        report the 'from' value and behave as if we finished the transition already.
+
+        Test: fast/animation/height-auto-transition-computed-value.html
+
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): This is a revert of
+        looping the 'to' value back to the first keyframe when reverse animation is at the start value (last keyframe).
+
+        * platform/Length.cpp:
+        (WebCore::blend):
+
 2016-05-09  Dean Jackson  <dino@apple.com>
 
         [iOS] <select> elements should render right-aligned when in RTL mode
index 6381b57..64bdc87 100644 (file)
@@ -67,23 +67,21 @@ KeyframeAnimation::~KeyframeAnimation()
 
 void KeyframeAnimation::fetchIntervalEndpointsForProperty(CSSPropertyID property, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& prog) const
 {
+    size_t numKeyframes = m_keyframes.size();
+    if (!numKeyframes)
+        return;
+
     // Find the first key
     double elapsedTime = getElapsedTime();
     if (m_animation->duration() && m_animation->iterationCount() != Animation::IterationCountInfinite)
         elapsedTime = std::min(elapsedTime, m_animation->duration() * m_animation->iterationCount());
 
     const double fractionalTime = this->fractionalTime(1, elapsedTime, 0);
-
-    size_t numKeyframes = m_keyframes.size();
-    if (!numKeyframes)
-        return;
-    
     ASSERT(!m_keyframes[0].key());
     ASSERT(m_keyframes[m_keyframes.size() - 1].key() == 1);
-    
+
     int prevIndex = -1;
     int nextIndex = -1;
-    
     // FIXME: with a lot of keys, this linear search will be slow. We could binary search.
     for (size_t i = 0; i < numKeyframes; ++i) {
         const KeyframeValue& currKeyFrame = m_keyframes[i];
@@ -95,31 +93,22 @@ void KeyframeAnimation::fetchIntervalEndpointsForProperty(CSSPropertyID property
             nextIndex = i;
             break;
         }
-        
         prevIndex = i;
     }
 
     if (prevIndex == -1)
         prevIndex = 0;
-
-    if (nextIndex == -1) {
-        int lastIndex = m_keyframes.size() - 1;
-        if (prevIndex == lastIndex)
-            nextIndex = 0;
-        else
-            nextIndex = lastIndex;
-    }
-
-    ASSERT(prevIndex != nextIndex);
+    if (nextIndex == -1)
+        nextIndex = m_keyframes.size() - 1;
 
     const KeyframeValue& prevKeyframe = m_keyframes[prevIndex];
     const KeyframeValue& nextKeyframe = m_keyframes[nextIndex];
 
     fromStyle = prevKeyframe.style();
     toStyle = nextKeyframe.style();
-    
+
     double offset = prevKeyframe.key();
-    double scale = 1.0 / (nextKeyframe.key() - prevKeyframe.key());
+    double scale = 1.0 / (nextIndex == prevIndex ?  1 : (nextKeyframe.key() - prevKeyframe.key()));
 
     prog = progress(scale, offset, prevKeyframe.timingFunction(name()));
 }
index a0d70b3..610a055 100644 (file)
@@ -299,7 +299,7 @@ static Length blendMixedTypes(const Length& from, const Length& to, double progr
 Length blend(const Length& from, const Length& to, double progress)
 {
     if (from.isAuto() || to.isAuto())
-        return progress ? to : from;
+        return to;
 
     if (from.type() == Calculated || to.type() == Calculated)
         return blendMixedTypes(from, to, progress);