Commit 626e5d22 authored by abarth@chromium.org's avatar abarth@chromium.org

Disentangle updating the ScrollingCoordinator from RenderLayerCompositor

We only need to update the ScrollingCoordinator once at the root of the frame
tree. We shouldn't be poking at it at every level of the recursion.

This CL finally achieves my dream of controlling
RenderLayerCompositor::updateIfNeeded with just the CompositingUpdateType enum.

Review URL: https://codereview.chromium.org/330513002

git-svn-id: svn://svn.chromium.org/blink/trunk@176046 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d230031e
...@@ -2832,7 +2832,12 @@ void FrameView::updateLayoutAndStyleForPainting() ...@@ -2832,7 +2832,12 @@ void FrameView::updateLayoutAndStyleForPainting()
if (RenderView* view = renderView()) { if (RenderView* view = renderView()) {
InspectorInstrumentation::willUpdateLayerTree(view->frame()); InspectorInstrumentation::willUpdateLayerTree(view->frame());
view->compositor()->updateIfNeededRecursive(); view->compositor()->updateIfNeededRecursive();
if (view->compositor()->inCompositingMode() && m_frame->isMainFrame())
m_frame->page()->scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
InspectorInstrumentation::didUpdateLayerTree(view->frame()); InspectorInstrumentation::didUpdateLayerTree(view->frame());
} }
......
...@@ -122,9 +122,12 @@ void ScrollingCoordinator::notifyLayoutUpdated() ...@@ -122,9 +122,12 @@ void ScrollingCoordinator::notifyLayoutUpdated()
m_shouldScrollOnMainThreadDirty = true; m_shouldScrollOnMainThreadDirty = true;
} }
void ScrollingCoordinator::updateAfterCompositingChange() void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded()
{ {
TRACE_EVENT0("input", "ScrollingCoordinator::updateAfterCompositingChange"); if (!shouldUpdateAfterCompositingChange())
return;
TRACE_EVENT0("input", "ScrollingCoordinator::updateAfterCompositingChangeIfNeeded");
if (m_scrollGestureRegionIsDirty) { if (m_scrollGestureRegionIsDirty) {
// Compute the region of the page where we can't handle scroll gestures and mousewheel events // Compute the region of the page where we can't handle scroll gestures and mousewheel events
......
...@@ -64,10 +64,7 @@ public: ...@@ -64,10 +64,7 @@ public:
// Called when any frame has done its layout. // Called when any frame has done its layout.
void notifyLayoutUpdated(); void notifyLayoutUpdated();
// Should be called after compositing has been updated. void updateAfterCompositingChangeIfNeeded();
void updateAfterCompositingChange();
bool needsToUpdateAfterCompositingChange() const { return m_scrollGestureRegionIsDirty || m_touchEventTargetRectsAreDirty || frameViewIsDirty(); }
void updateHaveWheelEventHandlers(); void updateHaveWheelEventHandlers();
void updateHaveScrollEventHandlers(); void updateHaveScrollEventHandlers();
...@@ -132,6 +129,8 @@ protected: ...@@ -132,6 +129,8 @@ protected:
bool m_shouldScrollOnMainThreadDirty; bool m_shouldScrollOnMainThreadDirty;
private: private:
bool shouldUpdateAfterCompositingChange() const { return m_scrollGestureRegionIsDirty || m_touchEventTargetRectsAreDirty || frameViewIsDirty(); }
void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons); void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons);
bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const;
......
...@@ -291,11 +291,7 @@ void RenderLayerCompositor::updateIfNeeded() ...@@ -291,11 +291,7 @@ void RenderLayerCompositor::updateIfNeeded()
CompositingUpdateType updateType = m_pendingUpdateType; CompositingUpdateType updateType = m_pendingUpdateType;
m_pendingUpdateType = CompositingUpdateNone; m_pendingUpdateType = CompositingUpdateNone;
if (!hasAcceleratedCompositing()) if (!hasAcceleratedCompositing() || updateType == CompositingUpdateNone)
return;
bool needsToUpdateScrollingCoordinator = scrollingCoordinator() && scrollingCoordinator()->needsToUpdateAfterCompositingChange();
if (updateType == CompositingUpdateNone && !needsToUpdateScrollingCoordinator)
return; return;
RenderLayer* updateRoot = rootRenderLayer(); RenderLayer* updateRoot = rootRenderLayer();
...@@ -366,11 +362,6 @@ void RenderLayerCompositor::updateIfNeeded() ...@@ -366,11 +362,6 @@ void RenderLayerCompositor::updateIfNeeded()
m_needsUpdateFixedBackground = false; m_needsUpdateFixedBackground = false;
} }
// The scrolling coordinator may realize that it needs updating while compositing was being updated in this function.
needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoordinator()->needsToUpdateAfterCompositingChange();
if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode())
scrollingCoordinator()->updateAfterCompositingChange();
for (unsigned i = 0; i < layersNeedingRepaint.size(); i++) { for (unsigned i = 0; i < layersNeedingRepaint.size(); i++) {
RenderLayer* layer = layersNeedingRepaint[i]; RenderLayer* layer = layersNeedingRepaint[i];
layer->repainter().computeRepaintRectsIncludingNonCompositingDescendants(); layer->repainter().computeRepaintRectsIncludingNonCompositingDescendants();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment