<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181655] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181655">181655</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2015-03-17 12:01:46 -0700 (Tue, 17 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement Scroll Container Animation Triggers
https://bugs.webkit.org/show_bug.cgi?id=142732

Reviewed by Simon Fraser.

Source/WebCore:

Test: animations/trigger-container-scroll-simple.html

Basic implementation of container-scroll. It only checks
the page scroll position for trigger values (not the scrolling
container in an overflow).

* css/CSSComputedStyleDeclaration.cpp: Add CSSPropertyWebkitAnimationTrigger
so that this property will appear in the inspector.

* page/FrameView.cpp:
(WebCore::FrameView::sendScrollEvent): If the page has scrolled, let the animation
controller know about it.

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::updateStateMachine): Whitespace fix.
(WebCore::AnimationBase::fireAnimationEventsIfNeeded): If there is a trigger,
and the scroll position is past it, then tell the state machine that
we should start.
(WebCore::AnimationBase::timeToNextService): Use the scroll position as
an input to the update timer if a trigger is involved.

* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Add whitespace.
(WebCore::AnimationControllerPrivate::scrollWasUpdated): Call updateAnimations.
(WebCore::AnimationController::scrollWasUpdated): Call into AnimationControllerPrivate.
* page/animation/AnimationController.h:
* page/animation/AnimationControllerPrivate.h:

* page/animation/CompositeAnimation.cpp: Keep a record of whether we have a scroll
triggered animation.
(WebCore::CompositeAnimation::CompositeAnimation):
(WebCore::CompositeAnimation::updateKeyframeAnimations):
* page/animation/CompositeAnimation.h:
(WebCore::CompositeAnimation::hasScrollTriggeredAnimation):
* platform/animation/Animation.cpp:
(WebCore::Animation::operator=):

LayoutTests:

Test that checks if an animation only triggers when the page
is scrolled.

* animations/trigger-container-scroll-simple-expected.txt: Added.
* animations/trigger-container-scroll-simple.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationBasecpp">trunk/Source/WebCore/page/animation/AnimationBase.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationControllercpp">trunk/Source/WebCore/page/animation/AnimationController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationControllerh">trunk/Source/WebCore/page/animation/AnimationController.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationControllerPrivateh">trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationCompositeAnimationcpp">trunk/Source/WebCore/page/animation/CompositeAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationCompositeAnimationh">trunk/Source/WebCore/page/animation/CompositeAnimation.h</a></li>
<li><a href="#trunkSourceWebCoreplatformanimationAnimationcpp">trunk/Source/WebCore/platform/animation/Animation.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsanimationstriggercontainerscrollsimpleexpectedtxt">trunk/LayoutTests/animations/trigger-container-scroll-simple-expected.txt</a></li>
<li><a href="#trunkLayoutTestsanimationstriggercontainerscrollsimplehtml">trunk/LayoutTests/animations/trigger-container-scroll-simple.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/LayoutTests/ChangeLog        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-03-17  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Implement Scroll Container Animation Triggers
+        https://bugs.webkit.org/show_bug.cgi?id=142732
+
+        Reviewed by Simon Fraser.
+
+        Test that checks if an animation only triggers when the page
+        is scrolled.
+
+        * animations/trigger-container-scroll-simple-expected.txt: Added.
+        * animations/trigger-container-scroll-simple.html: Added.
+
</ins><span class="cx"> 2015-03-17  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Skip some IndexDB tests that don't apply on Windows.
</span></span></pre></div>
<a id="trunkLayoutTestsanimationstriggercontainerscrollsimpleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/animations/trigger-container-scroll-simple-expected.txt (0 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/animations/trigger-container-scroll-simple-expected.txt                                (rev 0)
+++ trunk/LayoutTests/animations/trigger-container-scroll-simple-expected.txt        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+This element should begin animating only when the page scrolls to 20px from the top. The animation is almost instantaneous, so it will snap to its final position. Remember to scroll to the top of the page before reloading!
+
+Value before animation is applied: auto (should be auto)
+Value with animation but no scroll: 0px (should be 0px)
+Value with animation after scroll: 100px (should be 100px)
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/animations/trigger-container-scroll-simple-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsanimationstriggercontainerscrollsimplehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/animations/trigger-container-scroll-simple.html (0 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/animations/trigger-container-scroll-simple.html                                (rev 0)
+++ trunk/LayoutTests/animations/trigger-container-scroll-simple.html        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;style&gt;
+body {
+    height: 2000px;
+}
+
+#box {
+    position: relative;
+    width: 20px;
+    height: 20px;
+    background-color: blue;
+}
+
+.animating {
+    animation-name: slide;
+    animation-duration: 1ms;
+    animation-fill-mode: forwards;
+    -webkit-animation-trigger: container-scroll(20px);
+}
+
+@-webkit-keyframes slide {
+  from {
+      left: 0px;
+  }
+  to {
+      left: 100px;
+  }
+}
+&lt;/style&gt;
+&lt;script&gt;
+
+var results;
+var box;
+
+if (window.testRunner) {
+    window.testRunner.dumpAsText();
+    window.testRunner.waitUntilDone();
+}
+
+function runTest() {
+    results = document.getElementById(&quot;results&quot;);
+    box = document.getElementById(&quot;box&quot;);
+    results.innerHTML = &quot;Value before animation is applied: &quot; + window.getComputedStyle(box).left + &quot; (should be auto)&lt;br&gt;&quot;;
+    box.className = &quot;animating&quot;;
+    setTimeout(checkValueWithoutScroll, 0);
+}
+
+function checkValueWithoutScroll() {
+    results.innerHTML += &quot;Value with animation but no scroll: &quot; + window.getComputedStyle(box).left + &quot; (should be 0px)&lt;br&gt;&quot;;
+    window.scrollTo(0, 30);
+    setTimeout(checkValueWithScroll, 0);
+}
+
+function checkValueWithScroll() {
+    results.innerHTML += &quot;Value with animation after scroll: &quot; + window.getComputedStyle(box).left + &quot; (should be 100px)&lt;br&gt;&quot;;
+    if (window.testRunner)
+        window.testRunner.notifyDone();
+}
+
+window.addEventListener(&quot;load&quot;, runTest, false);
+
+&lt;/script&gt;
+
+&lt;p&gt;This element should begin animating only when the page scrolls to 20px from
+the top. The animation is almost instantaneous, so it will snap to its final
+position. Remember to scroll to the top of the page before reloading!&lt;/p&gt;
+&lt;div id=&quot;box&quot;&gt;&lt;/div&gt;
+
+&lt;div id=&quot;results&quot;&gt;&lt;/div&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/animations/trigger-container-scroll-simple.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/ChangeLog        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2015-03-17  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Implement Scroll Container Animation Triggers
+        https://bugs.webkit.org/show_bug.cgi?id=142732
+
+        Reviewed by Simon Fraser.
+
+        Test: animations/trigger-container-scroll-simple.html
+
+        Basic implementation of container-scroll. It only checks
+        the page scroll position for trigger values (not the scrolling
+        container in an overflow).
+
+        * css/CSSComputedStyleDeclaration.cpp: Add CSSPropertyWebkitAnimationTrigger
+        so that this property will appear in the inspector.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::sendScrollEvent): If the page has scrolled, let the animation
+        controller know about it.
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::updateStateMachine): Whitespace fix.
+        (WebCore::AnimationBase::fireAnimationEventsIfNeeded): If there is a trigger,
+        and the scroll position is past it, then tell the state machine that
+        we should start.
+        (WebCore::AnimationBase::timeToNextService): Use the scroll position as
+        an input to the update timer if a trigger is involved.
+
+        * page/animation/AnimationController.cpp:
+        (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Add whitespace.
+        (WebCore::AnimationControllerPrivate::scrollWasUpdated): Call updateAnimations.
+        (WebCore::AnimationController::scrollWasUpdated): Call into AnimationControllerPrivate.
+        * page/animation/AnimationController.h:
+        * page/animation/AnimationControllerPrivate.h:
+
+        * page/animation/CompositeAnimation.cpp: Keep a record of whether we have a scroll
+        triggered animation.
+        (WebCore::CompositeAnimation::CompositeAnimation):
+        (WebCore::CompositeAnimation::updateKeyframeAnimations):
+        * page/animation/CompositeAnimation.h:
+        (WebCore::CompositeAnimation::hasScrollTriggeredAnimation):
+        * platform/animation/Animation.cpp:
+        (WebCore::Animation::operator=):
+
</ins><span class="cx"> 2015-03-17  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move some code from LogicalSelectionOffsetCaches into RenderElement
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -245,6 +245,7 @@
</span><span class="cx">     CSSPropertyWebkitAnimationName,
</span><span class="cx">     CSSPropertyWebkitAnimationPlayState,
</span><span class="cx">     CSSPropertyWebkitAnimationTimingFunction,
</span><ins>+    CSSPropertyWebkitAnimationTrigger,
</ins><span class="cx">     CSSPropertyWebkitAppearance,
</span><span class="cx">     CSSPropertyWebkitBackfaceVisibility,
</span><span class="cx">     CSSPropertyWebkitBackgroundClip,
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -4374,6 +4374,9 @@
</span><span class="cx"> {
</span><span class="cx">     frame().eventHandler().sendScrollEvent();
</span><span class="cx">     frame().eventHandler().dispatchFakeMouseMoveEventSoon();
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    frame().animation().scrollWasUpdated();
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameView::removeChild(Widget&amp; widget)
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationBase.cpp        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;RenderBox.h&quot;
</span><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><ins>+#include &quot;RenderView.h&quot;
</ins><span class="cx"> #include &quot;UnitBezier.h&quot;
</span><span class="cx"> #include &lt;algorithm&gt;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="lines">@@ -198,6 +199,7 @@
</span><span class="cx">     switch (m_animationState) {
</span><span class="cx">         case AnimationState::New:
</span><span class="cx">             ASSERT(input == AnimationStateInput::StartAnimation || input == AnimationStateInput::PlayStateRunning || input == AnimationStateInput::PlayStatePaused);
</span><ins>+
</ins><span class="cx">             if (input == AnimationStateInput::StartAnimation || input == AnimationStateInput::PlayStateRunning) {
</span><span class="cx">                 m_requestedStartTime = beginAnimationUpdateTime();
</span><span class="cx">                 LOG(Animations, &quot;%p AnimationState %s -&gt; StartWaitTimer&quot;, this, nameForState(m_animationState));
</span><span class="lines">@@ -457,12 +459,29 @@
</span><span class="cx">     
</span><span class="cx">     // Check for start timeout
</span><span class="cx">     if (m_animationState == AnimationState::StartWaitTimer) {
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+        if (m_animation-&gt;trigger() &amp;&amp; m_animation-&gt;trigger()-&gt;isScrollAnimationTrigger()) {
+            if (m_object) {
+                LayoutSize offset = m_object-&gt;view().frameView().scrollOffsetForFixedPosition();
+                ScrollAnimationTrigger* scrollTrigger = static_cast&lt;ScrollAnimationTrigger*&gt;(m_animation-&gt;trigger().get());
+                if (offset.height().toFloat() &gt; scrollTrigger-&gt;startValue().value())
+                    updateStateMachine(AnimationStateInput::StartTimerFired, 0);
+            }
+
+            return;
+        }
+#endif
</ins><span class="cx">         if (beginAnimationUpdateTime() - m_requestedStartTime &gt;= m_animation-&gt;delay())
</span><span class="cx">             updateStateMachine(AnimationStateInput::StartTimerFired, 0);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     double elapsedDuration = beginAnimationUpdateTime() - m_startTime;
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    if (m_animation-&gt;trigger() &amp;&amp; m_animation-&gt;trigger()-&gt;isScrollAnimationTrigger())
+        elapsedDuration = getElapsedTime();
+#endif
+
</ins><span class="cx">     // FIXME: we need to ensure that elapsedDuration is never &lt; 0. If it is, this suggests that
</span><span class="cx">     // we had a recalcStyle() outside of beginAnimationUpdate()/endAnimationUpdate().
</span><span class="cx">     // Also check in getTimeToNextEvent().
</span><span class="lines">@@ -521,6 +540,17 @@
</span><span class="cx">         return -1;
</span><span class="cx">     
</span><span class="cx">     if (m_animationState == AnimationState::StartWaitTimer) {
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+        if (m_animation-&gt;trigger()-&gt;isScrollAnimationTrigger()) {
+            if (m_object) {
+                float currentScrollOffset = m_object-&gt;view().frameView().scrollOffsetForFixedPosition().height().toFloat();
+                ScrollAnimationTrigger* scrollTrigger = static_cast&lt;ScrollAnimationTrigger*&gt;(m_animation-&gt;trigger().get());
+                if (currentScrollOffset &gt;= scrollTrigger-&gt;startValue().value() &amp;&amp; (!scrollTrigger-&gt;hasEndValue() || currentScrollOffset &lt;= scrollTrigger-&gt;endValue().value()))
+                    return 0;
+            }
+            return -1;
+        }
+#endif
</ins><span class="cx">         double timeFromNow = m_animation-&gt;delay() - (beginAnimationUpdateTime() - m_requestedStartTime);
</span><span class="cx">         return std::max(timeFromNow, 0.0);
</span><span class="cx">     }
</span><span class="lines">@@ -672,7 +702,7 @@
</span><span class="cx"> 
</span><span class="cx"> double AnimationBase::getElapsedTime() const
</span><span class="cx"> {
</span><del>-    if (paused())    
</del><ins>+    if (paused())
</ins><span class="cx">         return m_pauseTime - m_startTime;
</span><span class="cx">     if (m_startTime &lt;= 0)
</span><span class="cx">         return 0;
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationController.cpp (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationController.cpp        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/animation/AnimationController.cpp        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx">         result.iterator-&gt;value = CompositeAnimation::create(this);
</span><span class="cx">         renderer.setIsCSSAnimating(true);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     return *result.iterator-&gt;value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -514,6 +515,13 @@
</span><span class="cx">     removeFromAnimationsWaitingForStartTimeResponse(animation);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+void AnimationControllerPrivate::scrollWasUpdated()
+{
+    updateAnimations(CallSetChanged);
+}
+#endif
+
</ins><span class="cx"> AnimationController::AnimationController(Frame&amp; frame)
</span><span class="cx">     : m_data(std::make_unique&lt;AnimationControllerPrivate&gt;(frame))
</span><span class="cx"> {
</span><span class="lines">@@ -700,4 +708,11 @@
</span><span class="cx">     return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+void AnimationController::scrollWasUpdated()
+{
+    m_data-&gt;scrollWasUpdated();
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationController.h (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationController.h        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/animation/AnimationController.h        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -86,6 +86,10 @@
</span><span class="cx">     
</span><span class="cx">     static bool supportsAcceleratedAnimationOfProperty(CSSPropertyID);
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    void scrollWasUpdated();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     const std::unique_ptr&lt;AnimationControllerPrivate&gt; m_data;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationControllerPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -117,6 +117,10 @@
</span><span class="cx">     bool allowsNewAnimationsWhileSuspended() const { return m_allowsNewAnimationsWhileSuspended; }
</span><span class="cx">     void setAllowsNewAnimationsWhileSuspended(bool);
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    void scrollWasUpdated();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     void animationTimerFired();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCompositeAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -43,6 +43,9 @@
</span><span class="cx"> 
</span><span class="cx"> CompositeAnimation::CompositeAnimation(AnimationControllerPrivate* animationController)
</span><span class="cx">     : m_animationController(animationController)
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    , m_hasScrollTriggeredAnimation(false)
+#endif
</ins><span class="cx"> {
</span><span class="cx">     m_suspended = animationController-&gt;isSuspended() &amp;&amp; !animationController-&gt;allowsNewAnimationsWhileSuspended();
</span><span class="cx"> }
</span><span class="lines">@@ -222,7 +225,11 @@
</span><span class="cx">         // Mark all existing animations as no longer active.
</span><span class="cx">         for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it)
</span><span class="cx">             it-&gt;value-&gt;setIndex(-1);
</span><del>-            
</del><ins>+
+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+        m_hasScrollTriggeredAnimation = false;
+#endif
+
</ins><span class="cx">         // Toss the animation order map.
</span><span class="cx">         m_keyframeAnimationOrderMap.clear();
</span><span class="cx"> 
</span><span class="lines">@@ -245,7 +252,12 @@
</span><span class="cx">                     // If this animation is postActive, skip it so it gets removed at the end of this function.
</span><span class="cx">                     if (keyframeAnim-&gt;postActive())
</span><span class="cx">                         continue;
</span><del>-                    
</del><ins>+
+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+                    if (animation.trigger()-&gt;isScrollAnimationTrigger())
+                        m_hasScrollTriggeredAnimation = true;
+#endif
+
</ins><span class="cx">                     // This one is still active.
</span><span class="cx"> 
</span><span class="cx">                     // Animations match, but play states may differ. Update if needed.
</span><span class="lines">@@ -265,6 +277,12 @@
</span><span class="cx">                     for (auto it = keyframeAnim-&gt;keyframes().beginProperties(), end = keyframeAnim-&gt;keyframes().endProperties(); it != end; ++it)
</span><span class="cx">                         LOG(Animations, &quot;  property %s&quot;, getPropertyName(*it));
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+                    if (animation.trigger()-&gt;isScrollAnimationTrigger())
+                        m_hasScrollTriggeredAnimation = true;
+#endif
+
</ins><span class="cx">                     m_keyframeAnimations.set(keyframeAnim-&gt;name().impl(), keyframeAnim);
</span><span class="cx">                 }
</span><span class="cx">                 
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCompositeAnimationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.h (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CompositeAnimation.h        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.h        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -80,6 +80,10 @@
</span><span class="cx">     bool pauseTransitionAtTime(CSSPropertyID, double);
</span><span class="cx">     unsigned numberOfActiveAnimations() const;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    bool hasScrollTriggeredAnimation() const { return m_hasScrollTriggeredAnimation; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     CompositeAnimation(AnimationControllerPrivate*);
</span><span class="cx"> 
</span><span class="lines">@@ -87,13 +91,16 @@
</span><span class="cx">     void updateKeyframeAnimations(RenderElement*, RenderStyle* currentStyle, RenderStyle* targetStyle);
</span><span class="cx">     
</span><span class="cx">     typedef HashMap&lt;int, RefPtr&lt;ImplicitAnimation&gt;&gt; CSSPropertyTransitionsMap;
</span><del>-    typedef HashMap&lt;AtomicStringImpl*, RefPtr&lt;KeyframeAnimation&gt;&gt;  AnimationNameMap;
</del><ins>+    typedef HashMap&lt;AtomicStringImpl*, RefPtr&lt;KeyframeAnimation&gt;&gt; AnimationNameMap;
</ins><span class="cx"> 
</span><span class="cx">     AnimationControllerPrivate* m_animationController;
</span><span class="cx">     CSSPropertyTransitionsMap m_transitions;
</span><span class="cx">     AnimationNameMap m_keyframeAnimations;
</span><span class="cx">     Vector&lt;AtomicStringImpl*&gt; m_keyframeAnimationOrderMap;
</span><span class="cx">     bool m_suspended;
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    bool m_hasScrollTriggeredAnimation;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformanimationAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/animation/Animation.cpp (181654 => 181655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/animation/Animation.cpp        2015-03-17 18:58:59 UTC (rev 181654)
+++ trunk/Source/WebCore/platform/animation/Animation.cpp        2015-03-17 19:01:46 UTC (rev 181655)
</span><span class="lines">@@ -94,6 +94,9 @@
</span><span class="cx">     m_delay = o.m_delay;
</span><span class="cx">     m_duration = o.m_duration;
</span><span class="cx">     m_timingFunction = o.m_timingFunction;
</span><ins>+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    m_trigger = o.m_trigger;
+#endif
</ins><span class="cx">     m_direction = o.m_direction;
</span><span class="cx">     m_fillMode = o.m_fillMode;
</span><span class="cx">     m_playState = o.m_playState;
</span></span></pre>
</div>
</div>

</body>
</html>