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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp

Issue 1950243005: Communicate MT changes to impl-only scroll offset animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
index 41858117597c83e260d30c92e1c10d6dba15207d..3bed1cea1177446807c8e0de929d15ffd2b96e6b 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
@@ -6,6 +6,7 @@
#include "cc/animation/scroll_offset_animation_curve.h"
#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/animation/CompositorAnimationHost.h"
#include "platform/animation/CompositorAnimationPlayer.h"
#include "platform/animation/CompositorAnimationTimeline.h"
#include "platform/graphics/CompositorFactory.h"
@@ -47,6 +48,9 @@ void ScrollAnimatorCompositorCoordinator::resetAnimationState()
bool ScrollAnimatorCompositorCoordinator::hasAnimationThatRequiresService() const
{
+ if (!m_implOnlyAnimationAdjustments.empty()) {
loyso (OOO) 2016/05/11 06:25:45 no brackets needed.
ymalik 2016/05/12 22:31:25 Done.
+ return true;
+ }
switch (m_runState) {
case RunState::Idle:
case RunState::RunningOnCompositor:
@@ -238,6 +242,35 @@ FloatPoint ScrollAnimatorCompositorCoordinator::blinkOffsetFromCompositorOffset(
return offset;
}
+void ScrollAnimatorCompositorCoordinator::updateCompositorAnimations()
+{
+ if (!getScrollableArea()->scrollAnimatorEnabled())
+ return;
+
+ CompositorAnimationTimeline* timeline = getScrollableArea()->compositorAnimationTimeline();
+ if (!getScrollableArea()->layerForScrolling() || !timeline) {
+ m_implOnlyAnimationAdjustments.clear();
+ return;
+ }
+
+ for (auto& update : m_implOnlyAnimationAdjustments) {
+ int elementId = getScrollableArea()->layerForScrolling()->platformLayer()->id();
loyso (OOO) 2016/05/11 06:25:45 cc::ElementId
ymalik 2016/05/12 22:31:25 Done.
+ timeline->compositorAnimationHost().updateImplOnlyScrollOffsetAnimation(
loyso (OOO) 2016/05/11 06:28:58 compositorAnimationHost() can be nullptr inside if
ymalik 2016/05/12 22:31:25 compositorAnimatiomHost() is currently returned by
+ gfx::Vector2dF(update.width(), update.height()), elementId);
+ }
+ m_implOnlyAnimationAdjustments.clear();
+}
+
+void ScrollAnimatorCompositorCoordinator::updateImplOnlyScrollOffsetAnimation(
+ const FloatSize& adjustment)
+{
+ if (!getScrollableArea()->scrollAnimatorEnabled())
+ return;
+
+ m_implOnlyAnimationAdjustments.push_back(adjustment);
+ getScrollableArea()->registerForAnimation();
+}
+
String ScrollAnimatorCompositorCoordinator::runStateAsText() const
{
switch (m_runState) {

Powered by Google App Engine
This is Rietveld 408576698