Commit 5c2c5188 authored by wangxianzhu's avatar wangxianzhu Committed by Commit bot

Changes in PaintLayer and PaintLayerPainter for synchronized painting

- Simplify ancestor marking of needsRepaint flags, because we have
  synchronzied whole layer-tree cleaning of the flags after painting.
  This removes the dependency of needs repaint flag to self-painting
  flag.

- Don't output subsequence for non-self-painting layers. Previously
  we output subsequence for non-self-painting layers which has
  self-painting descendants. This reduces number of subsequences.

- Don't output subsequences when printing because they are no use.

- Don't output subsequence when painting overlay scrollbars to avoid
  duplicated display item ids and another tree of subsequences which
  just enclose overlay scrollbars.

Covered by existing tests when synchronized painting is enabled.

BUG=536999

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

Cr-Commit-Position: refs/heads/master@{#357007}
parent fe1b9618
......@@ -2672,19 +2672,10 @@ void PaintLayer::computeSelfHitTestRects(LayerHitTestRects& rects) const
void PaintLayer::setNeedsRepaint()
{
PaintLayer* layer = this;
while (layer && !layer->isSelfPaintingLayer() && !layer->hasSelfPaintingLayerDescendant())
layer = layer->parent();
// This layer is in an orphaned layer tree. Will mark ancestor for repaint when
// the orphaned tree is added into another tree.
if (!layer)
return;
layer->m_needsRepaint = true;
m_needsRepaint = true;
// Do this unconditionally to ensure container chain is marked when compositing status of the layer changes.
layer->markAncestorChainForNeedsRepaint();
markAncestorChainForNeedsRepaint();
}
void PaintLayer::markAncestorChainForNeedsRepaint()
......@@ -2708,11 +2699,9 @@ void PaintLayer::markAncestorChainForNeedsRepaint()
break;
container = owner->enclosingLayer();
}
if (container->isSelfPaintingLayer() || container->hasSelfPaintingLayerDescendant()) {
if (container->m_needsRepaint)
break;
container->m_needsRepaint = true;
}
if (container->m_needsRepaint)
break;
container->m_needsRepaint = true;
layer = container;
}
}
......
......@@ -72,10 +72,8 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayer(GraphicsContext* co
// Non self-painting layers without self-painting descendants don't need to be painted as their
// layoutObject() should properly paint itself.
if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLayerDescendant()) {
ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimmingPaintV2Enabled());
if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLayerDescendant())
return FullyPainted;
}
if (shouldSuppressPaintingLayer(&m_paintLayer))
return FullyPainted;
......@@ -479,9 +477,10 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintChildren(unsigned childre
Optional<SubsequenceRecorder> subsequenceRecorder;
if (!paintingInfo.disableSubsequenceCache
&& !context->printing()
&& m_paintLayer.isSelfPaintingLayer()
&& !(paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers)
&& !(paintFlags & PaintLayerPaintingReflection)
&& !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) {
&& !(paintFlags & (PaintLayerPaintingReflection | PaintLayerPaintingRootBackgroundOnly | PaintLayerPaintingOverlayScrollbars))) {
if (!m_paintLayer.needsRepaint()
&& paintingInfo.scrollOffsetAccumulation == m_paintLayer.previousScrollOffsetAccumulationForPainting()
&& SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer, subsequenceType))
......
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