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

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

Issue 1648293003: Fix smooth scroll jump when switching scroll handling between MT and CC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todo + nit Created 4 years, 10 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/ScrollableArea.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
index 6d5b7a1d6413667c0cf6b8b610cbe2324d75243e..a323faafe0eb9cabc954bf1a82e7647b15233654 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -37,6 +37,7 @@
#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/GraphicsLayer.h"
+#include "platform/scroll/MainThreadScrollingReason.h"
#include "platform/scroll/ProgrammaticScrollAnimator.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "wtf/PassOwnPtr.h"
@@ -526,7 +527,14 @@ void ScrollableArea::cancelProgrammaticScrollAnimation()
bool ScrollableArea::shouldScrollOnMainThread() const
{
if (GraphicsLayer* layer = layerForScrolling()) {
- return layer->platformLayer()->shouldScrollOnMainThread();
+ uint32_t reasons = layer->platformLayer()->mainThreadScrollingReasons();
+ // Should scroll on main thread unless the reason is the one that is set
+ // by the ScrollAnimator, in which case, the animation can still be
+ // scheduled on the compositor.
+ // TODO(ymalik): We have a non-transient "main thread scrolling reason"
+ // that doesn't actually cause shouldScrollOnMainThread() to be true.
+ // This is confusing and should be cleaned up.
+ return !!(reasons & ~MainThreadScrollingReason::kAnimatingScollOnMainThread);
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698