Commit b981fd6e authored by abarth@chromium.org's avatar abarth@chromium.org

updateLayerPositionsAfterLayout shouldn't have a RenderGeometryMap

This CL remove the RenderGeometryMap from updateLayerPositionsAfterLayout. The
only remaining use of the geometry map was to compute an argument for
RenderLayerScrollableArea::positionOverflowControls. However, it turns out it
doesn't matter what value we pass to positionOverflowControls at this point. By
removing the RenderGeometryMap, this CL makes updateLayerPositionsAfterLayout
twice as fast.

Historically, the overflow controls were backed by NSViews, which meant they
needed to be positioned in absolute space by the widget tree. Now, however,
they're either drawn by Blink or composited by cc. If the overflow controls
are painted by Blink, we're reposition them immediately before painting. If the
overflow controls are composited, we'll subtract out the offsetFromRoot before
passing the values to cc. In both cases, it doesn't matter care what value we
pass here.

We should eventually remove this function call from this codepath. This isn't
the correct codepath in which to position the overflow controls. However, we
can save that work for a future CL.

R=esprehn@chromium.org
BUG=383636,382548

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176070 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 55d6b828
......@@ -257,33 +257,22 @@ void RenderLayer::updateLayerPositionsAfterLayout(const RenderLayer* rootLayer,
// FIXME: Remove incremental compositing updates after fixing the chicken/egg issues
// https://code.google.com/p/chromium/issues/detail?id=343756
DisableCompositingQueryAsserts disabler;
RenderGeometryMap geometryMap(UseTransforms);
if (this != rootLayer)
geometryMap.pushMappingsToAncestor(parent(), 0);
updateLayerPositionRecursive(&geometryMap, flags);
updateLayerPositionRecursive(flags);
}
void RenderLayer::updateLayerPositionRecursive(RenderGeometryMap* geometryMap, UpdateLayerPositionsFlags flags)
void RenderLayer::updateLayerPositionRecursive(UpdateLayerPositionsFlags flags)
{
updateLayerPosition();
if (geometryMap)
geometryMap->pushMappingsToAncestor(this, parent());
// Clear our cached clip rect information.
m_clipper.clearClipRects();
if (hasOverflowControls()) {
LayoutPoint offsetFromRoot;
if (geometryMap)
offsetFromRoot = LayoutPoint(geometryMap->absolutePoint(FloatPoint()));
else {
// FIXME: It looks suspicious to call convertToLayerCoords here
// as canUseConvertToLayerCoords may be true for an ancestor layer.
convertToLayerCoords(root(), offsetFromRoot);
}
scrollableArea()->positionOverflowControls(toIntSize(roundedIntPoint(offsetFromRoot)));
// FIXME: We should figure out the right time to position the overflow controls.
// This call appears to be necessary to pass some layout test that use EventSender,
// presumably because the normal time to position the controls is during paint. We
// probably shouldn't position the overflow controls during paint either...
scrollableArea()->positionOverflowControls(IntSize());
}
updateDescendantDependentFlags();
......@@ -310,13 +299,10 @@ void RenderLayer::updateLayerPositionRecursive(RenderGeometryMap* geometryMap, U
flags |= UpdatePagination;
for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
child->updateLayerPositionRecursive(geometryMap, flags);
child->updateLayerPositionRecursive(flags);
if ((flags & NeedsFullRepaintInBacking) && hasCompositedLayerMapping() && !compositedLayerMapping()->paintsIntoCompositedAncestor())
compositedLayerMapping()->setContentsNeedDisplay();
if (geometryMap)
geometryMap->popMappingsToAncestor(parent());
}
void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant()
......@@ -1447,7 +1433,7 @@ void RenderLayer::removeOnlyThisLayer()
// Hits in compositing/overflow/automatically-opt-into-composited-scrolling-part-1.html
DisableCompositingQueryAsserts disabler;
current->updateLayerPositionRecursive(0);
current->updateLayerPositionRecursive();
current = next;
}
......
......@@ -167,7 +167,7 @@ public:
void updateLayerPositionsAfterDocumentScroll();
// FIXME: Should updateLayerPositions be private?
void updateLayerPositionRecursive(RenderGeometryMap*, UpdateLayerPositionsFlags = CheckForRepaint);
void updateLayerPositionRecursive(UpdateLayerPositionsFlags = CheckForRepaint);
bool isPaginated() const { return m_isPaginated; }
RenderLayer* enclosingPaginationLayer() const { return m_enclosingPaginationLayer; }
......
......@@ -139,10 +139,9 @@ void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt
else
layer()->repainter().setRepaintStatus(NeedsFullRepaint);
// Hit in animations/interpolation/perspective-interpolation.html
// FIXME: I suspect we can remove this assert disabler now.
DisableCompositingQueryAsserts disabler;
// There is only one layer to update, it is not worth using |cachedOffset| since
// we are not sure the value will be used.
layer()->updateLayerPositionRecursive(0);
layer()->updateLayerPositionRecursive();
}
}
} else if (layer() && layer()->parent()) {
......
......@@ -965,17 +965,6 @@ int RenderLayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRel
return m_hBar->height();
}
void RenderLayerScrollableArea::positionOverflowControls()
{
RenderGeometryMap geometryMap(UseTransforms);
RenderView* view = box().view();
if (box().layer() != view->layer() && box().layer()->parent())
geometryMap.pushMappingsToAncestor(box().layer()->parent(), 0);
LayoutPoint offsetFromRoot = LayoutPoint(geometryMap.absolutePoint(FloatPoint()));
positionOverflowControls(toIntSize(roundedIntPoint(offsetFromRoot)));
}
void RenderLayerScrollableArea::positionOverflowControls(const IntSize& offsetFromRoot)
{
if (!hasScrollbar() && !box().canResize())
......
......@@ -153,9 +153,6 @@ public:
void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls);
void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& damageRect);
// If IntSize is not given, then we must incur additional overhead to instantiate a RenderGeometryMap
// and compute the correct offset ourselves.
void positionOverflowControls();
void positionOverflowControls(const IntSize& offsetFromRoot);
// isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control
......
......@@ -650,7 +650,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U
updateChildClippingMaskLayerGeometry();
if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scrollsOverflow())
m_owningLayer.scrollableArea()->positionOverflowControls();
m_owningLayer.scrollableArea()->positionOverflowControls(IntSize());
if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
updateLayerBlendMode(renderer()->style());
......
......@@ -93,7 +93,7 @@ void GraphicsLayerUpdater::update(RenderLayer& layer, UpdateType updateType, con
layer.compositor()->updateRootLayerPosition();
if (mapping->hasUnpositionedOverflowControlsLayers())
layer.scrollableArea()->positionOverflowControls();
layer.scrollableArea()->positionOverflowControls(IntSize());
}
UpdateContext childContext(context, layer);
......
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