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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2559273003: Blink Compositor Animation: Introduce CompositorAnimationHost correctly. (Closed)
Patch Set: Allocate on stack in unit tests. Created 4 years 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/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index ac22ac5ab04f247e1d77926b9acabb6a835c8cac..01fcf7caf800c3006633f899fbc15749bb1896a5 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -144,11 +144,8 @@ void PaintLayerScrollableArea::dispose() {
}
}
- if (box().frame() && box().frame()->page()) {
- if (ScrollingCoordinator* scrollingCoordinator =
- box().frame()->page()->scrollingCoordinator())
- scrollingCoordinator->willDestroyScrollableArea(this);
- }
+ if (ScrollingCoordinator* scrollingCoordinator = getScrollingCoordinator())
+ scrollingCoordinator->willDestroyScrollableArea(this);
if (!box().documentBeingDestroyed()) {
Node* node = box().node();
@@ -1695,6 +1692,19 @@ void PaintLayerScrollableArea::updateCompositingLayersAfterScroll() {
}
}
+ScrollingCoordinator* PaintLayerScrollableArea::getScrollingCoordinator()
+ const {
+ LocalFrame* frame = box().frame();
+ if (!frame)
+ return nullptr;
+
+ Page* page = frame->page();
+ if (!page)
+ return nullptr;
+
+ return page->scrollingCoordinator();
+}
+
bool PaintLayerScrollableArea::usesCompositedScrolling() const {
// See https://codereview.chromium.org/176633003/ for the tests that fail
// without this disabler.
@@ -1704,12 +1714,9 @@ bool PaintLayerScrollableArea::usesCompositedScrolling() const {
}
bool PaintLayerScrollableArea::shouldScrollOnMainThread() const {
- if (LocalFrame* frame = box().frame()) {
- if (Page* page = frame->page()) {
- if (page->scrollingCoordinator()
- ->shouldUpdateScrollLayerPositionOnMainThread())
- return true;
- }
+ if (ScrollingCoordinator* scrollingCoordinator = getScrollingCoordinator()) {
+ if (scrollingCoordinator->shouldUpdateScrollLayerPositionOnMainThread())
+ return true;
}
return ScrollableArea::shouldScrollOnMainThread();
}
@@ -1794,14 +1801,19 @@ void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() {
m_rebuildVerticalScrollbarLayer = false;
}
+CompositorAnimationHost* PaintLayerScrollableArea::compositorAnimationHost()
+ const {
+ if (ScrollingCoordinator* coordinator = getScrollingCoordinator())
+ return coordinator->compositorAnimationHost();
+
+ return nullptr;
+}
+
CompositorAnimationTimeline*
PaintLayerScrollableArea::compositorAnimationTimeline() const {
- if (LocalFrame* frame = box().frame()) {
- if (Page* page = frame->page())
- return page->scrollingCoordinator()
- ? page->scrollingCoordinator()->compositorAnimationTimeline()
- : nullptr;
- }
+ if (ScrollingCoordinator* coordinator = getScrollingCoordinator())
+ return coordinator->compositorAnimationTimeline();
+
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698