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

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: 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..10caaf10002737fd631a444b80dc21ebbe92802c 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_implOnlyAnimationUpdates.empty()) {
+ return true;
+ }
switch (m_runState) {
case RunState::Idle:
case RunState::RunningOnCompositor:
@@ -238,6 +242,40 @@ FloatPoint ScrollAnimatorCompositorCoordinator::blinkOffsetFromCompositorOffset(
return offset;
}
+void ScrollAnimatorCompositorCoordinator::updateCompositorAnimations()
+{
+ if (!getScrollableArea()->scrollAnimatorEnabled())
+ return;
+
+ if (!getScrollableArea()->layerForScrolling()) {
+ m_implOnlyAnimationUpdates.clear();
+ return;
+ }
+
+ for (auto& update : m_implOnlyAnimationUpdates) {
+ update.element_id_ = getScrollableArea()->layerForScrolling()->platformLayer()->id();
+ if (CompositorAnimationTimeline* timeline = getScrollableArea()->compositorAnimationTimeline())
+ timeline->compositorAnimationHost()->addImplOnlyScrollOffsetAnimationUpdate(update);
+ }
+ m_implOnlyAnimationUpdates.clear();
+}
+
+void ScrollAnimatorCompositorCoordinator::updateImplOnlyAnimationWithAdjustment(
+ const FloatSize& adjustment)
+{
+ if (!getScrollableArea()->scrollAnimatorEnabled())
+ return;
+
+ // Note that we can't set the element_id_ here because we may not be in
+ // LifecycleState::CompositingClean and may not even have a composited layer.
+ cc::ScrollOffsetAnimationUpdate update;
loyso (OOO) 2016/05/06 01:04:38 You directly use cc update type here (without wrap
ymalik 2016/05/06 05:41:49 Ah yes. So we would still need to save the list of
ymalik 2016/05/10 19:40:59 Done.
+ update.type_ = cc::ScrollOffsetAnimationUpdate::Type::SCROLL_OFFSET_CHANGED;
+ update.adjustment_ = gfx::Vector2dF(adjustment.width(), adjustment.height());
+
+ m_implOnlyAnimationUpdates.push_back(update);
+ getScrollableArea()->registerForAnimation();
+}
+
String ScrollAnimatorCompositorCoordinator::runStateAsText() const
{
switch (m_runState) {

Powered by Google App Engine
This is Rietveld 408576698