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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 2654883002: Give OOPIF FrameViews their own scroll animation timelines and hosts (Closed)
Patch Set: Created 3 years, 11 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/core/page/scrolling/ScrollingCoordinator.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
index aef4256f37f49e2b5fc69b10c7d0afc07fee4056..feeddc1a5f29dfd8f27462341ba249e2b6eb950f 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -508,8 +508,19 @@ bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(
isForRootLayer(scrollableArea))
m_page->chromeClient().registerViewportLayers();
- scrollableArea->layerForScrollingDidChange(
- m_programmaticScrollAnimatorTimeline.get());
+ CompositorAnimationTimeline* timeline;
+ // FrameView::compositorAnimationTimeline() can indirectly return
+ // m_programmaticScrollAnimatorTimeline if it does not have its own
+ // timeline.
+ if (scrollableArea->isFrameView()) {
+ timeline = toFrameView(scrollableArea)->compositorAnimationTimeline();
+ } else if (scrollableArea->isPaintLayerScrollableArea()) {
+ timeline = toPaintLayerScrollableArea(scrollableArea)
+ ->compositorAnimationTimeline();
+ } else {
+ timeline = m_programmaticScrollAnimatorTimeline.get();
+ }
+ scrollableArea->layerForScrollingDidChange(timeline);
return !!webLayer;
}
@@ -852,20 +863,37 @@ void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(
}
void ScrollingCoordinator::layerTreeViewInitialized(
- WebLayerTreeView& layerTreeView) {
+ WebLayerTreeView& layerTreeView,
+ FrameView* view) {
if (Platform::current()->isThreadedAnimationEnabled() &&
layerTreeView.compositorAnimationHost()) {
- m_animationHost = WTF::makeUnique<CompositorAnimationHost>(
- layerTreeView.compositorAnimationHost());
- m_programmaticScrollAnimatorTimeline =
+ std::unique_ptr<CompositorAnimationTimeline> timeline =
CompositorAnimationTimeline::create();
- m_animationHost->addTimeline(*m_programmaticScrollAnimatorTimeline.get());
+ std::unique_ptr<CompositorAnimationHost> host =
+ WTF::makeUnique<CompositorAnimationHost>(
+ layerTreeView.compositorAnimationHost());
+ if (view && view->frame().localFrameRoot() != m_page->mainFrame()) {
+ view->setAnimationHost(std::move(host));
+ view->setAnimationTimeline(std::move(timeline));
+ view->compositorAnimationHost()->addTimeline(
+ *view->compositorAnimationTimeline());
+ } else {
+ m_animationHost = std::move(host);
+ m_programmaticScrollAnimatorTimeline = std::move(timeline);
+ m_animationHost->addTimeline(*m_programmaticScrollAnimatorTimeline.get());
+ }
}
}
void ScrollingCoordinator::willCloseLayerTreeView(
- WebLayerTreeView& layerTreeView) {
- if (m_programmaticScrollAnimatorTimeline) {
+ WebLayerTreeView& layerTreeView,
+ FrameView* view) {
+ if (view && view->frame().localFrameRoot() != m_page->mainFrame()) {
+ view->compositorAnimationHost()->removeTimeline(
+ *view->compositorAnimationTimeline());
+ view->setAnimationTimeline(nullptr);
+ view->setAnimationHost(nullptr);
+ } else if (m_programmaticScrollAnimatorTimeline) {
m_animationHost->removeTimeline(
*m_programmaticScrollAnimatorTimeline.get());
m_programmaticScrollAnimatorTimeline = nullptr;

Powered by Google App Engine
This is Rietveld 408576698